This is the mail archive of the
gdb-prs@sourceware.org
mailing list for the GDB project.
Re: shlibs/2063: Unable to step into shared library
- From: Mark Kettenis <mark dot kettenis at xs4all dot nl>
- To: nobody at sources dot redhat dot com
- Cc: gdb-prs at sources dot redhat dot com,
- Date: 7 Jan 2006 19:18:01 -0000
- Subject: Re: shlibs/2063: Unable to step into shared library
- Reply-to: Mark Kettenis <mark dot kettenis at xs4all dot nl>
The following reply was made to PR shlibs/2063; it has been noted by GNATS.
From: Mark Kettenis <mark.kettenis@xs4all.nl>
To: steve@telxio.com
Cc: gdb-gnats@sources.redhat.com, steve.williams@utstar.com
Subject: Re: shlibs/2063: Unable to step into shared library
Date: Sat, 7 Jan 2006 20:14:17 +0100 (CET)
> Date: 6 Jan 2006 01:09:09 -0000
> From: steve@telxio.com
> GDB fails to step into a shared library function on
> Solaris10. Execution halts in _ti_bind_guard.
Hmm, so things changed in Solaris10...
> Attached is a patch that creates a Solaris2 specific shared library
> dynamic symbol resolver. I did not know if the solib-svr4.c file
> should be extended or whether a Solaris specific shared library file
> should be created.
Unfortunately that isn't the right approach; it's better to skip the
resolver code completely. Could you try the attached patch? It works
fine for me on Solaris 7.
Index: sparc-sol2-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/sparc-sol2-tdep.c,v
retrieving revision 1.10
diff -u -p -r1.10 sparc-sol2-tdep.c
--- sparc-sol2-tdep.c 17 Dec 2005 22:34:02 -0000 1.10
+++ sparc-sol2-tdep.c 7 Jan 2006 19:10:59 -0000
@@ -1,6 +1,6 @@
/* Target-dependent code for Solaris SPARC.
- Copyright (C) 2003, 2004 Free Software Foundation, Inc.
+ Copyright (C) 2003, 2004, 2006 Free Software Foundation, Inc.
This file is part of GDB.
@@ -33,6 +33,7 @@
#include "gdb_assert.h"
#include "gdb_string.h"
+#include "sol2-tdep.h"
#include "sparc-tdep.h"
#include "solib-svr4.h"
@@ -178,6 +179,7 @@ sparc32_sol2_init_abi (struct gdbarch_in
/* Solaris has SVR4-style shared libraries... */
set_gdbarch_skip_trampoline_code (gdbarch, find_solib_trampoline_target);
+ set_gdbarch_skip_solib_resolver (gdbarch, sol2_skip_solib_resolver);
set_solib_svr4_fetch_link_map_offsets
(gdbarch, svr4_ilp32_fetch_link_map_offsets);
Index: sparc-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/sparc-tdep.c,v
retrieving revision 1.166
diff -u -p -r1.166 sparc-tdep.c
--- sparc-tdep.c 17 Dec 2005 22:34:02 -0000 1.166
+++ sparc-tdep.c 7 Jan 2006 19:11:00 -0000
@@ -81,6 +81,7 @@ struct regset;
#define X_IMM22(i) ((i) & 0x3fffff)
#define X_OP3(i) (((i) >> 19) & 0x3f)
#define X_RS1(i) (((i) >> 14) & 0x1f)
+#define X_RS2(i) ((i) & 0x1f)
#define X_I(i) (((i) >> 13) & 1)
/* Sign extension macros. */
#define X_DISP22(i) ((X_IMM22 (i) ^ 0x200000) - 0x200000)
@@ -1045,6 +1046,23 @@ sparc_analyze_control_transfer (CORE_ADD
branch_p = 1;
offset = 4 * X_DISP19 (insn);
}
+ else if (X_OP (insn) == 2 && X_OP3 (insn) == 0x3a)
+ {
+ if ((X_I (insn) == 0 && X_RS1 (insn) == 0 && X_RS2 (insn) == 0)
+ || (X_I (insn) == 1 && X_RS1 (insn) == 0 && (insn & 0x7f) == 0))
+ {
+ /* OpenBSD system call. */
+ ULONGEST number;
+
+ regcache_cooked_read_unsigned (current_regcache,
+ SPARC_G1_REGNUM, &number);
+
+ if (number & 0x400)
+ return sparc_address_from_register (SPARC_G2_REGNUM);
+ if (number & 0x800)
+ return sparc_address_from_register (SPARC_G7_REGNUM);
+ }
+ }
/* FIXME: Handle DONE and RETRY instructions. */
Index: sparc64-linux-nat.c
===================================================================
RCS file: /cvs/src/src/gdb/sparc64-linux-nat.c,v
retrieving revision 1.4
diff -u -p -r1.4 sparc64-linux-nat.c
--- sparc64-linux-nat.c 17 Dec 2005 22:34:02 -0000 1.4
+++ sparc64-linux-nat.c 7 Jan 2006 19:11:00 -0000
@@ -47,6 +47,10 @@ void _initialize_sparc64_linux_nat (void
void
_initialize_sparc64_linux_nat (void)
{
+#ifndef __arch64__
+# warning "You're building a 32-bit GDB on a system that claims to be 64-bit"
+# warning "This GDB won't be able to debug 64-bit code"
+#else
struct target_ops *t;
/* Fill in the generic GNU/Linux methods. */
@@ -60,4 +64,5 @@ _initialize_sparc64_linux_nat (void)
add_target (t);
sparc_gregset = &sparc64_linux_ptrace_gregset;
+#endif
}
Index: sparc64-sol2-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/sparc64-sol2-tdep.c,v
retrieving revision 1.9
diff -u -p -r1.9 sparc64-sol2-tdep.c
--- sparc64-sol2-tdep.c 17 Dec 2005 22:34:02 -0000 1.9
+++ sparc64-sol2-tdep.c 7 Jan 2006 19:11:00 -0000
@@ -1,6 +1,6 @@
/* Target-dependent code for Solaris UltraSPARC.
- Copyright (C) 2003, 2004 Free Software Foundation, Inc.
+ Copyright (C) 2003, 2004, 2006 Free Software Foundation, Inc.
This file is part of GDB.
@@ -30,6 +30,7 @@
#include "gdb_assert.h"
+#include "sol2-tdep.h"
#include "sparc64-tdep.h"
#include "solib-svr4.h"
@@ -160,6 +161,7 @@ sparc64_sol2_init_abi (struct gdbarch_in
/* Solaris has SVR4-style shared libraries... */
set_gdbarch_skip_trampoline_code (gdbarch, find_solib_trampoline_target);
+ set_gdbarch_skip_solib_resolver (gdbarch, sol2_skip_solib_resolver);
set_solib_svr4_fetch_link_map_offsets
(gdbarch, svr4_lp64_fetch_link_map_offsets);
Index: config/sparc/sol2-64.mt
===================================================================
RCS file: /cvs/src/src/gdb/config/sparc/sol2-64.mt,v
retrieving revision 1.3
diff -u -p -r1.3 sol2-64.mt
--- config/sparc/sol2-64.mt 13 Sep 2004 20:55:42 -0000 1.3
+++ config/sparc/sol2-64.mt 7 Jan 2006 19:11:00 -0000
@@ -1,4 +1,4 @@
# Target: Solaris UltraSPARC
TDEPFILES= sparc64-tdep.o sparc64-sol2-tdep.o sparc-tdep.o sparc-sol2-tdep.o \
- solib.o solib-svr4.o
+ sol2-tdep.o solib.o solib-svr4.o
DEPRECATED_TM_FILE= tm-sol2.h
Index: config/sparc/sol2.mt
===================================================================
RCS file: /cvs/src/src/gdb/config/sparc/sol2.mt,v
retrieving revision 1.4
diff -u -p -r1.4 sol2.mt
--- config/sparc/sol2.mt 13 Sep 2004 20:55:42 -0000 1.4
+++ config/sparc/sol2.mt 7 Jan 2006 19:11:00 -0000
@@ -1,3 +1,3 @@
# Target: Solaris SPARC
-TDEPFILES= sparc-tdep.o sparc-sol2-tdep.o solib.o solib-svr4.o
+TDEPFILES= sparc-tdep.o sparc-sol2-tdep.o obsd-tdep.o solib.o solib-svr4.o
DEPRECATED_TM_FILE= tm-sol2.h