diff options
author | Andrew Burgess <aburgess@redhat.com> | 2023-02-08 10:31:14 +0000 |
---|---|---|
committer | Andrew Burgess <aburgess@redhat.com> | 2023-02-12 05:46:44 +0000 |
commit | 2ecee236752932672fb3d6cd63c6976927f747d8 (patch) | |
tree | dfc2d7aea5d7c5497d972cd47b6e5bf0a101917a /gdb/guile | |
parent | 0a9ccb9dd79384f3ba3f8cd75940e8868f3b526f (diff) | |
download | fsf-binutils-gdb-2ecee236752932672fb3d6cd63c6976927f747d8.zip fsf-binutils-gdb-2ecee236752932672fb3d6cd63c6976927f747d8.tar.gz fsf-binutils-gdb-2ecee236752932672fb3d6cd63c6976927f747d8.tar.bz2 |
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>
Diffstat (limited to 'gdb/guile')
-rw-r--r-- | gdb/guile/scm-breakpoint.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/gdb/guile/scm-breakpoint.c b/gdb/guile/scm-breakpoint.c index d4f2b73..2931df2 100644 --- a/gdb/guile/scm-breakpoint.c +++ b/gdb/guile/scm-breakpoint.c @@ -774,7 +774,7 @@ gdbscm_set_breakpoint_thread_x (SCM self, SCM newvalue) _("invalid thread id")); } - if (bp_smob->bp->task != 0) + if (bp_smob->bp->task != -1) scm_misc_error (FUNC_NAME, _("cannot set both task and thread attributes"), SCM_EOL); @@ -797,7 +797,7 @@ gdbscm_breakpoint_task (SCM self) breakpoint_smob *bp_smob = bpscm_get_valid_breakpoint_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME); - if (bp_smob->bp->task == 0) + if (bp_smob->bp->task == -1) return SCM_BOOL_F; return scm_from_long (bp_smob->bp->task); @@ -840,7 +840,7 @@ gdbscm_set_breakpoint_task_x (SCM self, SCM newvalue) SCM_EOL); } else if (gdbscm_is_false (newvalue)) - id = 0; + id = -1; else SCM_ASSERT_TYPE (0, newvalue, SCM_ARG2, FUNC_NAME, _("integer or #f")); |