[PATCH] [gdb] Create script to convert old tests into Dwarf::assemble calls.

Simon Marchi simark@simark.ca
Thu Dec 5 17:25:16 GMT 2024



On 2024-12-05 08:55, William Ferreira wrote:
> PR testsuite/32261 requests a script that could convert old .S-based
> tests (that were made before dwarf.exp existed) into the new
> Dwarf::assemble calls in Tcl. This commit is an initial implementation
> of such a script. Python was chosen for convenience, and only relies on
> a single external library.

Thanks for doing this.  I don't have time for a deep review right now,
but I have a few superficial comments.

I'm not sure I would put it under testsuite/lib.  This directory
contains stuff used by the tests themselves (expect code) of test
programs.  Maybe right under testsuite?  There are already two Python
utils there.

Run black and flake8.  I would suggest setting up pre-commit for that:

https://sourceware.org/gdb/wiki/DeveloperTips#Setting_up_pre-commit

However, the flake8 entry in .pre-commit-config.yml isn't properly set
up to pick up gdb/testsuite/*.py, I will try to fix that right now.


> +def main(argv):
> +    try:
> +        filename = argv[1]
> +    except IndexError:
> +        print("Usage:")
> +        print("python ./asm_to_dwarf_assembler.py <path/to/elf/file>")
> +        sys.exit(1)

You import argparse but don't use it.  Any reason not to use it?

Simon


More information about the Gdb-patches mailing list