diff options
author | Tom de Vries <tdevries@suse.de> | 2020-10-23 18:49:48 +0200 |
---|---|---|
committer | Tom de Vries <tdevries@suse.de> | 2020-10-23 18:49:48 +0200 |
commit | 7d72802bfc3fc52fe0f35854694941c9534e0bcb (patch) | |
tree | 2acdb665d7d85b2b6a168d142548afb7528f0600 /gdb/dummy-frame.c | |
parent | 9476b583cb3e72e57355f5a6bfcd5ba69e71ea31 (diff) | |
download | binutils-7d72802bfc3fc52fe0f35854694941c9534e0bcb.zip binutils-7d72802bfc3fc52fe0f35854694941c9534e0bcb.tar.gz binutils-7d72802bfc3fc52fe0f35854694941c9534e0bcb.tar.bz2 |
[gdb/testsuite] Don't use default form in Dwarf::_guess_form
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.
gdb/testsuite/ChangeLog:
2020-10-23 Tom de Vries <tdevries@suse.de>
* lib/dwarf.exp (Dwarf::_guess_form): Return "" by default instead of
DW_FORM_string.
(Dwarf::_default_form): New proc.
(Dwarf::_handle_DW_TAG): Use _default_form. Error out if no form was
guessed.
Diffstat (limited to 'gdb/dummy-frame.c')
0 files changed, 0 insertions, 0 deletions