From: Tom de Vries <tdevries@suse.de>
To: William Ferreira <wqferr@gmail.com>, gdb-patches@sourceware.org
Subject: Re: [PATCH v3] [gdb] Create script to convert old tests into Dwarf::assemble calls.
Date: Thu, 16 Oct 2025 09:14:51 +0200 [thread overview]
Message-ID: <a8d6d380-9687-49a8-988a-13707e4f9bf7@suse.de> (raw)
In-Reply-To: <20251012211555.8103-1-wqferr@gmail.com>
On 10/12/25 11:15 PM, William Ferreira wrote:
> + Regarding DW_FORM_exprloc and DW_FORM_block:
> + The form is replaced with SPECIAL_expr.
> + The entries in the value are interpreted and decoded using the
> + dwarf_operations dictionary, and replaced with their names where
> + applicable.
> + """
> + s = lbrace
> + s += self.name + " "
> + s += self._format_value(offset_die_lookup)
I tried out the script with a test-case I'm about to commit, and ran into:
...
Traceback (most recent call last):
File
"/data/vries/gdb/binutils-gdb.git/./gdb/contrib/dwarf-to-dwarf-assembler.py",
line 680, in <module>
main(sys.argv)
~~~~^^^^^^^^^^
File
"/data/vries/gdb/binutils-gdb.git/./gdb/contrib/dwarf-to-dwarf-assembler.py",
line 676, in main
generator.generate()
~~~~~~~~~~~~~~~~~~^^
File
"/data/vries/gdb/binutils-gdb.git/./gdb/contrib/dwarf-to-dwarf-assembler.py",
line 651, in generate
self.generate_die(die, indent_count)
~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^
File
"/data/vries/gdb/binutils-gdb.git/./gdb/contrib/dwarf-to-dwarf-assembler.py",
line 630, in generate_die
die_lines = die.format(self.dwarf_parser.offset_to_die, indent_count)
File
"/data/vries/gdb/binutils-gdb.git/./gdb/contrib/dwarf-to-dwarf-assembler.py",
line 303, in format
return "\n".join(self.format_lines(offset_die_lookup, indent_count))
~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File
"/data/vries/gdb/binutils-gdb.git/./gdb/contrib/dwarf-to-dwarf-assembler.py",
line 405, in format_lines
inner_lines = super().format_lines(
offset_die_lookup,
indent_count + 1
)
File
"/data/vries/gdb/binutils-gdb.git/./gdb/contrib/dwarf-to-dwarf-assembler.py",
line 271, in format_lines
attr_line = attr.format(
offset_die_lookup,
indent_count=indent_count + 1
)
File
"/data/vries/gdb/binutils-gdb.git/./gdb/contrib/dwarf-to-dwarf-assembler.py",
line 205, in format
s += self.name + " "
~~~~~~~~~~^~~~~
TypeError: unsupported operand type(s) for +: 'int' and 'str'
...
The problem is that gcc 15 is using dwarf6 attribute DW_AT_language_name
with value 144 (0x90), which is unknown to the script.
Using this patch:
...
diff --git a/gdb/contrib/dwarf-to-dwarf-assembler.py
b/gdb/contrib/dwarf-to-dwarf-assembler.py
index 4d545cf4b13..13df3c78345 100755
--- a/gdb/contrib/dwarf-to-dwarf-assembler.py
+++ b/gdb/contrib/dwarf-to-dwarf-assembler.py
@@ -202,7 +202,11 @@ class DWARFAttribute:
applicable.
"""
s = lbrace
- s += self.name + " "
+ if isinstance(self.name, int):
+ s += "DW_AT_" + str(self.name)
+ else:
+ s += self.name
+ s += " "
s += self._format_value(offset_die_lookup)
# Only explicitly state form if it's not a reference.
...
I get:
...
{DW_AT_language 33 DW_FORM_data1}
{DW_AT_144 4 DW_FORM_data1}
{DW_AT_145 201703 DW_FORM_data4}
{DW_AT_name
/data/vries/gdb/src/gdb/testsuite/gdb.cp/pretty-print.cc DW_FORM_line_strp}
...
I haven't looked at whether that output makes sense with the dwarf
assembler, perhaps there's a better way, but at least this allows the
script to finish and makes it reasonably clear what the situation is.
Thanks,
- Tom
next prev parent reply other threads:[~2025-10-16 7:15 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-12 21:15 William Ferreira
2025-10-15 20:50 ` Tom Tromey
2025-10-15 21:10 ` William Ferreira
2025-10-16 15:52 ` Tom Tromey
2025-10-16 6:47 ` Tom de Vries
2025-10-16 7:14 ` Tom de Vries [this message]
2025-10-16 15:55 ` Tom Tromey
2025-10-20 20:52 ` William Ferreira
2025-10-21 17:17 ` Tom Tromey
2025-10-21 19:18 ` 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=a8d6d380-9687-49a8-988a-13707e4f9bf7@suse.de \
--to=tdevries@suse.de \
--cc=gdb-patches@sourceware.org \
--cc=wqferr@gmail.com \
/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