This is the mail archive of the gdb-cvs@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[binutils-gdb] Fix infinite recursion in amd64fbsd_sigcontext_addr


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=c5cb74eeb3ea13a9fbeb0ec26b5bad10c4b92e4a

commit c5cb74eeb3ea13a9fbeb0ec26b5bad10c4b92e4a
Author: John Baldwin <jhb@freebsd.org>
Date:   Thu Feb 26 11:07:57 2015 +0000

    Fix infinite recursion in amd64fbsd_sigcontext_addr
    
    amd64fbsd_sigcontext_addr is using frame_unwind_register_unsigned to
    fetch the stack pointer which results in infinite recursion.  This
    patch changes it to use get_frame_register to match the
    sigcontext_addr methods in the i386-bsd and amd64-linux targets
    instead.
    
    gdb/ChangeLog:
    2015-02-25  John Baldwin  <jhb@freebsd.org>
    
    	* amd64fbsd-tdep.c (amd64fbsd_sigcontext_addr): Use
    	get_frame_register instead of frame_unwind_register_unsigned.

Diff:
---
 gdb/ChangeLog        | 5 +++++
 gdb/amd64fbsd-tdep.c | 6 +++++-
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 1aa6fc1..b024d23 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,8 @@
+2015-02-25  John Baldwin  <jhb@freebsd.org>
+
+	* amd64fbsd-tdep.c (amd64fbsd_sigcontext_addr): Use
+	get_frame_register instead of frame_unwind_register_unsigned.
+
 2015-02-26  Jan Kratochvil  <jan.kratochvil@redhat.com>
 
 	PR build/18033
diff --git a/gdb/amd64fbsd-tdep.c b/gdb/amd64fbsd-tdep.c
index 2d49cdf..abb0cab 100644
--- a/gdb/amd64fbsd-tdep.c
+++ b/gdb/amd64fbsd-tdep.c
@@ -37,12 +37,16 @@
 static CORE_ADDR
 amd64fbsd_sigcontext_addr (struct frame_info *this_frame)
 {
+  struct gdbarch *gdbarch = get_frame_arch (this_frame);
+  enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
   CORE_ADDR sp;
+  gdb_byte buf[8];
 
   /* The `struct sigcontext' (which really is an `ucontext_t' on
      FreeBSD/amd64) lives at a fixed offset in the signal frame.  See
      <machine/sigframe.h>.  */
-  sp = frame_unwind_register_unsigned (this_frame, AMD64_RSP_REGNUM);
+  get_frame_register (this_frame, AMD64_RSP_REGNUM, buf);
+  sp = extract_unsigned_integer (buf, 8, byte_order);
   return sp + 16;
 }


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]