From: Simon Marchi <simark@simark.ca>
To: Tom de Vries <tdevries@suse.de>, gdb-patches@sourceware.org
Subject: Re: [PATCH][gdb/testsuite] Don't use default form in Dwarf::_guess_form
Date: Fri, 23 Oct 2020 11:12:09 -0400 [thread overview]
Message-ID: <5b248ed3-29f8-75de-3aef-1986df7976cc@simark.ca> (raw)
In-Reply-To: <20201023114652.GA26275@delia>
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.
Simon
next prev parent reply other threads:[~2020-10-23 15:12 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 [this message]
2020-10-23 16: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=5b248ed3-29f8-75de-3aef-1986df7976cc@simark.ca \
--to=simark@simark.ca \
--cc=gdb-patches@sourceware.org \
--cc=tdevries@suse.de \
/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