From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id qPEXDSkKlGDVJQAAWB0awg (envelope-from ) for ; Thu, 06 May 2021 11:24:25 -0400 Received: by simark.ca (Postfix, from userid 112) id 334ED1F11C; Thu, 6 May 2021 11:24:25 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-0.6 required=5.0 tests=MAILING_LIST_MULTI, RDNS_DYNAMIC,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 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 72AFE1E54D for ; Thu, 6 May 2021 11:24:24 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 34D983AA9807; Thu, 6 May 2021 15:24:24 +0000 (GMT) Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by sourceware.org (Postfix) with ESMTPS id 77131388F010 for ; Thu, 6 May 2021 15:24:21 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 77131388F010 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=suse.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=tdevries@suse.de X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 8ECE6AEA8; Thu, 6 May 2021 15:24:20 +0000 (UTC) Subject: Re: [PATCH][gdb/symtab] Fix infinite recursion in dwarf2_cu::get_builder() To: Eli Zaretskii References: <20210506120247.GA1559@delia.home> <83fsyzevty.fsf@gnu.org> From: Tom de Vries Message-ID: <02160b9a-c3a0-7634-791f-28a40b1703a1@suse.de> Date: Thu, 6 May 2021 17:24:10 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.10.0 MIME-Version: 1.0 In-Reply-To: <83fsyzevty.fsf@gnu.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit 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: , Cc: tom@tromey.com, gdb-patches@sourceware.org Errors-To: gdb-patches-bounces@sourceware.org Sender: "Gdb-patches" On 5/6/21 5:16 PM, Eli Zaretskii wrote: >> Date: Thu, 6 May 2021 14:02:49 +0200 >> From: Tom de Vries >> Cc: Tom Tromey >> >> Removing this code (that is, doing SYMBOL_IS_ARGUMENT (sym) = 1 >> unconditially), fixes the crash. The ancestor variable also seems to have >> been added specifically to deal with fallout from this code, so remove that as >> well. >> >> Tested on x86_64-linux: >> - openSUSE Leap 15.2 with gcc 7.5.0, and >> - openSUSE Tumbleweed with gcc 10.3.0. >> >> Any comments? >> >> Thanks, >> - Tom >> >> [gdb/symtab] Fix infinite recursion in dwarf2_cu::get_builder() >> >> gdb/ChangeLog: >> >> 2021-05-06 Tom de Vries >> >> PR symtab/26327 >> * dwarf2/read.c (struct dwarf2_cu): Remove ancestor. >> (dwarf2_cu::get_builder): Remove ancestor-related code. >> (new_symbol): Remove code supporting pre-4.1 gcc that show arguments >> of inlined functions as locals. >> (follow_die_offset, follow_die_sig_1): Remove setting of ancestor. >> >> --- >> gdb/doc/gdb.texinfo | 4 ++-- >> gdb/dwarf2/read.c | 25 ++----------------------- >> 2 files changed, 4 insertions(+), 25 deletions(-) >> >> diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo >> index 56f37eb2288..f4d7085da58 100644 >> --- a/gdb/doc/gdb.texinfo >> +++ b/gdb/doc/gdb.texinfo >> @@ -13842,8 +13842,8 @@ when using @sc{dwarf 2}. Versions of @value{NGCC} before 4.1 >> do not emit two required attributes (@samp{DW_AT_call_file} and >> @samp{DW_AT_call_line}); @value{GDBN} does not display inlined >> function calls with earlier versions of @value{NGCC}. It instead >> -displays the arguments and local variables of inlined functions as >> -local variables in the caller. >> +displays local variables of inlined functions as local variables in >> +the caller. >> >> The body of an inlined function is directly included at its call site; >> unlike a non-inlined function, there are no instructions devoted to >> diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c > > I'm not sure I understand why you are changing the manual as part of > this fix? > Hi Eli, The 2009 commit edb3359dff90ef8a3352408bfef8ce1438c2b2e1 did this change: ... case DW_TAG_formal_parameter: - SYMBOL_IS_ARGUMENT (sym) = 1; + /* If we are inside a function, mark this as an argument. If + not, we might be looking at an argument to an inlined + function + when we do not have enough information to show inlined + frames; + pretend it's a local variable in that case so that the user + can + still see it. */ + if (context_stack_depth > 0 + && context_stack[context_stack_depth - 1].name != NULL) + SYMBOL_IS_ARGUMENT (sym) = 1; ... and described it in the documentation: ... +when using @sc{dwarf 2}. Versions of @value{NGCC} before 4.1 +do not emit two required attributes (@samp{DW_AT_call_file} and +@samp{DW_AT_call_line}); @value{GDBN} does not display inlined +function calls with earlier versions of @value{NGCC}. It instead +displays the arguments and local variables of inlined functions as +local variables in the caller. ... I'm undoing that change, and updating the documentation accordingly. Thanks, - Tom