From: Tom de Vries <tdevries@suse.de>
To: Eli Zaretskii <eliz@gnu.org>
Cc: tom@tromey.com, gdb-patches@sourceware.org
Subject: Re: [PATCH][gdb/symtab] Fix infinite recursion in dwarf2_cu::get_builder()
Date: Thu, 6 May 2021 17:24:10 +0200 [thread overview]
Message-ID: <02160b9a-c3a0-7634-791f-28a40b1703a1@suse.de> (raw)
In-Reply-To: <83fsyzevty.fsf@gnu.org>
On 5/6/21 5:16 PM, Eli Zaretskii wrote:
>> Date: Thu, 6 May 2021 14:02:49 +0200
>> From: Tom de Vries <tdevries@suse.de>
>> Cc: Tom Tromey <tom@tromey.com>
>>
>> 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 <tdevries@suse.de>
>>
>> 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
next prev parent reply other threads:[~2021-05-06 15:24 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-06 12:02 Tom de Vries
2021-05-06 15:16 ` Eli Zaretskii via Gdb-patches
2021-05-06 15:24 ` Tom de Vries [this message]
2021-05-06 15:42 ` Eli Zaretskii via Gdb-patches
2021-05-06 15:23 ` Simon Marchi via Gdb-patches
2021-05-12 13:20 ` Tom de Vries
2021-05-12 13:55 ` Tom de Vries
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=02160b9a-c3a0-7634-791f-28a40b1703a1@suse.de \
--to=tdevries@suse.de \
--cc=eliz@gnu.org \
--cc=gdb-patches@sourceware.org \
--cc=tom@tromey.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox