public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Pedro Alves <pedro@palves.net>
To: Andrew Burgess <aburgess@redhat.com>, gdb-patches@sourceware.org
Subject: Re: [PATCH 8/8] gdb: fix mi breakpoint-deleted notifications for thread-specific b/p
Date: Wed, 22 Feb 2023 15:20:56 +0000	[thread overview]
Message-ID: <927d43eb-eb59-7512-4924-cd6bde2685fd@palves.net> (raw)
In-Reply-To: <4737168144b9f25ca181b669f3b5f1b6e7e53b14.1676901929.git.aburgess@redhat.com>

Hi!

On 2023-02-20 2:13 p.m., Andrew Burgess via Gdb-patches wrote:

> My proposed solution is this; in remove_threaded_breakpoints, instead
> of setting the disposition to disp_del_at_next_stop and setting the
> number to zero, we now just call delete_breakpoint directly.
> 
> The notification will now be sent out immediately; as soon as the
> thread exits.
> 
> As the number has not changed when delete_breakpoint is called, the
> notification will have the correct number.
> 
> And as the breakpoint is immediately removed from the breakpoint list,
> we no longer need to worry about 'maint info breakpoints' trying to
> print the thread-id for an exited thread.
> 
> My only concern is that calling delete_breakpoint directly seems so
> obvious that I wonder why the original patch (that added
> remove_threaded_breakpoints) didn't take this approach.  This code was
> added in commit 49fa26b0411d, but the commit message offers no clues
> to why this approach was taken, and the original email thread offers
> no insights either[2].  There are no test regressions after making
> this change, so I'm hopeful that this is going to be fine.
> 
> [2] https://sourceware.org/pipermail/gdb-patches/2013-September/106493.html

I can't be absolutely sure there weren't other reasons, but I think that was because back
then we couldn't access inferior memory if the current thread was running or had exited, when
native debugging on GNU/Linux.  One of the original versions of the step-over-thread-exit
series had that problem as well, which was what lead to changing gdb to always access
memory via /proc/pid/mem instead of ptrace, eliminating that class of problems.

> 
> The Complication
> ----------------
> 
> Of course, it couldn't be that simple.

It never is.  :-)

> +	    # The output has arrived!  Check how we did.  There are other bugs
> +	    # that come into play here which change which output we'll see.
> +	    if {$mode eq "separate" && !$is_remote} {
> +		gdb_assert { $saw_mi_thread_exited && $saw_mi_bp_deleted \
> +			     && !$saw_cli_thread_exited \
> +			     && !$saw_cli_bp_deleted } \
> +		    $gdb_test_name
> +	    } else {
> +		if { $saw_mi_thread_exited && $saw_mi_bp_deleted \
> +			     && $saw_cli_thread_exited \
> +			     && $saw_cli_bp_deleted } {
> +		    kpass "gdb/30129" $gdb_test_name
> +		} elseif { $saw_mi_thread_exited && $saw_mi_bp_deleted \
> +			     && !$saw_cli_thread_exited \
> +			     && $saw_cli_bp_deleted } {
> +		    kfail "gdb/30129" $gdb_test_name
> +		} else {
> +		    fail "$gdb_test_name (XXX)"

I guess you meant to remove the XX or replace it with something else?


Otherwise LGTM.

Approved-By: Pedro Alves <pedro@palves.net>

  reply	other threads:[~2023-02-22 15:20 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-20 14:13 [PATCH 0/8] Fix missing MI =breakpoint-deleted notifications Andrew Burgess
2023-02-20 14:13 ` [PATCH 1/8] gdb: remove an out of date comment about disp_del_at_next_stop Andrew Burgess
2023-02-20 14:13 ` [PATCH 2/8] gdb: don't duplicate 'thread' field in MI breakpoint output Andrew Burgess
2023-02-20 14:47   ` Eli Zaretskii
2023-02-22 15:18   ` Pedro Alves
2023-02-20 14:13 ` [PATCH 3/8] gdb/testsuite: make more use of mi-support.exp Andrew Burgess
2023-02-20 14:13 ` [PATCH 4/8] gdb/testsuite: extend the use of mi_clean_restart Andrew Burgess
2023-02-20 14:13 ` [PATCH 5/8] gdb/testsuite introduce foreach_mi_ui_mode helper proc Andrew Burgess
2023-02-22 15:18   ` Pedro Alves
2023-02-20 14:13 ` [PATCH 6/8] gdb/testsuite: introduce is_target_non_stop " Andrew Burgess
2023-02-22 15:19   ` Pedro Alves
2023-02-27 14:58     ` Andrew Burgess
2023-02-27 16:18       ` Pedro Alves
2023-02-20 14:13 ` [PATCH 7/8] gdb/testsuite: fix failure in gdb.mi/mi-pending.exp with extended-remote Andrew Burgess
2023-02-22 15:19   ` Pedro Alves
2023-02-20 14:13 ` [PATCH 8/8] gdb: fix mi breakpoint-deleted notifications for thread-specific b/p Andrew Burgess
2023-02-22 15:20   ` Pedro Alves [this message]
2023-02-22 15:23 ` [PATCH 0/8] Fix missing MI =breakpoint-deleted notifications Pedro Alves
2023-02-28 11:09   ` Andrew Burgess

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=927d43eb-eb59-7512-4924-cd6bde2685fd@palves.net \
    --to=pedro@palves.net \
    --cc=aburgess@redhat.com \
    --cc=gdb-patches@sourceware.org \
    /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).