Message ID | 20221008035716.46147-2-kevinb@redhat.com |
---|---|
State | Committed |
Commit | be6276e0aed1f2df8f771d9823b6c8fea29e6a66 |
Headers |
Return-Path: <gdb-patches-bounces+patchwork=sourceware.org@sourceware.org> X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 054DB395B836 for <patchwork@sourceware.org>; Sat, 8 Oct 2022 03:58:03 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 054DB395B836 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1665201483; bh=bEN+mJOXP99IgCUSihm98jnyjDyplLTbs3UJPisdK5s=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=j9l7NhVoBeiNVs9utCiOytSy7JjdX+iJN3yIwQelVVIViI41PmafsKs3PhxhkH8Fi tf+W66zQ08spKrl9OdJ5r9w8RMxAmRmREX/x+EbEcmORsilowehVEFQ/mUg85QZ3To 6KQNC4sgujOxNXWC8E+ZjZLZJYQ1fNB2TpIzNBzA= X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org 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 <gdb-patches@sourceware.org>; 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 <gdb-patches@sourceware.org>; 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) 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 <gdb-patches.sourceware.org> List-Unsubscribe: <https://sourceware.org/mailman/options/gdb-patches>, <mailto:gdb-patches-request@sourceware.org?subject=unsubscribe> List-Archive: <https://sourceware.org/pipermail/gdb-patches/> List-Post: <mailto:gdb-patches@sourceware.org> List-Help: <mailto:gdb-patches-request@sourceware.org?subject=help> List-Subscribe: <https://sourceware.org/mailman/listinfo/gdb-patches>, <mailto:gdb-patches-request@sourceware.org?subject=subscribe> From: Kevin Buettner via Gdb-patches <gdb-patches@sourceware.org> Reply-To: Kevin Buettner <kevinb@redhat.com> Errors-To: gdb-patches-bounces+patchwork=sourceware.org@sourceware.org Sender: "Gdb-patches" <gdb-patches-bounces+patchwork=sourceware.org@sourceware.org> |
Series |
Allow debugging of runtime loader / dynamic linker
|
|
Commit Message
Kevin Buettner
Oct. 8, 2022, 3:57 a.m. UTC
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(-)
Comments
Hi Kevin, We have recently encountered a bug with the master branch. Simon have opened https://sourceware.org/bugzilla/show_bug.cgi?id=29747 to track it. By running `git bisect`, it seems that this problem appeared with this patch. Do you think you would have time to investigate this issue? I have not looked at the actual problem yet. I have just been looking at when the regression got introduced. I do not expect it to be too long to fix, but I am not familiar with this part of the code. Please let me know if you do not have time to investigate this. Best, Lancelot. On Fri, Oct 07, 2022 at 08:57:15PM -0700, Kevin Buettner via Gdb-patches wrote: > 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 >
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 ());