From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp.polymtl.ca (smtp.polymtl.ca [132.207.4.11]) by sourceware.org (Postfix) with ESMTPS id 8D56D3839835 for ; Mon, 2 Aug 2021 13:29:53 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 8D56D3839835 Received: from simark.ca (simark.ca [158.69.221.121]) (authenticated bits=0) by smtp.polymtl.ca (8.14.7/8.14.7) with ESMTP id 172DTlSv023089 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 2 Aug 2021 09:29:52 -0400 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp.polymtl.ca 172DTlSv023089 Received: from [10.0.0.11] (192-222-157-6.qc.cable.ebox.net [192.222.157.6]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by simark.ca (Postfix) with ESMTPSA id BA97F1E4A3; Mon, 2 Aug 2021 09:29:47 -0400 (EDT) Subject: Re: [PATCH][gdb/symtab] Recognize .gdb_index symbol table with empty entries as empty To: Tom de Vries , gdb-patches@sourceware.org Cc: Tom Tromey References: <20210801180400.GA9164@delia> From: Simon Marchi Message-ID: <5c1bb8ec-e2f7-468a-8035-d6279167f7f4@polymtl.ca> Date: Mon, 2 Aug 2021 09:29:47 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.12.0 MIME-Version: 1.0 In-Reply-To: <20210801180400.GA9164@delia> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Poly-FromMTA: (simark.ca [158.69.221.121]) at Mon, 2 Aug 2021 13:29:47 +0000 X-Spam-Status: No, score=-10.0 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, NICE_REPLY_A, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_PASS, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) 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: Mon, 02 Aug 2021 13:29:54 -0000 On 2021-08-01 2:04 p.m., Tom de Vries wrote: > Hi, > > When reading a .gdb_index that contains a non-empty symbol table with only > empty entries, gdb doesn't recognize it as empty. > > Fix this by recognizing that the constant pool is empty, and then setting the > symbol table to empty. > > Tested on x86_64-linux. > > Any comments? > > I don't see the need to propagate to gdb-11-branch, but perhaps I'm wrong there? > > Thanks, > - Tom > > [gdb/symtab] Recognize .gdb_index symbol table with empty entries as empty > > gdb/ChangeLog: > > 2021-08-01 Tom de Vries > > PR symtab/28159 > * dwarf2/read.c (read_gdb_index_from_buffer): Handle symbol table > filled with empty entries. > > gdb/testsuite/ChangeLog: > > 2021-08-01 Tom de Vries > > PR symtab/28159 > * gdb.dwarf2/dw2-zero-range.exp: Remove kfail. > > --- > gdb/dwarf2/read.c | 7 +++++++ > gdb/testsuite/gdb.dwarf2/dw2-zero-range.exp | 22 ++-------------------- > 2 files changed, 9 insertions(+), 20 deletions(-) > > diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c > index de84c47b626..a937fbef1cc 100644 > --- a/gdb/dwarf2/read.c > +++ b/gdb/dwarf2/read.c > @@ -2777,6 +2777,13 @@ to use the section anyway."), > ++i; > map->constant_pool = buffer.slice (metadata[i]); > > + if (map->constant_pool.empty () && !map->symbol_table.empty ()) > + { > + map->symbol_table > + = offset_view (gdb::array_view (symbol_table, > + symbol_table)); > + } That probably warrants a little comment. Otherwise, LGTM. Simon