From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id iF0RCUUbRmIfHgAAWB0awg (envelope-from ) for ; Thu, 31 Mar 2022 17:21:09 -0400 Received: by simark.ca (Postfix, from userid 112) id 2187E1F163; Thu, 31 Mar 2022 17:21:09 -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 CD5181E150 for ; Thu, 31 Mar 2022 17:21:08 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 7BC85388E824 for ; Thu, 31 Mar 2022 21:21:08 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 7BC85388E824 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1648761668; bh=XqDKQPWbCCPOXXuXOICEYtdimAWTj+tRFgTiUcjv0ZY=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=pChoXxM5+up3RrYmx061YGg9UVi7kSnAbfEJ/Qx3H+O2dvlRK5SYwzBbWXOaGNqZj +1vfUUaL5WUn89LsLTRfYW3d7qOEwQO68JyruZCdtYWK6nCnn6Y2PT+nShkhe1wal7 UP4qJC75G5dYHoQsSpCD/r8PACOZ3MM/JltcgyaI= Received: from barracuda.ebox.ca (barracuda.ebox.ca [96.127.255.19]) by sourceware.org (Postfix) with ESMTPS id 5EE883839430 for ; Thu, 31 Mar 2022 21:20:21 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 5EE883839430 X-ASG-Debug-ID: 1648761620-0c856e06ada4d430001-fS2M51 Received: from smtp.ebox.ca (smtp.ebox.ca [96.127.255.82]) by barracuda.ebox.ca with ESMTP id IeXP8mRDvj4WbU93 (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 3F2E4441B21; 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 1/3] gdb/ctf: don't create a buildsym_compunit when building partial symbols Date: Thu, 31 Mar 2022 17:20:17 -0400 X-ASG-Orig-Subj: [PATCH 1/3] gdb/ctf: don't create a buildsym_compunit when building partial symbols Message-Id: <20220331212019.2811099-1-simon.marchi@polymtl.ca> X-Mailer: git-send-email 2.35.1 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-Barracuda-BRTS-Status: 1 X-Virus-Scanned: by bsmtpd at ebox.ca X-Barracuda-Scan-Msg-Size: 2656 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 am trying to do some changes to buildsym_compunit, so I am auditing the current uses. Something seems odd with this use of buildsym_compunit (that this patch removes). A buildsym_compunit is normally used when building a compunit_symtab. That is, when expanding a partial symtab into a full compunit symtab. In ctfread.c, a buildsym_compunit is created in ctf_start_archive, which is only used when creating partial symtabs. At this moment, I don't see how that's useful. ctf_start_archive creates a new buildsym_compunit and starts a subfile. But that buildsym_compunit is never used again. It's just overriden in ctf_start_symtab, which means we leak the old buildsym_compunit, I suppose. Remove ctf_start_archive completely. Add an assert in ctf_start_symtab to verify that we are not overwriting an existing buildsym_compunit (meaning we'd leak the existing one). This assert triggers without the other part of the fix. When doing: $ ./gdb --data-directory=data-directory /tmp/babeltrace-ctf/src/lib/.libs/libbabeltrace2.so.0.0.0 ... (gdb) maintenance expand-symtabs /home/simark/src/binutils-gdb/gdb/ctfread.c:1255: internal-error: ctf_start_symtab: Assertion `!ccp->builder' failed. Change-Id: I666d146454a019f08e7305f3a1c4a974d27b4592 --- gdb/ctfread.c | 20 +------------------- 1 file changed, 1 insertion(+), 19 deletions(-) diff --git a/gdb/ctfread.c b/gdb/ctfread.c index 8da38cc70af8..8636692e2e1b 100644 --- a/gdb/ctfread.c +++ b/gdb/ctfread.c @@ -1531,21 +1531,6 @@ ctf_psymtab_var_cb (const char *name, ctf_id_t id, void *arg) return 0; } -/* Start a subfile for CTF. FNAME is the name of the archive. */ - -static void -ctf_start_archive (struct ctf_context *ccx, struct objfile *of, - const char *fname) -{ - if (ccx->builder == nullptr) - { - ccx->builder = new buildsym_compunit (of, - of->original_name, nullptr, language_c, 0); - ccx->builder->record_debugformat ("ctf"); - } - ccx->builder->start_subfile (fname); -} - /* Setup partial_symtab's describing each source file for which debugging information is available. */ @@ -1567,10 +1552,7 @@ scan_partial_symbols (ctf_dict_t *cfp, psymtab_storage *partial_symtabs, struct ctf_context *ccx = &pst->context; if (isparent == false) - { - ctf_start_archive (ccx, of, fname); - ccx->pst = pst; - } + ccx->pst = pst; if (ctf_type_iter (cfp, ctf_psymtab_type_cb, ccx) == CTF_ERR) complaint (_("ctf_type_iter scan_partial_symbols failed - %s"), base-commit: 59f837cb11e3b96c581fe23b79f6995b7c8177ee -- 2.35.1