public inbox for gdb-cvs@sourceware.org
help / color / mirror / Atom feed
* [binutils-gdb] Allow debugging of runtime loader / dynamic linker
@ 2022-10-20  2:41 Kevin Buettner
  0 siblings, 0 replies; only message in thread
From: Kevin Buettner @ 2022-10-20  2:41 UTC (permalink / raw)
  To: gdb-cvs

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=be6276e0aed1f2df8f771d9823b6c8fea29e6a66

commit be6276e0aed1f2df8f771d9823b6c8fea29e6a66
Author: Kevin Buettner <kevinb@redhat.com>
Date:   Wed Oct 19 19:36:07 2022 -0700

    Allow debugging of runtime loader / dynamic linker
    
    At present, GDB does not allow for the debugging of the runtime loader
    and/or dynamic linker.  Much of the time, this makes sense.  An
    application programmer doesn't normally want to see symbol resolution
    code when stepping into a function that hasn't been resolved yet.
    
    But someone who wishes to debug the runtime loader / dynamic linker
    might place a breakpoint in that code and then wish to debug it
    as normal.  At the moment, this is not possible.  Attempting to step
    will cause GDB to internally step (and not stop) until code
    unrelated to the dynamic linker is reached.
    
    This commit makes a minor change to infrun.c which allows the dynamic
    loader / linker to be debugged in the case where a step, next, etc.
    is initiated from within that code.
    
    While developing this fix, I tried some approaches which weren't quite
    right.  The GDB testusite definitely contains tests which FAIL when
    it's done incorrectly.  (At one point, I saw 17 regressions!) This
    commit has been tested on x86-64 linux with no regressions.

Diff:
---
 gdb/infrun.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/gdb/infrun.c b/gdb/infrun.c
index 2e462be5ba7..9a9f42fc903 100644
--- a/gdb/infrun.c
+++ b/gdb/infrun.c
@@ -6955,7 +6955,10 @@ process_event_stop_test (struct execution_control_state *ecs)
 
   if (execution_direction != EXEC_REVERSE
       && ecs->event_thread->control.step_over_calls == STEP_OVER_UNDEBUGGABLE
-      && in_solib_dynsym_resolve_code (ecs->event_thread->stop_pc ()))
+      && in_solib_dynsym_resolve_code (ecs->event_thread->stop_pc ())
+      && !in_solib_dynsym_resolve_code (
+	  ecs->event_thread->control.step_start_function->value_block ()
+	      ->entry_pc ()))
     {
       CORE_ADDR pc_after_resolver =
 	gdbarch_skip_solib_resolver (gdbarch, ecs->event_thread->stop_pc ());

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-10-20  2:41 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-20  2:41 [binutils-gdb] Allow debugging of runtime loader / dynamic linker Kevin Buettner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).