Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [RFC/i385newframe] Fix sigtramp unwinder.
@ 2003-05-28 14:39 Michal Ludvig
  2003-05-28 20:57 ` Mark Kettenis
  0 siblings, 1 reply; 2+ messages in thread
From: Michal Ludvig @ 2003-05-28 14:39 UTC (permalink / raw)
  To: Mark Kettenis; +Cc: GDB Patches

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

Hi,
this patch fixes x86_64_linux_sigcontext_addr() which returned wrong 
address, and consequently enables unwinding from signal handlers.
Detailed explanation of this change is in the comment in the patch.
OK to apply?

Michal Ludvig
-- 
* SuSE CR, s.r.o     * mludvig@suse.cz
* (+420) 296.545.373 * http://www.suse.cz

[-- Attachment #2: unwind-sigctx-1.diff --]
[-- Type: text/plain, Size: 1806 bytes --]

2003-05-28  Michal Ludvig  <mludvig@suse.cz>

	* x86-64-linux-tdep.c (x86_64_linux_sigcontext_addr):
	Correctly determine sigcontext address.

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 -c -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 14:32:12 -0000
*************** x86_64_linux_sigcontext_addr (struct fra
*** 110,124 ****
    CORE_ADDR sp, ucontext_addr;
    char buf[8];
  
    frame_unwind_register (next_frame, SP_REGNUM, buf);
    sp = extract_unsigned_integer (buf, 8);
  
!   /* 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;
  }
  \f
  
--- 110,126 ----
    CORE_ADDR sp, ucontext_addr;
    char buf[8];
  
+   /* 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, i.e. in register RDX. Unfortunately RDX isn't a callee 
+      saved register and so it's unwound value isn't reliable. 
+      Fortunately struct ucontext is right above the return address from 
+      the signal handler, i.e. also unwound RSP points to the user context 
+      and we can use it instead of RDX.  */
    frame_unwind_register (next_frame, SP_REGNUM, buf);
    sp = extract_unsigned_integer (buf, 8);
  
!   return sp + X86_64_LINUX_UCONTEXT_SIGCONTEXT_OFFSET;
  }
  \f
  

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

* Re: [RFC/i385newframe] Fix sigtramp unwinder.
  2003-05-28 14:39 [RFC/i385newframe] Fix sigtramp unwinder Michal Ludvig
@ 2003-05-28 20:57 ` Mark Kettenis
  0 siblings, 0 replies; 2+ messages in thread
From: Mark Kettenis @ 2003-05-28 20:57 UTC (permalink / raw)
  To: mludvig; +Cc: gdb-patches

   Date: Wed, 28 May 2003 16:39:23 +0200
   From: Michal Ludvig <mludvig@suse.cz>

   Hi,
   this patch fixes x86_64_linux_sigcontext_addr() which returned wrong 
   address, and consequently enables unwinding from signal handlers.
   Detailed explanation of this change is in the comment in the patch.
   OK to apply?

Oops.  Of course...  There was a slight problem...  You left an unused
variable.  I fixed it and checked it in.

Thanks!

Mark


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

end of thread, other threads:[~2003-05-28 20:57 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-05-28 14:39 [RFC/i385newframe] Fix sigtramp unwinder Michal Ludvig
2003-05-28 20:57 ` Mark Kettenis

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