2003-05-28 Michal Ludvig * 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; } --- 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; }