From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 51451 invoked by alias); 15 Dec 2019 02:30:52 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 51414 invoked by uid 89); 15 Dec 2019 02:30:52 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-18.2 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.3.1 spammy=foreign, images X-HELO: simark.ca Received: from simark.ca (HELO simark.ca) (158.69.221.121) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sun, 15 Dec 2019 02:30:46 +0000 Received: from [10.0.0.11] (unknown [192.222.164.54]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPSA id 494631E05A; Sat, 14 Dec 2019 21:30:44 -0500 (EST) Subject: Re: [PATCH v2 (w/ ChangeLog)] Fix disabling of solib probes when LD_AUDITing To: George Barrett , gdb-patches@sourceware.org References: <1ehh33uyr5gra7_h9krnpznz2jqsjw_4593wafg.zlb1mgays0ef@mail.bob131.so> From: Simon Marchi Message-ID: Date: Sun, 15 Dec 2019 02:30:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.3.0 MIME-Version: 1.0 In-Reply-To: <1ehh33uyr5gra7_h9krnpznz2jqsjw_4593wafg.zlb1mgays0ef@mail.bob131.so> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-SW-Source: 2019-12/txt/msg00679.txt.bz2 On 2019-12-14 7:12 p.m., George Barrett wrote: > The SVR4 solib event handler determines whether an event is related to a > non-base link namespace by comparing the event's debug struct address > to the debug struct address of the initial program image. However, this > can fail when using LD_AUDIT as audit libraries are loaded before the > loader has initialised the initial program image's debug struct. When > the event handler fails to find the debug struct, the probe-based > debugger interface is disabled and a warning is flagged to the user. > > This commit adds a fallback test to help determine whether an event is > for a foreign link namespace when the debug struct isn't available. Hi George, The patch makes sense to me, as far as I understand it. > gdb/ChangeLog: > 2019-12-15 George Barrett > > * solib-svr4.c (svr4_handle_solib_event): Add fallback link > namespace test for when the debug struct isn't available. > --- > gdb/solib-svr4.c | 22 +++++++++++++++++++++- > 1 file changed, 21 insertions(+), 1 deletion(-) > > diff --git a/gdb/solib-svr4.c b/gdb/solib-svr4.c > index de765576d0..f0c7769ac2 100644 > --- a/gdb/solib-svr4.c > +++ b/gdb/solib-svr4.c > @@ -1942,7 +1942,27 @@ svr4_handle_solib_event (void) > /* Always locate the debug struct, in case it moved. */ > info->debug_base = 0; > if (locate_base (info) == 0) > - return; > + { > + /* It's possible for the reloc_complete probe to be triggered before > + the linker has set the DT_DEBUG pointer (for example, when the > + linker has finished relocating an LD_AUDIT library or its > + dependencies). Since we can't yet handle libraries from other link > + namespaces, we don't lose anything by ignoring them here. */ > + struct value *link_map_id_val; > + try > + { > + link_map_id_val = pa->prob->evaluate_argument (0, frame); > + } > + catch (const gdb_exception_error) Catch the exception by reference: catch (const gdb_exception_error &) I can push your patch with this fixed, if you agree (and others think the patch is fine too). Simon