[01/11] gdb, record: fix assertion when remote target is set to non-stop

Message ID 20260518183316.127043-2-mohamed.bouhaouel@intel.com
State New
Headers
Series Enable non-stop mode by default for remote targets |

Checks

Context Check Description
linaro-tcwg-bot/tcwg_gdb_build--master-arm success Build passed
linaro-tcwg-bot/tcwg_gdb_build--master-aarch64 success Build passed
linaro-tcwg-bot/tcwg_gdb_check--master-arm success Test passed
linaro-tcwg-bot/tcwg_gdb_check--master-aarch64 success Test passed

Commit Message

Bouhaouel, Mohamed May 18, 2026, 6:32 p.m. UTC
  From: Markus Metzger <markus.t.metzger@intel.com>

When forcing the remote target to non-stop via 'maint set target-non-stop
on', reverse tests start failing with

    (gdb) .../gdb/remote.c:7561: internal-error: resume: Assertion `scope_ptid == inferior_ptid' failed.

This is caused by the record-full target doing one additional step after
receiving a single-step trap event.  That additional step is done on the
wait ptid instead of on the event ptid.  Fix it.
---
 gdb/record-full.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
  

Comments

Andrew Burgess June 10, 2026, 3:48 p.m. UTC | #1
Mohamed Bouhaouel <mohamed.bouhaouel@intel.com> writes:

> From: Markus Metzger <markus.t.metzger@intel.com>
>
> When forcing the remote target to non-stop via 'maint set target-non-stop
> on', reverse tests start failing with
>
>     (gdb) .../gdb/remote.c:7561: internal-error: resume: Assertion `scope_ptid == inferior_ptid' failed.
>
> This is caused by the record-full target doing one additional step after
> receiving a single-step trap event.  That additional step is done on the
> wait ptid instead of on the event ptid.  Fix it.
> ---
>  gdb/record-full.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)

I notice there's no new test here.

My guess is that this fixes an issue that will show up in some test once
patch #11 is merged.  Please could you include the details of which test
exposes this issue so it's easy to review this patch.

I've had a look at the next couple of patches and I think this same
feedback applies to them to.  I suspect (but have not checked) this
probably applies to patches #1 to #10.

Thanks,
Andrew

>
> diff --git a/gdb/record-full.c b/gdb/record-full.c
> index 69d2c100e57..fbb45c84931 100644
> --- a/gdb/record-full.c
> +++ b/gdb/record-full.c
> @@ -1290,7 +1290,8 @@ record_full_wait_1 (struct target_ops *ops,
>  				    "Process record: record_full_wait "
>  				    "issuing one more step in the "
>  				    "target beneath\n");
> -		      ops->beneath ()->resume (ptid, step, GDB_SIGNAL_0);
> +		      ops->beneath ()->resume (inferior_ptid, step,
> +					       GDB_SIGNAL_0);
>  		      proc_target->commit_resumed_state = true;
>  		      proc_target->commit_resumed ();
>  		      proc_target->commit_resumed_state = false;
> -- 
> 2.43.0
>
> Intel Deutschland GmbH
> Registered Address: Dornacher Strasse 1, 85622 Feldkirchen, Germany
> Tel: +49 89 991 430, www.intel.de
> Managing Directors: Harry Demas, Jeffrey Schneiderman, Yin Chong Sorrell
> Chairperson of the Supervisory Board: Nicole Lau
> Registered Seat: Munich
> Commercial Register: Amtsgericht Muenchen HRB 186928
  
Bouhaouel, Mohamed June 11, 2026, 3:50 p.m. UTC | #2
Hi Andrew,

Thanks for your feedback!

I submitted a new version addressing your comment.

https://sourceware.org/pipermail/gdb-patches/2026-June/227945.html
https://sourceware.org/pipermail/gdb-patches/2026-June/227955.html

V2 patches are split across two series due to an SMTP authentication failure
that occurred mid-submission.

Regards,
--Mohamed

