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>
This commit is contained in:
parent
d088d944a0
commit
0a9ccb9dd7
6 changed files with 153 additions and 5 deletions
|
@ -270,6 +270,13 @@ bppy_set_thread (PyObject *self, PyObject *newvalue, void *closure)
|
|||
_("Invalid thread ID."));
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (self_bp->bp->task != 0)
|
||||
{
|
||||
PyErr_SetString (PyExc_RuntimeError,
|
||||
_("Cannot set both task and thread attributes."));
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
else if (newvalue == Py_None)
|
||||
id = -1;
|
||||
|
@ -321,6 +328,13 @@ bppy_set_task (PyObject *self, PyObject *newvalue, void *closure)
|
|||
_("Invalid task ID."));
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (self_bp->bp->thread != -1)
|
||||
{
|
||||
PyErr_SetString (PyExc_RuntimeError,
|
||||
_("Cannot set both task and thread attributes."));
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
else if (newvalue == Py_None)
|
||||
id = 0;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue