From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id MMv2IWEbRmIfHgAAWB0awg (envelope-from ) for ; Thu, 31 Mar 2022 17:21:37 -0400 Received: by simark.ca (Postfix, from userid 112) id 8762A1F163; Thu, 31 Mar 2022 17:21:37 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.2 Received: from sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id 2F0AA1E150 for ; Thu, 31 Mar 2022 17:21:37 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id DCE08388CC2B for ; Thu, 31 Mar 2022 21:21:36 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org DCE08388CC2B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1648761696; bh=cGN+03dNxaL4JumPwGBgG7Z3/iNz4zpso/a+INFYyuE=; 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=jRirWWJHG6MRGVsHsvndcP98pG+dUpph4Rzvanv5/2SNFragmRKdK7CJAVHw+d17A Cd1TF7EMD/U7+CEVzMYq5asCtaRIf29+AZ1o4laDQBr7TCTdD1uV185+18+A8E43/t hnCRBul8hEpQ5O4/XCdX5zA4L3urbrmG05CmZUjQ= Received: from barracuda.ebox.ca (barracuda.ebox.ca [96.127.255.19]) by sourceware.org (Postfix) with ESMTPS id 81F2C3838011 for ; Thu, 31 Mar 2022 21:20:24 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 81F2C3838011 X-ASG-Debug-ID: 1648761620-0c856e06ada4d440001-fS2M51 Received: from smtp.ebox.ca (smtp.ebox.ca [96.127.255.82]) by barracuda.ebox.ca with ESMTP id DnTYk6xNTDAqdUOT (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 31 Mar 2022 17:20:20 -0400 (EDT) X-Barracuda-Envelope-From: simon.marchi@polymtl.ca X-Barracuda-RBL-Trusted-Forwarder: 96.127.255.82 Received: from simark.localdomain (192-222-157-6.qc.cable.ebox.net [192.222.157.6]) by smtp.ebox.ca (Postfix) with ESMTP id 67CEA441D65; Thu, 31 Mar 2022 17:20:20 -0400 (EDT) X-Barracuda-RBL-IP: 192.222.157.6 X-Barracuda-Effective-Source-IP: 192-222-157-6.qc.cable.ebox.net[192.222.157.6] X-Barracuda-Apparent-Source-IP: 192.222.157.6 To: gdb-patches@sourceware.org Subject: [PATCH 3/3] gdb/ctf: pass partial symtab's filename to buildsym_compunit Date: Thu, 31 Mar 2022 17:20:19 -0400 X-ASG-Orig-Subj: [PATCH 3/3] gdb/ctf: pass partial symtab's filename to buildsym_compunit Message-Id: <20220331212019.2811099-3-simon.marchi@polymtl.ca> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220331212019.2811099-1-simon.marchi@polymtl.ca> References: <20220331212019.2811099-1-simon.marchi@polymtl.ca> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Barracuda-Connect: smtp.ebox.ca[96.127.255.82] X-Barracuda-Start-Time: 1648761620 X-Barracuda-Encrypted: DHE-RSA-AES256-SHA X-Barracuda-URL: https://96.127.255.19:443/cgi-mod/mark.cgi X-Virus-Scanned: by bsmtpd at ebox.ca X-Barracuda-Scan-Msg-Size: 3539 X-Barracuda-BRTS-Status: 1 X-Barracuda-Spam-Score: 0.00 X-Barracuda-Spam-Status: No, SCORE=0.00 using global scores of TAG_LEVEL=1000.0 QUARANTINE_LEVEL=1000.0 KILL_LEVEL=8.0 tests= X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.3.97040 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- 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: , From: Simon Marchi via Gdb-patches Reply-To: Simon Marchi Errors-To: gdb-patches-bounces+public-inbox=simark.ca@sourceware.org Sender: "Gdb-patches" I noticed that the CTF symbol reader passes the objfile's name to all buildsym_compunit instances it creates. The result is that all compunit_symtabs created have the same name, that of the objfile: { objfile /tmp/babeltrace-ctf/src/lib/.libs/libbabeltrace2.so.0.0.0 ((struct objfile *) 0x613000005d00) { ((struct compunit_symtab *) 0x621000286760) debugformat ctf producer (null) name libbabeltrace2.so.0.0.0 dirname (null) blockvector ((struct blockvector *) 0x6210003911d0) user ((struct compunit_symtab *) (null)) { symtab /tmp/babeltrace-ctf/src/lib/.libs/libbabeltrace2.so.0.0.0 ((struct symtab *) 0x6210003911f0) fullname (null) linetable ((struct linetable *) 0x0) } } { ((struct compunit_symtab *) 0x621000275c10) debugformat ctf producer (null) name libbabeltrace2.so.0.0.0 dirname (null) blockvector ((struct blockvector *) 0x621000286710) user ((struct compunit_symtab *) (null)) { symtab /tmp/babeltrace-ctf/src/lib/.libs/libbabeltrace2.so.0.0.0 ((struct symtab *) 0x621000286730) fullname (null) linetable ((struct linetable *) 0x0) } } Notice the two "name libbabeltrace2.so.0.0.0". Change it to pass the partial_symtab's filename instead. The output becomes: { objfile /tmp/babeltrace-ctf/src/lib/.libs/libbabeltrace2.so.0.0.0 ((struct objfile *) 0x613000005d00) { ((struct compunit_symtab *) 0x621000295610) debugformat ctf producer (null) name libbabeltrace2.so.0.0.0 dirname (null) blockvector ((struct blockvector *) 0x6210003a15d0) user ((struct compunit_symtab *) (null)) { symtab /tmp/babeltrace-ctf/src/lib/.libs/libbabeltrace2.so.0.0.0 ((struct symtab *) 0x6210003a15f0) fullname (null) linetable ((struct linetable *) 0x0) } } { ((struct compunit_symtab *) 0x621000288700) debugformat ctf producer (null) name current-thread.c dirname (null) blockvector ((struct blockvector *) 0x6210002955c0) user ((struct compunit_symtab *) (null)) { symtab /home/simark/src/babeltrace/src/lib/current-thread.c ((struct symtab *) 0x6210002955e0) fullname (null) linetable ((struct linetable *) 0x0) } } Note that the first compunit_symtab still has libbabeltrace2.so.0.0.0 as its name. This is because the CTF symbol reader really creates a partial symtab named like this. It appears to be because the debug info contains information that has been factored out of all CUs and is at the "top-level" of the objfile, outside any real CU. So it creates a partial symtab and an artificial CU that's named after the objfile. Change-Id: I576316bab2a3668adf87b4e6cebda900a8159b1b --- gdb/ctfread.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gdb/ctfread.c b/gdb/ctfread.c index 8636692e2e1b..7f7e09638a40 100644 --- a/gdb/ctfread.c +++ b/gdb/ctfread.c @@ -1253,7 +1253,7 @@ ctf_start_symtab (ctf_psymtab *pst, ccp = &pst->context; ccp->builder = new buildsym_compunit - (of, of->original_name, nullptr, + (of, pst->filename, nullptr, language_c, text_offset); ccp->builder->record_debugformat ("ctf"); } -- 2.35.1