> -----Original Message-----
> From: Andrew Burgess <aburgess@redhat.com>
> Sent: Wednesday, 10 June 2026 17:49
> To: Bouhaouel, Mohamed <mohamed.bouhaouel@intel.com>; gdb-
> patches@sourceware.org
> Cc: Bouhaouel, Mohamed <mohamed.bouhaouel@intel.com>; Rohr, Stephan
> <stephan.rohr@intel.com>; Metzger, Markus T
> <markus.t.metzger@intel.com>
> Subject: Re: [PATCH 01/11] gdb, record: fix assertion when remote target is
> set to non-stop
> 
> Mohamed Bouhaouel <mohamed.bouhaouel@intel.com> writes:
> 
> > From: Markus Metzger <markus.t.metzger@intel.com>
> >
> > When forcing the remote target to non-stop via 'maint set target-non-stop
> > on', reverse tests start failing with
> >
> >     (gdb) .../gdb/remote.c:7561: internal-error: resume: Assertion `scope_ptid
> == inferior_ptid' failed.
> >
> > This is caused by the record-full target doing one additional step after
> > receiving a single-step trap event.  That additional step is done on the
> > wait ptid instead of on the event ptid.  Fix it.
> > ---
> >  gdb/record-full.c | 3 ++-
> >  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> I notice there's no new test here.
> 
> My guess is that this fixes an issue that will show up in some test once
> patch #11 is merged.  Please could you include the details of which test
> exposes this issue so it's easy to review this patch.
> 
> I've had a look at the next couple of patches and I think this same
> feedback applies to them to.  I suspect (but have not checked) this
> probably applies to patches #1 to #10.
> 
> Thanks,
> Andrew
> 
> >
> > diff --git a/gdb/record-full.c b/gdb/record-full.c
> > index 69d2c100e57..fbb45c84931 100644
> > --- a/gdb/record-full.c
> > +++ b/gdb/record-full.c
> > @@ -1290,7 +1290,8 @@ record_full_wait_1 (struct target_ops *ops,
> >  				    "Process record: record_full_wait "
> >  				    "issuing one more step in the "
> >  				    "target beneath\n");
> > -		      ops->beneath ()->resume (ptid, step, GDB_SIGNAL_0);
> > +		      ops->beneath ()->resume (inferior_ptid, step,
> > +					       GDB_SIGNAL_0);
> >  		      proc_target->commit_resumed_state = true;
> >  		      proc_target->commit_resumed ();
> >  		      proc_target->commit_resumed_state = false;
> > --
> > 2.43.0
> >
> > Intel Deutschland GmbH
> > Registered Address: Dornacher Strasse 1, 85622 Feldkirchen, Germany
> > Tel: +49 89 991 430, www.intel.de
> > Managing Directors: Harry Demas, Jeffrey Schneiderman, Yin Chong Sorrell
> > Chairperson of the Supervisory Board: Nicole Lau
> > Registered Seat: Munich
> > Commercial Register: Amtsgericht Muenchen HRB 186928

Intel Deutschland GmbH

Registered Address: Dornacher Strasse 1, 85622 Feldkirchen, Germany
Tel: +49 89 991 430, www.intel.de
Managing Directors: Harry Demas, Jeffrey Schneiderman, Yin Chong Sorrell
Chairperson of the Supervisory Board: Nicole Lau
Registered Seat: Munich
Commercial Register: Amtsgericht Muenchen HRB 186928
  

Patch

diff --git a/gdb/record-full.c b/gdb/record-full.c
index 69d2c100e57..fbb45c84931 100644
--- a/gdb/record-full.c
+++ b/gdb/record-full.c
@@ -1290,7 +1290,8 @@  record_full_wait_1 (struct target_ops *ops,
 				    "Process record: record_full_wait "
 				    "issuing one more step in the "
 				    "target beneath\n");
-		      ops->beneath ()->resume (ptid, step, GDB_SIGNAL_0);
+		      ops->beneath ()->resume (inferior_ptid, step,
+					       GDB_SIGNAL_0);
 		      proc_target->commit_resumed_state = true;
 		      proc_target->commit_resumed ();
 		      proc_target->commit_resumed_state = false;