From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1028) id 2FD0D385736D; Thu, 20 Oct 2022 02:41:17 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 2FD0D385736D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1666233677; bh=DiEhntmYj/MKBHYGQhnXTF66jfKh2ZiGdNJvzrKwxIc=; h=From:To:Subject:Date:From; b=LT/NJgImK4GuAKwDPyDp2sNuAQeYLV6zPSzTujAtWqjU2fWm3rQ7WOEyEpIgSUd6O O6N4UiXNDdcj+gOBDJx5v7lH6Yyuv/4HLfS6c1whqCpAJ74T0381xWTKcQbY06SISk 0np66mHJKn8OCBwiNIn3OEFCO7VfV7c5ATd4We5k= Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Kevin Buettner To: gdb-cvs@sourceware.org Subject: [binutils-gdb] Allow debugging of runtime loader / dynamic linker X-Act-Checkin: binutils-gdb X-Git-Author: Kevin Buettner X-Git-Refname: refs/heads/master X-Git-Oldrev: b64dc199b01de38858c853c434c278a51fe890cb X-Git-Newrev: be6276e0aed1f2df8f771d9823b6c8fea29e6a66 Message-Id: <20221020024117.2FD0D385736D@sourceware.org> Date: Thu, 20 Oct 2022 02:41:17 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3Dbe6276e0aed1= f2df8f771d9823b6c8fea29e6a66 commit be6276e0aed1f2df8f771d9823b6c8fea29e6a66 Author: Kevin Buettner Date: Wed Oct 19 19:36:07 2022 -0700 Allow debugging of runtime loader / dynamic linker =20 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. =20 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. =20 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. =20 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_st= ate *ecs) =20 if (execution_direction !=3D EXEC_REVERSE && ecs->event_thread->control.step_over_calls =3D=3D STEP_OVER_UNDEB= UGGABLE - && 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 =3D gdbarch_skip_solib_resolver (gdbarch, ecs->event_thread->stop_pc ());