Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/external/gpl3/gdb/dist/gdb - Don't use the unwind register g...



details:   https://anonhg.NetBSD.org/src/rev/eedf0c6ece73
branches:  trunk
changeset: 770232:eedf0c6ece73
user:      christos <christos%NetBSD.org@localhost>
date:      Sat Oct 08 21:47:52 2011 +0000

description:
- Don't use the unwind register get functions; you end up in an assertion
trying to unwind while unwinding; plus the sniffer is not allowed to unwind.
- Return the outer frame to terminate not the null frame.
This fixes the kernel track unwinder, so enable it.

diffstat:

 external/gpl3/gdb/dist/gdb/amd64nbsd-tdep.c |  22 ++++++++++------------
 external/gpl3/gdb/dist/gdb/i386nbsd-tdep.c  |  26 +++++++++++++-------------
 2 files changed, 23 insertions(+), 25 deletions(-)

diffs (171 lines):

diff -r 27cc6cfa46df -r eedf0c6ece73 external/gpl3/gdb/dist/gdb/amd64nbsd-tdep.c
--- a/external/gpl3/gdb/dist/gdb/amd64nbsd-tdep.c       Sat Oct 08 21:43:35 2011 +0000
+++ b/external/gpl3/gdb/dist/gdb/amd64nbsd-tdep.c       Sat Oct 08 21:47:52 2011 +0000
@@ -129,7 +129,7 @@
 };
 
 static struct trad_frame_cache *
