From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id B4C61382F9B0 for ; Sat, 8 Oct 2022 03:57:38 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org B4C61382F9B0 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-8-JQiEVnlKNq-fNE4fWL0CfA-1; Fri, 07 Oct 2022 23:57:37 -0400 X-MC-Unique: JQiEVnlKNq-fNE4fWL0CfA-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id BB74F1C06916 for ; Sat, 8 Oct 2022 03:57:36 +0000 (UTC) Received: from f36-1.lan (unknown [10.2.16.76]) by smtp.corp.redhat.com (Postfix) with ESMTP id 638ED112C080; Sat, 8 Oct 2022 03:57:36 +0000 (UTC) From: Kevin Buettner To: gdb-patches@sourceware.org Subject: [PATCH 1/2] Allow debugging of runtime loader / dynamic linker Date: Fri, 7 Oct 2022 20:57:15 -0700 Message-Id: <20221008035716.46147-2-kevinb@redhat.com> In-Reply-To: <20221008035716.46147-1-kevinb@redhat.com> References: <20221008035716.46147-1-kevinb@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.3 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII"; x-default=true X-Spam-Status: No, score=-11.2 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 08 Oct 2022 03:57:39 -0000 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. --- gdb/infrun.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/gdb/infrun.c b/gdb/infrun.c index 1957e8020dd..52441b7ab5c 100644 --- a/gdb/infrun.c +++ b/gdb/infrun.c @@ -6961,7 +6961,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 ()); -- 2.37.3