[PATCHv3,1/9] gdb: create_breakpoint: assert for a valid thread-id
Commit Message
Add an assert into create_breakpoint (breakpoint.c) that the thread
argument is a valid thread-id; either a value greater than zero, or -1
to indicate any thread.
The thread is ignored if parse_extra is true though, so take that into
account too.
There should be no user visible changes after this commit.
---
gdb/breakpoint.c | 4 ++++
gdb/breakpoint.h | 6 ++++++
2 files changed, 10 insertions(+)
@@ -9000,6 +9000,10 @@ create_breakpoint (struct gdbarch *gdbarch,
gdb_assert (ops != NULL);
+ /* If PARSE_EXTRA is true then the thread-id will be parsed from
+ EXTRA_STRING, otherwise, ensure THREAD is valid. */
+ gdb_assert (parse_extra || thread == -1 || thread > 0);
+
/* If extra_string isn't useful, set it to NULL. */
if (extra_string != NULL && *extra_string == '\0')
extra_string = NULL;
@@ -1589,6 +1589,12 @@ enum breakpoint_create_flags
the FORCE_CONDITION parameter is ignored and the corresponding argument
is parsed from EXTRA_STRING.
+ The THREAD should be a global thread number, the created breakpoint will
+ only apply for that thread. If the breakpoint should apply for all
+ threads then pass -1. However, if PARSE_EXTRA is non-zero then the
+ THREAD parameter is ignored and an optional thread number will be parsed
+ from EXTRA_STRING.
+
If INTERNAL is non-zero, the breakpoint number will be allocated
from the internal breakpoint count.