diff options
author | Andrew Burgess <aburgess@redhat.com> | 2023-02-06 13:04:16 +0000 |
---|---|---|
committer | Andrew Burgess <aburgess@redhat.com> | 2023-02-12 05:46:44 +0000 |
commit | 0a9ccb9dd79384f3ba3f8cd75940e8868f3b526f (patch) | |
tree | 8cad3859bb521f71007902420dca89d2d89cf0be /gdb/breakpoint.h | |
parent | d088d944a038bf9ea23b8c938efbc8d125924cc6 (diff) | |
download | gdb-0a9ccb9dd79384f3ba3f8cd75940e8868f3b526f.zip gdb-0a9ccb9dd79384f3ba3f8cd75940e8868f3b526f.tar.gz gdb-0a9ccb9dd79384f3ba3f8cd75940e8868f3b526f.tar.bz2 |
gdb: only allow one of thread or task on breakpoints or watchpoints
After this mailing list posting:
https://sourceware.org/pipermail/gdb-patches/2023-February/196607.html
it seems to me that in practice an Ada task maps 1:1 with a GDB
thread, and so it doesn't really make sense to allow uses to give both
a thread and a task within a single breakpoint or watchpoint
condition.
This commit updates GDB so that the user will get an error if both
are specified.
I've added new tests to cover the CLI as well as the Python and Guile
APIs. For the Python and Guile testing, as far as I can tell, this
was the first testing for this corner of the APIs, so I ended up
adding more than just a single test.
For documentation I've added a NEWS entry, but I've not added anything
to the docs themselves. Currently we document the commands with a
thread-id or task-id as distinct command, e.g.:
'break LOCSPEC task TASKNO'
'break LOCSPEC task TASKNO if ...'
'break LOCSPEC thread THREAD-ID'
'break LOCSPEC thread THREAD-ID if ...'
As such, I don't believe there is any indication that combining 'task'
and 'thread' would be expected to work; it seems clear to me in the
above that those four options are all distinct commands.
I think the NEWS entry is enough that if someone is combining these
keywords (it's not clear what the expected behaviour would be in this
case) then they can figure out that this was a deliberate change in
GDB, but for a new user, the manual doesn't suggest combining them is
OK, and any future attempt to combine them will give an error.
Approved-By: Pedro Alves <pedro@palves.net>
Diffstat (limited to 'gdb/breakpoint.h')
-rw-r--r-- | gdb/breakpoint.h | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/gdb/breakpoint.h b/gdb/breakpoint.h index 352e846..5228c38 100644 --- a/gdb/breakpoint.h +++ b/gdb/breakpoint.h @@ -1673,8 +1673,18 @@ extern void breakpoint_set_commands (struct breakpoint *b, extern void breakpoint_set_silent (struct breakpoint *b, int silent); +/* Set the thread for this breakpoint. If THREAD is -1, make the + breakpoint work for any thread. Passing a value other than -1 for + THREAD should only be done if b->task is 0; it is not valid to try and + set both a thread and task restriction on a breakpoint. */ + extern void breakpoint_set_thread (struct breakpoint *b, int thread); +/* Set the task for this breakpoint. If TASK is 0, make the breakpoint + work for any task. Passing a value other than 0 for TASK should only be + done if b->thread is -1; it is not valid to try and set both a thread + and task restriction on a breakpoint. */ + extern void breakpoint_set_task (struct breakpoint *b, int task); /* Clear the "inserted" flag in all breakpoints. */ |