[Bug gdb/28623] Missing catching return of execve syscall of PowerPC

vries at gcc dot gnu.org sourceware-bugzilla@sourceware.org
Thu Nov 16 11:48:22 GMT 2023


https://sourceware.org/bugzilla/show_bug.cgi?id=28623

--- Comment #3 from Tom de Vries <vries at gcc dot gnu.org> ---
Tentative patch implementing lr == 0 approach:
...
diff --git a/gdb/ppc-linux-tdep.c b/gdb/ppc-linux-tdep.c
index 0c676a8..057ae04 100644
--- a/gdb/ppc-linux-tdep.c
+++ b/gdb/ppc-linux-tdep.c
@@ -1355,7 +1355,19 @@
      is stored at 0th register.  */
   regcache->cooked_read (tdep->ppc_gp0_regnum, buf.data ());

-  return extract_signed_integer (buf.data (), tdep->wordsize, byte_order);
+  LONGEST res = extract_signed_integer (buf.data (), tdep->wordsize,
byte_order);
+
+  if (res == 0)
+    {
+      regcache->cooked_read (tdep->ppc_lr_regnum, buf.data ());
+
+      if (extract_signed_integer (buf.data (), tdep->wordsize, byte_order) ==
0)
+       return 11;
+
+      return -1;
+    }
+
+  return res;
 }

 /* PPC process record-replay */
...

-- 
You are receiving this mail because:
You are on the CC list for the bug.


More information about the Gdb-prs mailing list