From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id bMkvERGTJGNI2DoAWB0awg (envelope-from ) for ; Fri, 16 Sep 2022 11:15:29 -0400 Received: by simark.ca (Postfix, from userid 112) id 3964A1E112; Fri, 16 Sep 2022 11:15:29 -0400 (EDT) Authentication-Results: simark.ca; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.a=rsa-sha256 header.s=default header.b=TLrSJVFt; dkim-atps=neutral X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) 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,NICE_REPLY_A,RDNS_DYNAMIC, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 Received: from sourceware.org (ip-8-43-85-97.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 41CAD1E07B for ; Fri, 16 Sep 2022 11:15:28 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id D71E83898388 for ; Fri, 16 Sep 2022 15:15:27 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D71E83898388 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1663341327; bh=1AWNuwEBFTc4hqWRR6afRuEE6hy7ZF7v7noh5WunokU=; h=Date:Subject:To:References:In-Reply-To:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=TLrSJVFtQ/Cbf5yPlLwRVhjY1yjxGbfE3mrWA8CWlugxSvIzhXjkUnQFqeo/Qj8mU MES7dJbopjfwvCdHXm9amYVY6AUss+uoyWasITqO3/Q1tRFd5V95pNE/Ma61KTzjZf n7sh89d7rrJ6bNxFn/HDnAjcZqx5SXMLMIg2pJ2M= Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by sourceware.org (Postfix) with ESMTPS id 3E812381D4F6 for ; Fri, 16 Sep 2022 15:15:08 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 3E812381D4F6 Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 7015733C69 for ; Fri, 16 Sep 2022 15:15:07 +0000 (UTC) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 610521346B for ; Fri, 16 Sep 2022 15:15:07 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id D8SaFvuSJGPCawAAMHmgww (envelope-from ) for ; Fri, 16 Sep 2022 15:15:07 +0000 Message-ID: Date: Fri, 16 Sep 2022 17:15:07 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.12.0 Subject: Re: [PATCH][gdb/symtab] Handle named DW_TAG_unspecified_type DIE Content-Language: en-US To: gdb-patches@sourceware.org References: <20220909093202.GA21359@delia.home> In-Reply-To: <20220909093202.GA21359@delia.home> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit 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: Tom de Vries via Gdb-patches Reply-To: Tom de Vries Errors-To: gdb-patches-bounces+public-inbox=simark.ca@sourceware.org Sender: "Gdb-patches" On 9/9/22 11:32, Tom de Vries wrote: > Hi, > > With the test-case included in the patch, we run into: > ... > (gdb) info types -q std::nullptr_t^M > During symbol reading: unsupported tag: 'DW_TAG_unspecified_type'^M > ^M > File /usr/include/c++/7/x86_64-suse-linux/bits/c++config.h:^M > 2198: typedef decltype(nullptr) std::nullptr_t;^M > (gdb) FAIL: gdb.dwarf2/nullptr_t.exp: info types -q std::nullptr_t \ > without complaint > ... > > Fix the complaint by handling DW_TAG_unspecified_type in new_symbol, and verify > in the test-case using "maint print symbols" that the symbol exists. > > Tested on x86_64-linux, with gcc 7.5.0 and clang 13.0. > > Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=17271 > > Any comments? > Committed. Thanks, - Tom > [gdb/symtab] Handle named DW_TAG_unspecified_type DIE > > --- > gdb/dwarf2/read.c | 1 + > gdb/testsuite/gdb.dwarf2/nullptr_t.cc | 29 +++++++++++++++++++++++++ > gdb/testsuite/gdb.dwarf2/nullptr_t.exp | 39 ++++++++++++++++++++++++++++++++++ > 3 files changed, 69 insertions(+) > > diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c > index 3ca441c4cae..a382d217def 100644 > --- a/gdb/dwarf2/read.c > +++ b/gdb/dwarf2/read.c > @@ -21063,6 +21063,7 @@ new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu, > case DW_TAG_base_type: > case DW_TAG_subrange_type: > case DW_TAG_generic_subrange: > + case DW_TAG_unspecified_type: > sym->set_aclass_index (LOC_TYPEDEF); > sym->set_domain (VAR_DOMAIN); > list_to_add = cu->list_in_scope; > diff --git a/gdb/testsuite/gdb.dwarf2/nullptr_t.cc b/gdb/testsuite/gdb.dwarf2/nullptr_t.cc > new file mode 100644 > index 00000000000..85fe801e193 > --- /dev/null > +++ b/gdb/testsuite/gdb.dwarf2/nullptr_t.cc > @@ -0,0 +1,29 @@ > +/* This testcase is part of GDB, the GNU debugger. > + > + Copyright 2022 Free Software Foundation, Inc. > + > + This program is free software; you can redistribute it and/or modify > + it under the terms of the GNU General Public License as published by > + the Free Software Foundation; either version 3 of the License, or > + (at your option) any later version. > + > + This program is distributed in the hope that it will be useful, > + but WITHOUT ANY WARRANTY; without even the implied warranty of > + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the > + GNU General Public License for more details. > + > + You should have received a copy of the GNU General Public License > + along with this program. If not, see . */ > + > +#include > + > +void > +foo (std::nullptr_t) > +{ > +} > + > +int > +main (void) > +{ > + foo (nullptr); > +} > diff --git a/gdb/testsuite/gdb.dwarf2/nullptr_t.exp b/gdb/testsuite/gdb.dwarf2/nullptr_t.exp > new file mode 100644 > index 00000000000..c597c660a36 > --- /dev/null > +++ b/gdb/testsuite/gdb.dwarf2/nullptr_t.exp > @@ -0,0 +1,39 @@ > +# Copyright 2022 Free Software Foundation, Inc. > + > +# This program is free software; you can redistribute it and/or modify > +# it under the terms of the GNU General Public License as published by > +# the Free Software Foundation; either version 3 of the License, or > +# (at your option) any later version. > +# > +# This program is distributed in the hope that it will be useful, > +# but WITHOUT ANY WARRANTY; without even the implied warranty of > +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the > +# GNU General Public License for more details. > +# > +# You should have received a copy of the GNU General Public License > +# along with this program. If not, see . > + > +if {[skip_cplus_tests]} { continue } > + > +standard_testfile .cc > + > +if [prepare_for_testing "failed to prepare" $testfile $srcfile {debug c++}] { > + return -1 > +} > + > +set cmd "info types -q std::nullptr_t" > + > +set re \ > + [multi_line \ > + "$cmd" \ > + "" \ > + "File .*:" \ > + "$decimal:\ttypedef decltype\\(nullptr\\) std::nullptr_t;"] > + > +with_complaints 5 { > + gdb_test $cmd $re "$cmd without complaints" > +} > + > +gdb_test "maint print symbols -source $srcfile" \ > + "typedef void decltype\\(nullptr\\); \r\n.*" \ > + "decltype(nullptr) symbol"