summaryrefslogtreecommitdiff
path: root/gdb/guile
diff options
context:
space:
mode:
authorAndrew Burgess <aburgess@redhat.com>2023-02-06 13:04:16 +0000
committerAndrew Burgess <aburgess@redhat.com>2023-02-12 05:46:44 +0000
commit0a9ccb9dd79384f3ba3f8cd75940e8868f3b526f (patch)
tree8cad3859bb521f71007902420dca89d2d89cf0be /gdb/guile
parentd088d944a038bf9ea23b8c938efbc8d125924cc6 (diff)
downloadbinutils-gdb-0a9ccb9dd79384f3ba3f8cd75940e8868f3b526f.tar.gz
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/guile')
-rw-r--r--gdb/guile/scm-breakpoint.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/gdb/guile/scm-breakpoint.c b/gdb/guile/scm-breakpoint.c
index a7e043d847b..d4f2b7310bd 100644
--- a/gdb/guile/scm-breakpoint.c
+++ b/gdb/guile/scm-breakpoint.c
@@ -773,6 +773,11 @@ gdbscm_set_breakpoint_thread_x (SCM self, SCM newvalue)
gdbscm_out_of_range_error (FUNC_NAME, SCM_ARG2, newvalue,
_("invalid thread id"));
}
+
+ if (bp_smob->bp->task != 0)
+ scm_misc_error (FUNC_NAME,
+ _("cannot set both task and thread attributes"),
+ SCM_EOL);
}
else if (gdbscm_is_false (newvalue))
id = -1;
@@ -828,6 +833,11 @@ gdbscm_set_breakpoint_task_x (SCM self, SCM newvalue)
gdbscm_out_of_range_error (FUNC_NAME, SCM_ARG2, newvalue,
_("invalid task id"));
}
+
+ if (bp_smob->bp->thread != -1)
+ scm_misc_error (FUNC_NAME,
+ _("cannot set both task and thread attributes"),
+ SCM_EOL);
}
else if (gdbscm_is_false (newvalue))
id = 0;