[PATCH] [SH] PLT slots

Thomas Schwinge thomas@codesourcery.com
Fri Feb 24 19:47:00 GMT 2012


Hi!

This patch fixes the following class of errors:

    Breakpoint 1, main () at /scratch/tschwing/ST_sh-linux-gnu-lite/src/gdb-trunk/gdb/testsuite/gdb.base/callfuncs.c:508
    508       malloc(1);
    (gdb) info source
    [...]
    (gdb) next
    malloc@plt ()
    (gdb) FAIL: gdb.base/callfuncs.exp: next to t_double_values
    next
    Single stepping until exit from function malloc@plt,
    which has no line number information.
    ?? ()
    (gdb) FAIL: gdb.base/callfuncs.exp: next to t_structs_c

Testing for sh-unknown-linux-gnu for sh4a, there are no regressions, and
the following turn into PASSes:

    FAIL: gdb.base/break.exp: step over breakpoint
    FAIL: gdb.base/break.exp: clear current line has no breakpoint disallowed
    FAIL: gdb.base/callfuncs.exp: next to t_double_values
    FAIL: gdb.base/callfuncs.exp: next to t_structs_c
    FAIL: gdb.base/callfuncs.exp: next to t_double_values
    FAIL: gdb.base/callfuncs.exp: next to t_structs_c
    FAIL: gdb.base/callfuncs.exp: bt after continuing from call dummy breakpoint
    FAIL: gdb.base/callfuncs.exp: next to t_double_values
    FAIL: gdb.base/callfuncs.exp: next to t_structs_c
    FAIL: gdb.base/callfuncs.exp: bt after finishing from call dummy breakpoint
    FAIL: gdb.base/callfuncs.exp: next to t_double_values
    FAIL: gdb.base/callfuncs.exp: next to t_structs_c
    FAIL: gdb.base/callfuncs.exp: back at main after return from call dummy breakpoint
    FAIL: gdb.base/callfuncs.exp: next to t_double_values
    FAIL: gdb.base/callfuncs.exp: next to t_structs_c
    FAIL: gdb.base/callfuncs.exp: backtrace at nested call level 1
    FAIL: gdb.base/callfuncs.exp: backtrace at nested call level 2
    FAIL: gdb.base/callfuncs.exp: backtrace at nested call level 3
    FAIL: gdb.base/callfuncs.exp: backtrace at nested call level 4
    FAIL: gdb.base/callfuncs.exp: backtrace after finish from nested call level 4
    FAIL: gdb.base/callfuncs.exp: backtrace after finish from nested call level 3
    FAIL: gdb.base/callfuncs.exp: backtrace after finish from nested call level 2
    FAIL: gdb.base/callfuncs.exp: backtrace after finish from nested call level 1
    FAIL: gdb.base/define.exp: use hook-stop command
    FAIL: gdb.base/ena-dis-br.exp: step
    FAIL: gdb.base/ending-run.exp: step out of main
    FAIL: gdb.base/longjmp.exp: next over setjmp (1)
    FAIL: gdb.base/longjmp.exp: next to longjmp (1)
    FAIL: gdb.base/longjmp.exp: next over setjmp (2)
    FAIL: gdb.base/sepdebug.exp: step over breakpoint
    FAIL: gdb.base/sepdebug.exp: clear current line has no breakpoint disallowed
    FAIL: gdb.base/shlib-call.exp: print g
    FAIL: gdb.base/so-impl-ld.exp: step over solib call
    FAIL: gdb.base/so-impl-ld.exp: step into solib call
    FAIL: gdb.base/so-impl-ld.exp: step in solib call
    FAIL: gdb.base/so-impl-ld.exp: step out of solib call
    FAIL: gdb.base/store.exp: var struct 3 u; next to add_struct_3 call
    FAIL: gdb.base/store.exp: var struct 3 u; print old u, expecting {s = \{0, 0, 0}}
    FAIL: gdb.base/store.exp: var struct 3 u; set u to s_3
    FAIL: gdb.base/store.exp: var struct 3 u; print new u, expecting {s = \{1, 2, 3}}
    FAIL: gdb.base/structs.exp: return foo<n>; return 2 structs-tc
    FAIL: gdb.base/structs.exp: return foo<n>; return 3 structs-tc
    FAIL: gdb.base/structs.exp: return foo<n>; return 4 structs-tc
    FAIL: gdb.base/structs.exp: return foo<n>; return 5 structs-tc
    FAIL: gdb.base/structs.exp: return foo<n>; return 6 structs-tc
    FAIL: gdb.base/structs.exp: return foo<n>; return 7 structs-tc
    FAIL: gdb.base/structs.exp: return foo<n>; return 8 structs-tc
    FAIL: gdb.base/structs.exp: return foo<n>; return 2 structs-ts
    FAIL: gdb.base/structs.exp: return foo<n>; return 3 structs-ts
    FAIL: gdb.base/structs.exp: return foo<n>; return 4 structs-ts
    FAIL: gdb.base/structs.exp: return foo<n>; return 2 structs-ts-tc
    FAIL: gdb.base/structs.exp: return foo<n>; return 2 structs-tc-ts
    FAIL: gdb.cp/pr-1210.exp: step past initialization
    FAIL: gdb.cp/pr-1210.exp: print *obj
    FAIL: gdb.cp/pr-1210.exp: print obj->myB
    FAIL: gdb.threads/linux-dp.exp: info threads after: 0
    FAIL: gdb.threads/linux-dp.exp: info threads after: 1
    FAIL: gdb.threads/linux-dp.exp: info threads after: 2
    FAIL: gdb.threads/linux-dp.exp: info threads after: 3
    FAIL: gdb.threads/linux-dp.exp: info threads after: 4

