aboutsummaryrefslogtreecommitdiff
path: root/gdb/target.h
diff options
context:
space:
mode:
authorPedro Alves <palves@redhat.com>2018-08-31 14:24:13 +0100
committerPedro Alves <palves@redhat.com>2018-08-31 18:47:36 +0100
commit7ea65f08fa1b8279b65133a958de02fe84767eb9 (patch)
treeb5db331c660b8d45bc13d75c6c463df4d7b1f51e /gdb/target.h
parent7eb65fafed7b50511f52664e98e22b20eb697197 (diff)
downloadgdb-7ea65f08fa1b8279b65133a958de02fe84767eb9.zip
gdb-7ea65f08fa1b8279b65133a958de02fe84767eb9.tar.gz
gdb-7ea65f08fa1b8279b65133a958de02fe84767eb9.tar.bz2
Add comment describing continuable/steppable/non-steppable watchpoints
These weren't described anywhere in the sources. gdb/ChangeLog: 2018-08-31 Pedro Alves <palves@redhat.com> * gdbarch.sh (have_nonsteppable_watchpoint): Add comment. * target.h (Hardware watchpoint interfaces): Describe continuable/steppable/non-steppable watchpoints. * gdbarch.h, gdbarch.c: Regenerate.
Diffstat (limited to 'gdb/target.h')
-rw-r--r--gdb/target.h34
1 files changed, 34 insertions, 0 deletions
diff --git a/gdb/target.h b/gdb/target.h
index b29d34b..229b5d0 100644
--- a/gdb/target.h
+++ b/gdb/target.h
@@ -1905,6 +1905,40 @@ extern struct thread_info *target_thread_handle_to_thread_info
/* Hardware watchpoint interfaces. */
+/* GDB's current model is that there are three "kinds" of watchpoints,
+ with respect to when they trigger and how you can move past them.
+
+ Those are: continuable, steppable, and non-steppable.
+
+ Continuable watchpoints are like x86's -- those trigger after the
+ memory access's side effects are fully committed to memory. I.e.,
+ they trap with the PC pointing at the next instruction already.
+ Continuing past such a watchpoint is doable by just normally
+ continuing, hence the name.
+
+ Both steppable and non-steppable watchpoints trap before the memory
+ access. I.e, the PC points at the instruction that is accessing
+ the memory. So GDB needs to single-step once past the current
+ instruction in order to make the access effective and check whether
+ the instruction's side effects change the watched expression.
+
+ Now, in order to step past that instruction, depending on
+ architecture and target, you can have two situations:
+
+ - steppable watchpoints: you can single-step with the watchpoint
+ still armed, and the watchpoint won't trigger again.
+
+ - non-steppable watchpoints: if you try to single-step with the
+ watchpoint still armed, you'd trap the watchpoint again and the
+ thread wouldn't make any progress. So GDB needs to temporarily
+ remove the watchpoint in order to step past it.
+
+ If your target/architecture does not signal that it has either
+ steppable or non-steppable watchpoints via either
+ target_have_steppable_watchpoint or
+ gdbarch_have_nonsteppable_watchpoint, GDB assumes continuable
+ watchpoints. */
+
/* Returns non-zero if we were stopped by a hardware watchpoint (memory read or
write). Only the INFERIOR_PTID task is being queried. */