tech-toolchain archive

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

GDB single-step fails on alpha (Re: CVS commit: src/share/mk)



On 2016/10/17 4:20, matthew green wrote:
Module Name:	src
Committed By:	mrg
Date:		Sun Oct 16 19:20:02 UTC 2016

Modified Files:
	src/share/mk: bsd.own.mk

Log Message:
switch alpha to GDB 7.12.  it works just as featureful as 7.7/7.10.
'step' and 'stepi' both fail, but 'next' and break points are ok,
so a sufficiently determined user can get somewhere..

someone should try to fix 'step'.  it appears to loop forever inside
ld.elf_so for me in an atomic cas function.

It seems quite similar to the case of arm, cf., toolchain/50773:

  http://gnats.netbsd.org/50773

On arm, GDB single-stepping used to fail into infinite loop inside
ld.elf_so. But by skipping dynamic linker symbols as in a similar
manner to OpenBSD/arm, it became fully functional.

GDB for OpenBSD/alpha also skips symbols in ld.elf_so. I attached
a patch to mimic it. Could you please test it? It builds, but not
tested since I have no alpha boxes ;-).

Thanks,
Rin
====
--- src/external/gpl3/gdb/dist/gdb/alphanbsd-tdep.c.orig	2016-10-17 22:27:51.290986784 +0900
+++ src/external/gpl3/gdb/dist/gdb/alphanbsd-tdep.c	2016-10-18 05:08:49.162227324 +0900
@@ -22,6 +22,7 @@
 #include "defs.h"
 #include "frame.h"
 #include "gdbcore.h"
+#include "objfiles.h"
 #include "osabi.h"
 #include "regcache.h"
 #include "regset.h"
@@ -47,6 +48,19 @@
 /* Sizeof `struct fpreg' in <machine/reg.h.  */
 #define ALPHANBSD_SIZEOF_FPREGS	((32 * 8) + 8)
+/* from obsd-tdep.c with symbol name adjusted to ours */
+static CORE_ADDR
+alphanbsd_skip_solib_resolver (struct gdbarch *gdbarch, CORE_ADDR pc)
+{
+  struct bound_minimal_symbol msym;
+
+  msym = lookup_minimal_symbol("_rtld_bind", NULL, NULL);
+  if (msym.minsym && BMSYMBOL_VALUE_ADDRESS (msym) == pc)
+    return frame_unwind_caller_pc (get_current_frame ());
+  else
+    return find_solib_trampoline_target (get_current_frame (), pc);
+}
+
 /* Supply register REGNUM from the buffer specified by FPREGS and LEN
    in the floating-point register set REGSET to register cache
    REGCACHE.  If REGNUM is -1, do this for all registers in REGSET.  */
@@ -333,6 +347,7 @@
   /* NetBSD/alpha has SVR4-style shared libraries.  */
   set_solib_svr4_fetch_link_map_offsets
     (gdbarch, svr4_lp64_fetch_link_map_offsets);
+  set_gdbarch_skip_solib_resolver (gdbarch, alphanbsd_skip_solib_resolver);
#ifdef notyet
   tdep->dynamic_sigtramp_offset = alphanbsd_sigtramp_offset;


Home | Main Index | Thread Index | Old Index