diff options
author | Tom de Vries <tdevries@suse.de> | 2021-02-26 13:30:10 +0000 |
---|---|---|
committer | Nick Clifton <nickc@redhat.com> | 2021-02-26 13:30:10 +0000 |
commit | 32e4f96ceca798ad21f344e96667de9161c0b857 (patch) | |
tree | 4a57a6080e4e19a220ffd901020c4e4f22bd2485 | |
parent | cb51b708fd7e0ba427f07b3209d0df1d9a0e3f94 (diff) | |
download | gdb-32e4f96ceca798ad21f344e96667de9161c0b857.zip gdb-32e4f96ceca798ad21f344e96667de9161c0b857.tar.gz gdb-32e4f96ceca798ad21f344e96667de9161c0b857.tar.bz2 |
Add support for the split DWARF forms.
PR 27390
* dwarf.c: (skip_attr_bytes): Add support for DW_FORM_str* and
DW_FORM_addrx*.
(read_and_display_attr_value): Likewise.
-rw-r--r-- | binutils/ChangeLog | 7 | ||||
-rw-r--r-- | binutils/dwarf.c | 63 |
2 files changed, 68 insertions, 2 deletions
diff --git a/binutils/ChangeLog b/binutils/ChangeLog index 332bf8f..a73c60d 100644 --- a/binutils/ChangeLog +++ b/binutils/ChangeLog @@ -1,3 +1,10 @@ +2021-02-26 Tom de Vries <tdevries@suse.de> + + PR 27390 + * dwarf.c: (skip_attr_bytes): Add support for DW_FORM_str* and + DW_FORM_addrx*. + (read_and_display_attr_value): Likewise. + 2021-02-25 Nick Clifton <nickc@redhat.com> * dwarf.c (get_type_abbrev_from_form): Accept but ignore sup diff --git a/binutils/dwarf.c b/binutils/dwarf.c index 3d279079..9cc51c2 100644 --- a/binutils/dwarf.c +++ b/binutils/dwarf.c @@ -2002,16 +2002,27 @@ skip_attr_bytes (unsigned long form, case DW_FORM_ref1: case DW_FORM_flag: case DW_FORM_data1: + case DW_FORM_strx1: + case DW_FORM_addrx1: SAFE_BYTE_GET_AND_INC (uvalue, data, 1, end); break; + case DW_FORM_strx3: + case DW_FORM_addrx3: + SAFE_BYTE_GET_AND_INC (uvalue, data, 3, end); + break; + case DW_FORM_ref2: case DW_FORM_data2: + case DW_FORM_strx2: + case DW_FORM_addrx2: SAFE_BYTE_GET_AND_INC (uvalue, data, 2, end); break; case DW_FORM_ref4: case DW_FORM_data4: + case DW_FORM_strx4: + case DW_FORM_addrx4: SAFE_BYTE_GET_AND_INC (uvalue, data, 4, end); break; @@ -2023,7 +2034,9 @@ skip_attr_bytes (unsigned long form, case DW_FORM_ref_udata: case DW_FORM_udata: case DW_FORM_GNU_str_index: + case DW_FORM_strx: case DW_FORM_GNU_addr_index: + case DW_FORM_addrx: READ_ULEB (uvalue, data, end); break; @@ -2480,17 +2493,28 @@ read_and_display_attr_value (unsigned long attribute, case DW_FORM_ref1: case DW_FORM_flag: case DW_FORM_data1: + case DW_FORM_strx1: + case DW_FORM_addrx1: SAFE_BYTE_GET_AND_INC (uvalue, data, 1, end); break; case DW_FORM_ref2: case DW_FORM_data2: + case DW_FORM_strx2: + case DW_FORM_addrx2: SAFE_BYTE_GET_AND_INC (uvalue, data, 2, end); break; + case DW_FORM_strx3: + case DW_FORM_addrx3: + SAFE_BYTE_GET_AND_INC (uvalue, data, 3, end); + break; + case DW_FORM_ref_sup4: case DW_FORM_ref4: case DW_FORM_data4: + case DW_FORM_strx4: + case DW_FORM_addrx4: SAFE_BYTE_GET_AND_INC (uvalue, data, 4, end); break; @@ -2500,9 +2524,11 @@ read_and_display_attr_value (unsigned long attribute, break; case DW_FORM_GNU_str_index: + case DW_FORM_strx: case DW_FORM_ref_udata: case DW_FORM_udata: case DW_FORM_GNU_addr_index: + case DW_FORM_addrx: READ_ULEB (uvalue, data, end); break; @@ -2694,6 +2720,11 @@ read_and_display_attr_value (unsigned long attribute, break; case DW_FORM_GNU_str_index: + case DW_FORM_strx: + case DW_FORM_strx1: + case DW_FORM_strx2: + case DW_FORM_strx3: + case DW_FORM_strx4: if (!do_loc) { const char * suffix = strrchr (section->name, '.'); @@ -2749,17 +2780,34 @@ read_and_display_attr_value (unsigned long attribute, break; case DW_FORM_GNU_addr_index: + case DW_FORM_addrx: + case DW_FORM_addrx1: + case DW_FORM_addrx2: + case DW_FORM_addrx3: + case DW_FORM_addrx4: if (!do_loc) { + dwarf_vma base; + dwarf_vma offset; + + if (debug_info_p == NULL) + base = 0; + else if (debug_info_p->addr_base == DEBUG_INFO_UNAVAILABLE) + base = 0; + else + base = debug_info_p->addr_base; + + offset = base + uvalue * pointer_size; + if (do_wide) /* We have already displayed the form name. */ printf (_("%c(index: 0x%s): %s"), delimiter, dwarf_vmatoa ("x", uvalue), - fetch_indexed_value (uvalue * pointer_size, pointer_size)); + fetch_indexed_value (offset, pointer_size)); else printf (_("%c(addr_index: 0x%s): %s"), delimiter, dwarf_vmatoa ("x", uvalue), - fetch_indexed_value (uvalue * pointer_size, pointer_size)); + fetch_indexed_value (offset, pointer_size)); } break; @@ -2858,6 +2906,7 @@ read_and_display_attr_value (unsigned long attribute, break; case DW_AT_GNU_addr_base: + case DW_AT_addr_base: debug_info_p->addr_base = uvalue; break; @@ -2899,6 +2948,11 @@ read_and_display_attr_value (unsigned long attribute, add_dwo_name ((const char *) fetch_alt_indirect_string (uvalue), cu_offset); break; case DW_FORM_GNU_str_index: + case DW_FORM_strx: + case DW_FORM_strx1: + case DW_FORM_strx2: + case DW_FORM_strx3: + case DW_FORM_strx4: add_dwo_name (fetch_indexed_string (uvalue, this_set, offset_size, FALSE), cu_offset); break; case DW_FORM_string: @@ -2926,6 +2980,11 @@ read_and_display_attr_value (unsigned long attribute, add_dwo_dir ((const char *) fetch_indirect_line_string (uvalue), cu_offset); break; case DW_FORM_GNU_str_index: + case DW_FORM_strx: + case DW_FORM_strx1: + case DW_FORM_strx2: + case DW_FORM_strx3: + case DW_FORM_strx4: add_dwo_dir (fetch_indexed_string (uvalue, this_set, offset_size, FALSE), cu_offset); break; case DW_FORM_string: |