From: Jerry Zhang Jian <jerry.zhangjian@sifive.com>
To: Tom Tromey <tom@tromey.com>
Cc: Andrew Burgess <aburgess@redhat.com>,
gdb-patches@sourceware.org, kito.cheng@sifive.com
Subject: Re: [PATCH] gdb: invalidate register cache after monitor commands
Date: Mon, 17 Aug 2026 11:28:48 +0800 [thread overview]
Message-ID: <CAE5PzYKdOCHG3DYJ9HSTSU+9kq4fd6ZQ_Affn88jisD7mwed_g@mail.gmail.com> (raw)
In-Reply-To: <87wltvulg7.fsf@tromey.com>
[-- Attachment #1: Type: text/plain, Size: 2205 bytes --]
Hi Andrew and Tom,
Thanks for the review and for raising the interaction with the related
remote-packet change.
Andrew, you are right that the examples in the commit message were too
broad. The concrete case behind this change is monitor reset halt: after
GDB has cached a pre-reset PC, the target is reset and halted, but an
immediate read of $pc can still return the old pre-reset value. A
subsequent step or continue causes GDB to refetch the register and reveals
the reset-vector PC, showing that the target reset succeeded and only GDB's
register cache was stale.
I will simplify the commit message in v2 to focus on this reset case and
explain that the cache invalidation is needed because an opaque monitor
command can change target state without GDB receiving a protocol-level
notification.
Tom, I checked the interaction with the related remote-packet change. This
patch invalidates the register cache only after the CLI monitor command
completes, so it does not run in the middle of an unrelated packet send or
unwinding operation. Based on the current call paths, I do not think the
two patches directly conflict, but I will make this scope explicit in v2
and double-check whether monitor packets sent through other paths need
separate handling.
I will also make the other requested cleanup changes:
remove the Signed-off-by line;
split the assignment out of the if and explicitly check proc_target !=
nullptr.
Thanks,
Jerry
Tom Tromey <tom@tromey.com> 於 2026年8月13日週四 上午4:34寫道:
> >>>>> "Andrew" == Andrew Burgess <aburgess@redhat.com> writes:
>
> Andrew> I don't find any of these example particularly clear. They all
> kind of
> Andrew> hint towards a problem, but it would be nice to have at least one
> fully
> Andrew> explained case.
>
> I wonder also if this conceptually conflicts with your patch "avoid
> switching threads for send_packet where possible". In that patch, you
> mention an unwinder sending a remote packet during unwinding. If that
> packet happens to be a 'monitor' command, then presumably something bad
> will happen due to flushing the register cache while unwinding.
>
> Tom
>
>
[-- Attachment #2: Type: text/html, Size: 2666 bytes --]
next prev parent reply other threads:[~2026-08-17 3:29 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-11 3:52 Jerry Zhang Jian
2026-08-11 8:57 ` Andrew Burgess
2026-08-12 20:34 ` Tom Tromey
2026-08-17 3:28 ` Jerry Zhang Jian [this message]
2026-08-21 16:44 ` Tom Tromey
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=CAE5PzYKdOCHG3DYJ9HSTSU+9kq4fd6ZQ_Affn88jisD7mwed_g@mail.gmail.com \
--to=jerry.zhangjian@sifive.com \
--cc=aburgess@redhat.com \
--cc=gdb-patches@sourceware.org \
--cc=kito.cheng@sifive.com \
--cc=tom@tromey.com \
/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