public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Andrew Burgess <aburgess@redhat.com>
To: Pedro Alves <pedro@palves.net>, gdb-patches@sourceware.org
Subject: Re: [PATCH 2/2] gdb: use -1 for breakpoint::task default value
Date: Sun, 12 Feb 2023 07:23:20 +0000	[thread overview]
Message-ID: <87357buz2v.fsf@redhat.com> (raw)
In-Reply-To: <0aec159e-085d-5e4b-636f-c46c287d2ddb@palves.net>

Pedro Alves <pedro@palves.net> writes:

> On 2023-02-08 3:16 p.m., Andrew Burgess via Gdb-patches wrote:
>> 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.
>
> This bothered me before as well.  Thanks for doing this.
>
> Approved-By: Pedro Alves <pedro@palves.net>

I pushed this.  Then realised I'd forgotten to update it to take account
of another patch that added a new comparison to 0, so I then pushed the
patch below as a fix.

Sorry for the temporary breakage.

Thanks,
Andrew

---

commit 8282ad74c302a8e0db7a588e500ae117a1df68c5
Author: Andrew Burgess <aburgess@redhat.com>
Date:   Sun Feb 12 07:14:31 2023 +0000

    gdb: fix describe_other_breakpoints for default task being -1
    
    Commit:
    
      commit 2ecee236752932672fb3d6cd63c6976927f747d8
      CommitDate: Sun Feb 12 05:46:44 2023 +0000
    
          gdb: use -1 for breakpoint::task default value
    
    Failed to take account of an earlier commit:
    
      commit f1f517e81039f6aa673b7d87a66bfbd25a66e3d3
      CommitDate: Sat Feb 11 17:36:24 2023 +0000
    
          gdb: show task number in describe_other_breakpoints
    
    That both of these are my own commits is only more embarrassing.
    
    This small fix updates describe_other_breakpoints to take account of
    the default task number now being -1.  This fixes regressions in
    gdb.base/break.exp, gdb.base/break-always.exp, and many other tests.

diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
index 4b0a909d60c..97dee5cd0fe 100644
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -7057,7 +7057,7 @@ describe_other_breakpoints (struct gdbarch *gdbarch,
 		struct thread_info *thr = find_thread_global_id (b->thread);
 		gdb_printf (" (thread %s)", print_thread_id (thr));
 	      }
-	    else if (b->task != 0)
+	    else if (b->task != -1)
 	      gdb_printf (" (task %d)", b->task);
 	    gdb_printf ("%s%s ",
 			((b->enable_state == bp_disabled


      reply	other threads:[~2023-02-12  7:23 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-08 15:16 [PATCH 0/2] Prevent combining 'task' and 'thread' keywords Andrew Burgess
2023-02-08 15:16 ` [PATCH 1/2] gdb: only allow one of thread or task on breakpoints or watchpoints Andrew Burgess
2023-02-08 15:52   ` Eli Zaretskii
2023-02-08 18:10   ` Pedro Alves
2023-02-12  5:50     ` Andrew Burgess
2023-02-12 22:58       ` Tom Tromey
2023-02-13 11:26         ` Andrew Burgess
2023-02-08 15:16 ` [PATCH 2/2] gdb: use -1 for breakpoint::task default value Andrew Burgess
2023-02-08 18:10   ` Pedro Alves
2023-02-12  7:23     ` Andrew Burgess [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87357buz2v.fsf@redhat.com \
    --to=aburgess@redhat.com \
    --cc=gdb-patches@sourceware.org \
    --cc=pedro@palves.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).