-amd64nbsd_trapframe_cache(struct frame_info *next_frame, void **this_cache)
+amd64nbsd_trapframe_cache(struct frame_info *this_frame, void **this_cache)
 {
   struct trad_frame_cache *cache;
   CORE_ADDR func, sp, addr;
@@ -141,11 +141,11 @@
   if (*this_cache)
     return *this_cache;
 
-  cache = trad_frame_cache_zalloc (next_frame);
+  cache = trad_frame_cache_zalloc (this_frame);
   *this_cache = cache;
 
-  func = get_frame_func (next_frame);
-  sp = frame_unwind_register_unsigned (next_frame, AMD64_RSP_REGNUM);
+  func = get_frame_func (this_frame);
+  sp = get_frame_register_unsigned (this_frame, AMD64_RSP_REGNUM);
 
   find_pc_partial_function (func, &name, NULL, NULL);
 
@@ -196,7 +196,7 @@
   if ((cs & I386_SEL_RPL) == I386_SEL_UPL)
     {
       /* Trap from user space; terminate backtrace.  */
-      trad_frame_set_id (cache, null_frame_id);
+      trad_frame_set_id (cache, outer_frame_id);
     }
   else
     {
@@ -208,12 +208,12 @@
 }
 
 static void
-amd64nbsd_trapframe_this_id (struct frame_info *next_frame,
+amd64nbsd_trapframe_this_id (struct frame_info *this_frame,
                             void **this_cache,
                             struct frame_id *this_id)
 {
   struct trad_frame_cache *cache =
-    amd64nbsd_trapframe_cache (next_frame, this_cache);
+    amd64nbsd_trapframe_cache (this_frame, this_cache);
   
   trad_frame_get_id (cache, this_id);
 }
@@ -230,7 +230,7 @@
 
 static int
 amd64nbsd_trapframe_sniffer (const struct frame_unwind *self,
-                            struct frame_info *next_frame,
+                            struct frame_info *this_frame,
                             void **this_prologue_cache)
 {
   ULONGEST cs;
@@ -238,11 +238,11 @@
 
   /* Check Current Privilege Level and bail out if we're not executing
      in kernel space.  */
-  cs = frame_unwind_register_unsigned (next_frame, AMD64_CS_REGNUM);
+  cs = get_frame_register_unsigned (this_frame, AMD64_CS_REGNUM);
   if ((cs & I386_SEL_RPL) == I386_SEL_UPL)
     return 0;
 
-  find_pc_partial_function (get_frame_pc (next_frame), &name, NULL, NULL);
+  find_pc_partial_function (get_frame_pc (this_frame), &name, NULL, NULL);
   return (name && ((strcmp (name, "alltraps") == 0)
                   || (strcmp (name, "calltrap") == 0)
                   || (strncmp (name, "Xtrap", 5) == 0)
@@ -291,10 +291,8 @@
   /* NetBSD uses SVR4-style shared libraries.  */
   set_solib_svr4_fetch_link_map_offsets
     (gdbarch, svr4_lp64_fetch_link_map_offsets);
-#ifdef notyet
   /* Unwind kernel trap frames correctly.  */
   frame_unwind_prepend_unwinder (gdbarch, &amd64nbsd_trapframe_unwind);
-#endif
 }
 
 
diff -r 27cc6cfa46df -r eedf0c6ece73 external/gpl3/gdb/dist/gdb/i386nbsd-tdep.c
--- a/external/gpl3/gdb/dist/gdb/i386nbsd-tdep.c        Sat Oct 08 21:43:35 2011 +0000
+++ b/external/gpl3/gdb/dist/gdb/i386nbsd-tdep.c        Sat Oct 08 21:47:52 2011 +0000
@@ -297,7 +297,7 @@
 };
  
 static struct trad_frame_cache *
-i386nbsd_trapframe_cache(struct frame_info *next_frame, void **this_cache)
+i386nbsd_trapframe_cache(struct frame_info *this_frame, void **this_cache)
 {
   struct trad_frame_cache *cache;
   CORE_ADDR func, sp, addr, tmp;
@@ -309,11 +309,11 @@
   if (*this_cache)
     return *this_cache;
 
-  cache = trad_frame_cache_zalloc (next_frame);
+  cache = trad_frame_cache_zalloc (this_frame);
   *this_cache = cache;
 
-  func = get_frame_func (next_frame);
-  sp = frame_unwind_register_unsigned (next_frame, I386_ESP_REGNUM);
+  func = get_frame_func (this_frame);
+  sp = get_frame_register_unsigned (this_frame, I386_ESP_REGNUM);
 
   find_pc_partial_function (func, &name, NULL, NULL);
   if (name && strncmp (name, "Xintr", 5) == 0)
@@ -347,7 +347,7 @@
   if ((cs & I386_SEL_RPL) == I386_SEL_UPL)
     {
       /* Trap from user space; terminate backtrace.  */
-      trad_frame_set_id (cache, null_frame_id);
+      trad_frame_set_id (cache, outer_frame_id);
     }
   else
     {
@@ -359,28 +359,28 @@
 }
 
 static void
-i386nbsd_trapframe_this_id (struct frame_info *next_frame,
+i386nbsd_trapframe_this_id (struct frame_info *this_frame,
                            void **this_cache, struct frame_id *this_id)
 {
   struct trad_frame_cache *cache =
-    i386nbsd_trapframe_cache (next_frame, this_cache);
+    i386nbsd_trapframe_cache (this_frame, this_cache);
   
   trad_frame_get_id (cache, this_id);
 }
 
 static struct value *
-i386nbsd_trapframe_prev_register (struct frame_info *next_frame,
+i386nbsd_trapframe_prev_register (struct frame_info *this_frame,
                                  void **this_cache, int regnum)
 {
   struct trad_frame_cache *cache =
-    i386nbsd_trapframe_cache (next_frame, this_cache);
+    i386nbsd_trapframe_cache (this_frame, this_cache);
 
-  return trad_frame_get_register (cache, next_frame, regnum);
+  return trad_frame_get_register (cache, this_frame, regnum);
 }
 
 static int
 i386nbsd_trapframe_sniffer (const struct frame_unwind *self,
-                           struct frame_info *next_frame,
+                           struct frame_info *this_frame,
                            void **this_prologue_cache)
 {
   ULONGEST cs;
@@ -388,12 +388,12 @@
 
   /* Check Current Privilege Level and bail out if we're not executing
      in kernel space.  */
-  cs = frame_unwind_register_unsigned (next_frame, I386_CS_REGNUM);
+  cs = get_frame_register_unsigned (this_frame, I386_CS_REGNUM);
   if ((cs & I386_SEL_RPL) == I386_SEL_UPL)
     return 0;
 
 
-  find_pc_partial_function (get_frame_pc (next_frame), &name, NULL, NULL);
+  find_pc_partial_function (get_frame_pc (this_frame), &name, NULL, NULL);
   return (name && ((strcmp (name, "alltraps") == 0)
                   || (strcmp (name, "calltrap") == 0)
                   || (strncmp (name, "Xtrap", 5) == 0)



Home | Main Index | Thread Index | Old Index