From: Keith Seitz <keiths@redhat.com>
To: Tom Tromey <tom@tromey.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH] Prevent inline function parameters from crashing the DWARF reader
Date: Tue, 16 Oct 2018 22:29:00 -0000 [thread overview]
Message-ID: <846fe42c-f510-bdc8-0f48-15e313e7b2a4@redhat.com> (raw)
In-Reply-To: <87o9btbkt1.fsf@tromey.com>
On 10/16/18 3:15 PM, Tom Tromey wrote:
>>>>>> "Keith" == Keith Seitz <keiths@redhat.com> writes:
>
> Keith> However, as demonstrated in this Fedora bugzilla:
> Keith> https://bugzilla.redhat.com/show_bug.cgi?id=1638798
>
> Keith> the abstract_origin of the parameter DIE may be in an entirely different
> Keith> CU. This CU will have no builder defined for it, so the call to
> Keith> get_current_context_stack is made on an uninitialized builder, and GDB
> Keith> segfaults.
>
> I was curious what happened before, so I checked out the commit
> before 804d27291b2922f01fe5cc2d9ae759533d4a2f6f, and ran it on the
> executable in that bug.
>
> I set a breakpoint conditional on curr==0 and it never hit.
>
What ends up happening, IIRC, is that we simply only ever checked (previously)
the depth level. It was 0.
> Now, I am not totally sure that this was correct before, but I suppose
> what was going on was that the earlier code was installing these symbols
> into the referencing CU's symtab.
Yeah, I was wondering about something like that, too, but had convinced myself
temporarily that this was appropriate. The immediate problem is that the
formal_parameter DIE lives in a partial_unit in its own CU.
After troubleshooting other similar problems, I'm now not so sure. [I
was coming around to another (better?) solution, see below.]
> Abstractly, at least, that seems reasonable. So maybe that approach
> should be taken again.
>
> Also, when I look at new_symbol, I see a bunch of uses of cu->builder,
> so I wonder if there are ways to make those spots crash as well.
> So maybe this indicates some different approach is needed as well.
It's not just new_symbol. It happens in other places, too, like
read_import_statement (where it calls using_directives).
> Sorry about this. I didn't anticipate this at all. I can try to take
> it over if you'd like.
So far, I'm still investigating, but from the Fedora side -- which seems
like it may be in really bad shape right now for some reason.
> Maybe one idea would be to temporarily set the referenced CU's builder
> to the referencing CU's builder somehow.
Yeah, that is an approach not too far off (I think?) from what I was
attempting: When we "import" DIEs from other CUs, I add them to an
sort of CU inheritance chain. Then we crawl up the chain looking for the
last valid builder. [This can happen frequently with DW_TAG_partial_unit
DIEs in the debuginfo.]
If I need more help, I will certainly let you know.
Let's consider this patch shelved for the moment.
Keith
prev parent reply other threads:[~2018-10-16 22:29 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-10-12 21:21 Keith Seitz
2018-10-13 18:49 ` Sergio Durigan Junior
2018-10-16 22:15 ` Tom Tromey
2018-10-16 22:29 ` Keith Seitz [this message]
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=846fe42c-f510-bdc8-0f48-15e313e7b2a4@redhat.com \
--to=keiths@redhat.com \
--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