From: Kevin Buettner <kevinb@redhat.com>
To: gdb-patches@sourceware.org
Subject: Re: [PATCH] dwarf2read.c: Check type of linkage name attribute prior to decoding
Date: Tue, 04 Aug 2015 00:02:00 -0000 [thread overview]
Message-ID: <20150803170242.40de4e22@pinnacle.lan> (raw)
In-Reply-To: <CADPb22Q7ZJKr8KVnntC21OX3T4J=uLzfKK8=2q0+TBvkq6nvMw@mail.gmail.com>
On Mon, 3 Aug 2015 16:31:08 -0700
Doug Evans <dje@google.com> wrote:
> On Mon, Aug 3, 2015 at 3:47 PM, Kevin Buettner <kevinb@redhat.com> wrote:
>
> >
> > * gdb.dwarf2/dw2-bad-mips-linkage-name.S: New file.
> > * gdb.dwarf2/dw2-bad-mips-linkage-name.exp: New file.
>
> If I wanted to regenerate the .S how would I do it?
> [generated .S files needs such instructions]
You wouldn't, at least not easily.
I used a circa 2010 mips-elf toolchain to create a .S file which I
then modified by hand, both removing sections not relevant to the test
as well as adding in a reference to the DW_AT_MIPS_linkage_name
attribute that's not a string.
> I wonder, though, if this is a good place for using the dwarf assembler.
> Seems so. We just need a MIPS_linkage_name attribute
> that isn't a string. The dwarf assembler test would be a lot
> smaller.
Thanks for the suggestion. I'll look into this.
> > diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
> > index 24a4022..9eb7cbc 100644
> > --- a/gdb/dwarf2read.c
> > +++ b/gdb/dwarf2read.c
> > @@ -8722,7 +8722,10 @@ dwarf2_physname (const char *name, struct die_info *die, struct dwarf2_cu *cu)
> >
> > /* DW_AT_linkage_name is missing in some cases - depend on what GDB
> > has computed. */
> > - if (attr && DW_STRING (attr))
> > + if (attr
> > + && (attr->form == DW_FORM_strp || attr->form == DW_FORM_string
> > + || attr->form == DW_FORM_GNU_strp_alt)
> > + && DW_STRING (attr))
> > {
> > char *demangled;
>
> One thought that comes to mind is that gdb should protect itself
> from all such mistakes.
>
> What if there was a wrapper on dwarf2_attr, dwarf2_string_attr
> or some such, and it returned either the attribute (if the attribute
> is present *and* is a string) or NULL.
> And if the attribute is present but not a string it logs a
> complaint (standard bad debug info complaint) and returns NULL.
Sounds reasonable. I'll take a look at this too.
Kevin
next prev parent reply other threads:[~2015-08-04 0:02 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-08-03 22:47 Kevin Buettner
2015-08-03 23:31 ` Doug Evans
2015-08-04 0:02 ` Kevin Buettner [this message]
2015-08-07 2:03 ` Kevin Buettner
2015-08-17 20:38 ` Kevin Buettner
2015-08-17 22:45 Doug Evans
2015-08-19 18:54 ` Kevin Buettner
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=20150803170242.40de4e22@pinnacle.lan \
--to=kevinb@redhat.com \
--cc=gdb-patches@sourceware.org \
/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