This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [RFA/DWARF] constant class of DW_AT_high_pc is offset for version >=4 only.
- From: Joel Brobecker <brobecker at adacore dot com>
- To: Mark Wielaard <mjw at redhat dot com>
- Cc: gdb-patches at sourceware dot org
- Date: Mon, 17 Feb 2014 10:19:29 +0100
- Subject: Re: [RFA/DWARF] constant class of DW_AT_high_pc is offset for version >=4 only.
- Authentication-results: sourceware.org; auth=none
- References: <1392478818-30320-1-git-send-email-brobecker at adacore dot com> <1392578342 dot 21975 dot 12 dot camel at bordewijk dot wildebeest dot org>
Hi Mark,
> Sorry about that. I read the spec as disallowing anything except
> DW_FORM_addr to encode class address. And since before DWARF4
> DW_AT_high_pc only allowed class address it hadn't occurred to me that
> it could have been encoded differently. I do think this really is a bug
> in the compiler that generated this.
Not to worry! I did find the use of data4 for a high_pc to be unusual,
for sure, and had to read the DWARF standard a couple of times to make
sure there was no such restriction. I'm pretty sure that I would have
made the same decision.
> > This patch fixes it by ammending a bit the changes from the commit
> > mentioned above to use the new interpretation of a relative address
> > only when the CU's DWARF version is 4 or greater.
>
> That should work fine. GCC at least doesn't generate DW_AT_high_pc
> attributes as offsets (constant class) unless it generates DWARF4+.
Yes, I forgot to mention that I double-checked that it wouldn't
break GCC-compiled binaries.
Thanks!
--
Joel
PS: Since I have you - do you think binutils would need the same
sort of change? I thought so too, when I looked at the code,
but I couldn't get readelf to print the wrong address. Do you
happen to know?