gdb/
2012-02-24  Thomas Schwinge  <thomas@codesourcery.com>

	* sh-tdep.c (sh_make_stub_cache, sh_stub_this_id)
	(sh_stub_unwind_sniffer): New functions.
	(sh_stub_unwind): New variable.
	(sh_gdbarch_init): Wire everything.

Index: gdb/sh-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/sh-tdep.c,v
retrieving revision 1.238
diff -u -p -r1.238 sh-tdep.c
--- gdb/sh-tdep.c	24 Feb 2012 11:00:07 -0000	1.238
+++ gdb/sh-tdep.c	24 Feb 2012 18:59:45 -0000
@@ -41,6 +41,7 @@
 #include "osabi.h"
 #include "reggroups.h"
 #include "regset.h"
+#include "objfiles.h"
 
 #include "sh-tdep.h"
 
@@ -2666,6 +2667,57 @@ static const struct frame_base sh_frame_
   sh_frame_base_address
 };
 
+static struct sh_frame_cache *
+sh_make_stub_cache (struct frame_info *this_frame)
+{
+  struct gdbarch *gdbarch = get_frame_arch (this_frame);
+  struct sh_frame_cache *cache;
+
+  cache = sh_alloc_frame_cache ();
+
+  cache->saved_sp
+    = get_frame_register_unsigned (this_frame, gdbarch_sp_regnum (gdbarch));
+
+  return cache;
+}
+
+static void
+sh_stub_this_id (struct frame_info *this_frame, void **this_cache,
+                 struct frame_id *this_id)
+{
+  struct sh_frame_cache *cache;
+
+  if (*this_cache == NULL)
+    *this_cache = sh_make_stub_cache (this_frame);
+  cache = *this_cache;
+
+  *this_id = frame_id_build (cache->saved_sp, get_frame_pc (this_frame));
+}
+
+static int
+sh_stub_unwind_sniffer (const struct frame_unwind *self,
+                        struct frame_info *this_frame,
+                        void **this_prologue_cache)
+{
+  CORE_ADDR addr_in_block;
+
+  addr_in_block = get_frame_address_in_block (this_frame);
+  if (in_plt_section (addr_in_block, NULL))
+    return 1;
+
+  return 0;
+}
+
+static const struct frame_unwind sh_stub_unwind =
+{
+  NORMAL_FRAME,
+  default_frame_unwind_stop_reason,
+  sh_stub_this_id,
+  sh_frame_prev_register,
+  NULL,
+  sh_stub_unwind_sniffer
+};
+
 /* The epilogue is defined here as the area at the end of a function,
    either on the `ret' instruction itself or after an instruction which
    destroys the function's stack frame.  */
@@ -3055,6 +3107,7 @@ sh_gdbarch_init (struct gdbarch_info inf
   gdbarch_init_osabi (info, gdbarch);
 
   dwarf2_append_unwinders (gdbarch);
+  frame_unwind_append_unwinder (gdbarch, &sh_stub_unwind);
   frame_unwind_append_unwinder (gdbarch, &sh_frame_unwind);
 
   return gdbarch;

(This is modeled after what arm-tdep and tic6x-tdep are doing.)


Grüße,
 Thomas
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 489 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/gdb-patches/attachments/20120224/c5eb5fbf/attachment.sig>


More information about the Gdb-patches mailing list