gdb: use -1 for breakpoint::task default value

Within the breakpoint struct we have two fields ::thread and ::task
which are used for thread or task specific breakpoints.  When a
breakpoint doesn't have a specific thread or task then these fields
have the values -1 and 0 respectively.

There's no particular reason (as far as I can tell) why these two
"default" values are different, and I find the difference a little
confusing.  Long term I'd like to potentially fold these two fields
into a single field, but that isn't what this commit does.

What this commit does is switch to using -1 as the "default" value for
both fields, this means that the default for breakpoint::task has
changed from 0 to -1.   I've updated all the code I can find that
relied on the value of 0, and I see no test regressions, especially in
gdb.ada/tasks.exp, which still fully passes.

There should be no user visible changes after this commit.

Approved-By: Pedro Alves <pedro@palves.net>
This commit is contained in:
Andrew Burgess 2023-02-08 10:31:14 +00:00
parent 0a9ccb9dd7
commit 2ecee23675
4 changed files with 29 additions and 29 deletions

View file

@ -271,7 +271,7 @@ bppy_set_thread (PyObject *self, PyObject *newvalue, void *closure)
return -1;
}
if (self_bp->bp->task != 0)
if (self_bp->bp->task != -1)
{
PyErr_SetString (PyExc_RuntimeError,
_("Cannot set both task and thread attributes."));
@ -337,7 +337,7 @@ bppy_set_task (PyObject *self, PyObject *newvalue, void *closure)
}
}
else if (newvalue == Py_None)
id = 0;
id = -1;
else
{
PyErr_SetString (PyExc_TypeError,
@ -711,7 +711,7 @@ bppy_get_task (PyObject *self, void *closure)
BPPY_REQUIRE_VALID (self_bp);
if (self_bp->bp->task == 0)
if (self_bp->bp->task == -1)
Py_RETURN_NONE;
return gdb_py_object_from_longest (self_bp->bp->task).release ();