NetBSD-Bugs archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: toolchain/50773: GDB single stepping fails for dynamically linked binary on armbe
The following reply was made to PR toolchain/50773; it has been noted by GNATS.
From: Rin Okuyama <rokuyama%rk.phys.keio.ac.jp@localhost>
To: gnats-bugs%NetBSD.org@localhost
Cc:
Subject: Re: toolchain/50773: GDB single stepping fails for dynamically linked
binary on armbe
Date: Sun, 5 Jun 2016 01:04:15 +0900
On 2016/06/02 3:31, Rin Okuyama wrote:
> I observed the exactly same problem also on armel:
>
> % uname -mpr
> 7.99.30 evbarm earmv7hf
(snip)
Finally, I got it working! We need to skip symbol from ld.elf_so,
as in the case of OpenBSD/arm. Then, single stepping works fine
for dynamically linked binaries. I have tested both gdb (7.10) and
gdb.old (7.9) both on evbearmv7hf-eb and -el. Please apply the
attached patch below.
Thanks,
Rin
--- src/external/gpl3/gdb.old/dist/gdb/armnbsd-tdep.c.orig 2016-06-04 22:18:36.500300231 +0900
+++ src/external/gpl3/gdb.old/dist/gdb/armnbsd-tdep.c 2016-06-04 23:31:38.080675054 +0900
@@ -19,6 +19,7 @@
#include "defs.h"
#include "osabi.h"
+#include "objfiles.h"
#include "arm-tdep.h"
#include "solib-svr4.h"
@@ -27,6 +28,8 @@
#define ARM_NBSD_JB_PC 24
#define ARM_NBSD_JB_ELEMENT_SIZE INT_REGISTER_SIZE
+CORE_ADDR armnbsd_skip_solib_resolver (struct gdbarch *, CORE_ADDR);
+
/* For compatibility with previous implemenations of GDB on arm/NetBSD,
override the default little-endian breakpoint. */
static const gdb_byte arm_nbsd_arm_le_breakpoint[] = {0x11, 0x00, 0x00, 0xe6};
@@ -34,6 +37,19 @@
static const gdb_byte arm_nbsd_thumb_le_breakpoint[] = {0xfe, 0xde};
static const gdb_byte arm_nbsd_thumb_be_breakpoint[] = {0xde, 0xfe};
+/* from obsd-tdep.c with symbol name adjusted to ours */
+CORE_ADDR
+armnbsd_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);
+}
+
static void
arm_netbsd_init_abi_common (struct gdbarch_info info,
struct gdbarch *gdbarch)
@@ -93,6 +109,9 @@
/* NetBSD ELF uses SVR4-style shared libraries. */
set_solib_svr4_fetch_link_map_offsets
(gdbarch, svr4_ilp32_fetch_link_map_offsets);
+
+ /* for single stepping; see PR/50773 */
+ set_gdbarch_skip_solib_resolver (gdbarch, armnbsd_skip_solib_resolver);
}
static enum gdb_osabi
--- src/external/gpl3/gdb/dist/gdb/armnbsd-tdep.c.orig 2016-06-04 22:22:13.446960426 +0900
+++ src/external/gpl3/gdb/dist/gdb/armnbsd-tdep.c 2016-06-04 23:30:59.155155886 +0900
@@ -19,6 +19,7 @@
#include "defs.h"
#include "osabi.h"
+#include "objfiles.h"
#include "arm-tdep.h"
#include "solib-svr4.h"
@@ -27,6 +28,8 @@
#define ARM_NBSD_JB_PC 24
#define ARM_NBSD_JB_ELEMENT_SIZE INT_REGISTER_SIZE
+CORE_ADDR armnbsd_skip_solib_resolver (struct gdbarch *, CORE_ADDR);
+
/* For compatibility with previous implemenations of GDB on arm/NetBSD,
override the default little-endian breakpoint. */
static const gdb_byte arm_nbsd_arm_le_breakpoint[] = {0x11, 0x00, 0x00, 0xe6};
@@ -34,6 +37,19 @@
static const gdb_byte arm_nbsd_thumb_le_breakpoint[] = {0xfe, 0xde};
static const gdb_byte arm_nbsd_thumb_be_breakpoint[] = {0xde, 0xfe};
+/* from obsd-tdep.c with symbol name adjusted to ours */
+CORE_ADDR
+armnbsd_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);
+}
+
static void
arm_netbsd_init_abi_common (struct gdbarch_info info,
struct gdbarch *gdbarch)
@@ -93,6 +109,9 @@
/* NetBSD ELF uses SVR4-style shared libraries. */
set_solib_svr4_fetch_link_map_offsets
(gdbarch, svr4_ilp32_fetch_link_map_offsets);
+
+ /* for single stepping; see PR/50773 */
+ set_gdbarch_skip_solib_resolver (gdbarch, armnbsd_skip_solib_resolver);
}
static enum gdb_osabi
Home |
Main Index |
Thread Index |
Old Index