From: Tom de Vries <tdevries@suse.de>
To: Simon Marchi <simark@simark.ca>, gdb-patches@sourceware.org
Subject: Re: [PATCH][gdb/testsuite] Don't use default form in Dwarf::_guess_form
Date: Fri, 23 Oct 2020 18:55:34 +0200 [thread overview]
Message-ID: <1ff55edb-73a6-2483-1a70-4a8cbb3fdff4@suse.de> (raw)
In-Reply-To: <5b248ed3-29f8-75de-3aef-1986df7976cc@simark.ca>
On 10/23/20 5:12 PM, Simon Marchi wrote:
> On 2020-10-23 7:46 a.m., Tom de Vries wrote:
>> Hi,
>>
>> The only possible form for a DW_AT_low_pc attribute is DW_FORM_addr.
>>
>> When specifying in dwarf assembly a low_pc attribute without explicit form:
>> ...
>> {low_pc {main_label - 4}}
>> ...
>> the resulting attribute uses DW_FORM_string, which is misinterpreted by gdb
>> when reading it as:
>> ...
>> cu->base_address = attr->as_address ();
>> ...
>>
>> Stop using DW_FORM_string as default form. Instead, use a default form based
>> on the attribute name, if possible and unambiguous. Otherwise, error out.
>>
>> F.i.:
>> - for DW_AT_low_pc we use DW_FORM_addr.
>> - For DW_AT_high_pc, we don't specify a default form because it could be
>> either address or constant class.
>> - For DW_AT_name, we use DW_FORM_string. While we could encode with
>> DW_FORM_strp instead, DW_FORM_string is always ok.
>>
>> Tested on x86_64-linux.
>>
>> Any comments?
>>
>> Thanks,
>> - Tom
>
> I like it, I like specifying explicit forms in any case.
>
> I think it makes the "If the value looks like an integer, a form is
> required." redundant though. You could remove it, in which case
> specifying an integer attribute without a form would fall in the "No
> form for..." error branch.
Done, and committed.
Thanks,
- Tom
prev parent reply other threads:[~2020-10-23 16:55 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-23 11:46 Tom de Vries
2020-10-23 15:12 ` Simon Marchi
2020-10-23 16:55 ` Tom de Vries [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=1ff55edb-73a6-2483-1a70-4a8cbb3fdff4@suse.de \
--to=tdevries@suse.de \
--cc=gdb-patches@sourceware.org \
--cc=simark@simark.ca \
/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