Define NetBSD specific skip_solib_resolver

Message ID 20200406230152.9842-1-n54@gmx.com
State New
Headers show
Series
  • Define NetBSD specific skip_solib_resolver
Related show

Commit Message

Kamil Rytarowski April 6, 2020, 11:01 p.m.
gdb/ChangeLog:

	* nbsd-tdep.c: Include "objfiles.h".
	(nbsd_skip_solib_resolver): New.
	(nbsd_init_abi): Call set_gdbarch_skip_solib_resolver().
---
 gdb/ChangeLog   |  6 ++++++
 gdb/nbsd-tdep.c | 16 ++++++++++++++++
 2 files changed, 22 insertions(+)

--
2.25.0

Comments

Tom Tromey April 7, 2020, 3:42 p.m. | #1
>>>>> "Kamil" == Kamil Rytarowski <n54@gmx.com> writes:


Kamil> gdb/ChangeLog:
Kamil> 	* nbsd-tdep.c: Include "objfiles.h".
Kamil> 	(nbsd_skip_solib_resolver): New.
Kamil> 	(nbsd_init_abi): Call set_gdbarch_skip_solib_resolver().

Thanks.

Kamil> +#include "objfiles.h"

It doesn't really matter to me (gdb isn't anywhere near header
cleanliness), but I wonder why this include was needed.

Kamil> +  msym = lookup_minimal_symbol("_rtld_bind_start", NULL, NULL);

Missing a space before the "(".

Ok with that change.

Tom
Kamil Rytarowski April 7, 2020, 5:08 p.m. | #2
On 07.04.2020 17:42, Tom Tromey wrote:
>>>>>> "Kamil" == Kamil Rytarowski <n54@gmx.com> writes:

>

> Kamil> gdb/ChangeLog:

> Kamil> 	* nbsd-tdep.c: Include "objfiles.h".

> Kamil> 	(nbsd_skip_solib_resolver): New.

> Kamil> 	(nbsd_init_abi): Call set_gdbarch_skip_solib_resolver().

>

> Thanks.

>

> Kamil> +#include "objfiles.h"

>

> It doesn't really matter to me (gdb isn't anywhere near header

> cleanliness), but I wonder why this include was needed.

>


If I remove the include, I get:

In file included from solist.h:24,
                 from solib-svr4.h:23,
                 from nbsd-tdep.c:23:
nbsd-tdep.c: In function ‘CORE_ADDR nbsd_skip_solib_resolver(gdbarch*,
CORE_ADDR)’:
symtab.h:758:18: error: invalid use of incomplete type ‘struct objfile’
       + (objfile)->section_offsets[(symbol)->section]))
                  ^~
symtab.h:761:3: note: in expansion of macro ‘MSYMBOL_VALUE_ADDRESS’
   MSYMBOL_VALUE_ADDRESS ((symbol).objfile, (symbol).minsym)
   ^~~~~~~~~~~~~~~~~~~~~
nbsd-tdep.c:351:22: note: in expansion of macro ‘BMSYMBOL_VALUE_ADDRESS’
   if (msym.minsym && BMSYMBOL_VALUE_ADDRESS (msym) == pc)
                      ^~~~~~~~~~~~~~~~~~~~~~
In file included from symtab.h:28,
                 from solist.h:24,
                 from solib-svr4.h:23,
                 from nbsd-tdep.c:23:
gdbtypes.h:547:10: note: forward declaration of ‘struct objfile’
   struct objfile *objfile;
          ^~~~~~~
nbsd-tdep.c:355:1: error: control reaches end of non-void function
[-Werror=return-type]
 }
 ^
cc1plus: all warnings being treated as errors

> Kamil> +  msym = lookup_minimal_symbol("_rtld_bind_start", NULL, NULL);

>

> Missing a space before the "(".

>


OK!

> Ok with that change.

>

> Tom

>

Patch

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index bd1a0f4df18..2768eb647fb 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,9 @@ 
+2020-04-06  Kamil Rytarowski  <n54@gmx.com>
+
+	* nbsd-tdep.c: Include "objfiles.h".
+	(nbsd_skip_solib_resolver): New.
+	(nbsd_init_abi): Call set_gdbarch_skip_solib_resolver().
+
 2020-04-06  Kamil Rytarowski  <n54@gmx.com>

 	* nbsd-nat.h (struct thread_info): Add forward declaration.
diff --git a/gdb/nbsd-tdep.c b/gdb/nbsd-tdep.c
index 6680d3c6fde..6f5c794d9e8 100644
--- a/gdb/nbsd-tdep.c
+++ b/gdb/nbsd-tdep.c
@@ -23,6 +23,7 @@ 
 #include "solib-svr4.h"
 #include "nbsd-tdep.h"
 #include "gdbarch.h"
+#include "objfiles.h"

 /* FIXME: kettenis/20060115: We should really eliminate the next two
    functions completely.  */
@@ -339,6 +340,20 @@  nbsd_gdb_signal_to_target (struct gdbarch *gdbarch,
   return -1;
 }

+/* Shared library resolver handling.  */
+
+static CORE_ADDR
+nbsd_skip_solib_resolver (struct gdbarch *gdbarch, CORE_ADDR pc)
+{
+  struct bound_minimal_symbol msym;
+
+  msym = lookup_minimal_symbol("_rtld_bind_start", 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);
+}
+
 /* See nbsd-tdep.h.  */

 void
@@ -346,4 +361,5 @@  nbsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
 {
   set_gdbarch_gdb_signal_from_target (gdbarch, nbsd_gdb_signal_from_target);
   set_gdbarch_gdb_signal_to_target (gdbarch, nbsd_gdb_signal_to_target);
+  set_gdbarch_skip_solib_resolver (gdbarch, nbsd_skip_solib_resolver);
 }