Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [PATCH] [gdb/record] Fix syscall recording some more
@ 2026-02-26 14:45 Tom de Vries
  2026-03-03  5:10 ` Abhay Kandpal
  0 siblings, 1 reply; 3+ messages in thread
From: Tom de Vries @ 2026-02-26 14:45 UTC (permalink / raw)
  To: gdb-patches

I ran into the same gdb.reverse/sigall-reverse.exp failure on ppc64le-linux,
as fixed in commits:
- commit 3686645cec9 ("[gdb/record] Fix return value for svc in
  aarch64_record_branch_except_sys"), and
- commit 4ef576bdb7f ("[gdb/record] Fix return value for syscall in
  loongarch_record_syscall_insn").

The difference with those commits is that the problem is not due to confusion
about a port-local enums (aarch64_record_result, loongarch_record_result).

Instead, the port just treats return values 1 and -1 the same:
...
	  if (tdep->ppc_syscall_record (regcache) != 0)
	    return -1;
...

Fix this by passing through the return value 1 instead.

Likewise on s390x-linux.

Tested on ppc64le-linux and s390x-linux.
---
 gdb/rs6000-tdep.c | 5 +++--
 gdb/s390-tdep.c   | 5 +++--
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/gdb/rs6000-tdep.c b/gdb/rs6000-tdep.c
index 8aa155e1f36..7d0902941a0 100644
--- a/gdb/rs6000-tdep.c
+++ b/gdb/rs6000-tdep.c
@@ -7187,8 +7187,9 @@ ppc_process_record (struct gdbarch *gdbarch, struct regcache *regcache,
 
       if (tdep->ppc_syscall_record != NULL)
 	{
-	  if (tdep->ppc_syscall_record (regcache) != 0)
-	    return -1;
+	  int res = tdep->ppc_syscall_record (regcache);
+	  if (res != 0)
+	    return res;
 	}
       else
 	{
diff --git a/gdb/s390-tdep.c b/gdb/s390-tdep.c
index 6cf5acbc542..f52e898047b 100644
--- a/gdb/s390-tdep.c
+++ b/gdb/s390-tdep.c
@@ -3242,8 +3242,9 @@ s390_process_record (struct gdbarch *gdbarch, struct regcache *regcache,
       /* SVC - supervisor call */
       if (tdep->s390_syscall_record != NULL)
 	{
-	  if (tdep->s390_syscall_record (regcache, ibyte[1]))
-	    return -1;
+	  int res = tdep->s390_syscall_record (regcache, ibyte[1]);
+	  if (res != 0)
+	    return res;
 	}
       else
 	{

base-commit: 96cc0a530d58d96a81b1c30247de79812f1d4538
-- 
2.51.0


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] [gdb/record] Fix syscall recording some more
  2026-02-26 14:45 [PATCH] [gdb/record] Fix syscall recording some more Tom de Vries
@ 2026-03-03  5:10 ` Abhay Kandpal
  2026-03-03  8:23   ` Tom de Vries
  0 siblings, 1 reply; 3+ messages in thread
From: Abhay Kandpal @ 2026-03-03  5:10 UTC (permalink / raw)
  To: Tom de Vries, gdb-patches

[-- Attachment #1: Type: text/plain, Size: 2331 bytes --]

Hi Tom,

On 26/02/26 20:15, Tom de Vries wrote:
> I ran into the same gdb.reverse/sigall-reverse.exp failure on ppc64le-linux,
> as fixed in commits:
> - commit 3686645cec9 ("[gdb/record] Fix return value for svc in
>    aarch64_record_branch_except_sys"), and
> - commit 4ef576bdb7f ("[gdb/record] Fix return value for syscall in
>    loongarch_record_syscall_insn").
>
> The difference with those commits is that the problem is not due to confusion
> about a port-local enums (aarch64_record_result, loongarch_record_result).
>
> Instead, the port just treats return values 1 and -1 the same:
> ...
> 	  if (tdep->ppc_syscall_record (regcache) != 0)
> 	    return -1;
> ...
>
> Fix this by passing through the return value 1 instead.
>
> Likewise on s390x-linux.
>
> Tested on ppc64le-linux and s390x-linux.
> ---
>   gdb/rs6000-tdep.c | 5 +++--
>   gdb/s390-tdep.c   | 5 +++--
>   2 files changed, 6 insertions(+), 4 deletions(-)
>
> diff --git a/gdb/rs6000-tdep.c b/gdb/rs6000-tdep.c
> index 8aa155e1f36..7d0902941a0 100644
> --- a/gdb/rs6000-tdep.c
> +++ b/gdb/rs6000-tdep.c
> @@ -7187,8 +7187,9 @@ ppc_process_record (struct gdbarch *gdbarch, struct regcache *regcache,
>   
>         if (tdep->ppc_syscall_record != NULL)
>   	{
> -	  if (tdep->ppc_syscall_record (regcache) != 0)
> -	    return -1;
> +	  int res = tdep->ppc_syscall_record (regcache);
> +	  if (res != 0)
> +	    return res;
>   	}
>         else
>   	{

I ran into the same issue on ppc64le and submitted a similar fix independently.
I’ve tested your patch on Power10 (ppc64le), and it resolves the problem there as well.

Please feel free to add:

Reviewed-by: Abhay Kandpal<abhay@linux.ibm.com>

Thanks for addressing this and for covering s390x as well.

> diff --git a/gdb/s390-tdep.c b/gdb/s390-tdep.c
> index 6cf5acbc542..f52e898047b 100644
> --- a/gdb/s390-tdep.c
> +++ b/gdb/s390-tdep.c
> @@ -3242,8 +3242,9 @@ s390_process_record (struct gdbarch *gdbarch, struct regcache *regcache,
>         /* SVC - supervisor call */
>         if (tdep->s390_syscall_record != NULL)
>   	{
> -	  if (tdep->s390_syscall_record (regcache, ibyte[1]))
> -	    return -1;
> +	  int res = tdep->s390_syscall_record (regcache, ibyte[1]);
> +	  if (res != 0)
> +	    return res;
>   	}
>         else
>   	{
>
> base-commit: 96cc0a530d58d96a81b1c30247de79812f1d4538

[-- Attachment #2: Type: text/html, Size: 2968 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] [gdb/record] Fix syscall recording some more
  2026-03-03  5:10 ` Abhay Kandpal
@ 2026-03-03  8:23   ` Tom de Vries
  0 siblings, 0 replies; 3+ messages in thread
From: Tom de Vries @ 2026-03-03  8:23 UTC (permalink / raw)
  To: Abhay Kandpal, gdb-patches

On 3/3/26 6:10 AM, Abhay Kandpal wrote:
> I ran into the same issue on ppc64le and submitted a similar fix independently.
> I’ve tested your patch on Power10 (ppc64le), and it resolves the problem there as well.
> 
> Please feel free to add:
> 
> Reviewed-by: Abhay Kandpal<abhay@linux.ibm.com>
> 
> Thanks for addressing this and for covering s390x as well.
> 

Hi,

thanks for the review, I've applied the tag and committed.

- Tom

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-03-03  8:24 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-02-26 14:45 [PATCH] [gdb/record] Fix syscall recording some more Tom de Vries
2026-03-03  5:10 ` Abhay Kandpal
2026-03-03  8:23   ` Tom de Vries

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox