[PATCH/i386newframe] Fix x86_64_linux_sigcontext_addr

Mark Kettenis kettenis@chello.nl
Wed May 28 20:51:00 GMT 2003


Amd64 isn't that similar to the i386 :-(.

Thanks to Ludvig for pointing this out.

Mark

Index: ChangeLog
from  Mark Kettenis  <kettenis@gnu.org>

	* x86-64-linux-tdep.c (x86_64_linux_sigcontext_addr): Fix.

Index: x86-64-linux-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/x86-64-linux-tdep.c,v
retrieving revision 1.17.18.1
diff -u -p -r1.17.18.1 x86-64-linux-tdep.c
--- x86-64-linux-tdep.c 17 May 2003 15:09:15 -0000 1.17.18.1
+++ x86-64-linux-tdep.c 28 May 2003 20:49:43 -0000
@@ -107,7 +107,7 @@ x86_64_linux_pc_in_sigtramp (CORE_ADDR p
 static CORE_ADDR
 x86_64_linux_sigcontext_addr (struct frame_info *next_frame)
 {
-  CORE_ADDR sp, ucontext_addr;
+  CORE_ADDR sp;
   char buf[8];
 
   frame_unwind_register (next_frame, SP_REGNUM, buf);
@@ -115,10 +115,11 @@ x86_64_linux_sigcontext_addr (struct fra
 
   /* The sigcontext structure is part of the user context.  A pointer
      to the user context is passed as the third argument to the signal
-     handler.  */
-  read_memory (sp + 16, buf, 8);
-  ucontext_addr = extract_unsigned_integer (buf, 8);
-  return ucontext_addr + X86_64_LINUX_UCONTEXT_SIGCONTEXT_OFFSET;
+     handler, i.e. in %rdx.  Unfortunately %rdx isn't preserved across
+     function calls so we can't use it.  Fortunately the user context
+     is part of the signal frame and the unwound %rsp directly points
+     at it.  */
+  return sp + X86_64_LINUX_UCONTEXT_SIGCONTEXT_OFFSET;
 }
 
 



More information about the Gdb-patches mailing list