diff options
| author | Tom de Vries <tdevries@suse.de> | 2025-10-22 07:28:45 +0200 |
|---|---|---|
| committer | Tom de Vries <tdevries@suse.de> | 2025-10-22 07:28:45 +0200 |
| commit | 24c1871a045f7d6b331ad2130e0a2353b6daf276 (patch) | |
| tree | d7150a525ad6db2fd02bfa39d81501169c79903a /gdb/contrib/dwarf-to-dwarf-assembler.py | |
| parent | 50a07b4a1f3c0819ee42a44a8e61ab2da2b92e41 (diff) | |
| download | binutils-24c1871a045f7d6b331ad2130e0a2353b6daf276.zip binutils-24c1871a045f7d6b331ad2130e0a2353b6daf276.tar.gz binutils-24c1871a045f7d6b331ad2130e0a2353b6daf276.tar.bz2 | |
[gdb/contrib] Handle unknown attribute in dwarf-to-dwarf-assembler.py
I ran gdb/contrib/dwarf-to-dwarf-assembler.py on a hello world compiled with
gcc 15, and ran into:
...
Traceback (most recent call last):
File "/data/vries/gdb/./src/gdb/contrib/dwarf-to-dwarf-assembler.py", line 642, in <module>
main(sys.argv)
~~~~^^^^^^^^^^
File "/data/vries/gdb/./src/gdb/contrib/dwarf-to-dwarf-assembler.py", line 638, in main
generator.generate()
~~~~~~~~~~~~~~~~~~^^
File "/data/vries/gdb/./src/gdb/contrib/dwarf-to-dwarf-assembler.py", line 610, in generate
self.generate_die(die, indent_count)
~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^
File "/data/vries/gdb/./src/gdb/contrib/dwarf-to-dwarf-assembler.py", line 589, in generate_die
die_lines = die.format(self.dwarf_parser.offset_to_die, indent_count)
File "/data/vries/gdb/./src/gdb/contrib/dwarf-to-dwarf-assembler.py", line 279, in format
return "\n".join(self.format_lines(offset_die_lookup, indent_count))
~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/data/vries/gdb/./src/gdb/contrib/dwarf-to-dwarf-assembler.py", line 376, in format_lines
inner_lines = super().format_lines(offset_die_lookup, indent_count + 1)
File "/data/vries/gdb/./src/gdb/contrib/dwarf-to-dwarf-assembler.py", line 251, in format_lines
attr_line = attr.format(
offset_die_lookup, indent_count=indent_count + 1
)
File "/data/vries/gdb/./src/gdb/contrib/dwarf-to-dwarf-assembler.py", line 199, in format
s += self.name + " "
~~~~~~~~~~^~~~~
TypeError: unsupported operand type(s) for +: 'int' and 'str'
...
because of trying to print DWARF v6 attributes DW_AT_language_name (0x90) and
DW_AT_language_version (0x91).
Fix this by printing the number if the name is not known:
...
{DW_AT_0x90 3 DW_FORM_data1}
{DW_AT_0x91 202311 DW_FORM_data4}
...
Diffstat (limited to 'gdb/contrib/dwarf-to-dwarf-assembler.py')
| -rwxr-xr-x | gdb/contrib/dwarf-to-dwarf-assembler.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/gdb/contrib/dwarf-to-dwarf-assembler.py b/gdb/contrib/dwarf-to-dwarf-assembler.py index cf00be0..58fb6cb 100755 --- a/gdb/contrib/dwarf-to-dwarf-assembler.py +++ b/gdb/contrib/dwarf-to-dwarf-assembler.py @@ -196,7 +196,11 @@ class DWARFAttribute: applicable. """ s = lbrace - s += self.name + " " + if isinstance(self.name, int): + s += "DW_AT_" + hex(self.name) + else: + s += self.name + s += " " s += self._format_value(offset_die_lookup) # Only explicitly state form if it's not a reference. |
