]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit
[gdb/contrib] Avoid NotImplementedError in dwarf-to-dwarf-assembler.py
authorTom de Vries <tdevries@suse.de>
Mon, 9 Mar 2026 15:13:02 +0000 (16:13 +0100)
committerTom de Vries <tdevries@suse.de>
Mon, 9 Mar 2026 15:13:02 +0000 (16:13 +0100)
commit092f2f12ee886e7e95f0f643a3284f52be21eea3
treec0b5f960f2127b32cf21fd9489f272dfa84d9498
parentefe29b903865047b7989d7222fad5c34d2e72b36
[gdb/contrib] Avoid NotImplementedError in dwarf-to-dwarf-assembler.py

The previous commit mentions:
...
      File "dwarf-to-dwarf-assembler.py", line 173, in _format_value
        raise NotImplementedError(f"Unknown data type: {type(self.value)}")
    NotImplementedError: Unknown data type: <class 'elftools.construct.lib.container.ListContainer'>
...

While the NotImplementedError makes its point clear, it's unhelpful in two ways:
- it's hard to find out what part of the input causes the error, and
- it may be that the user is not interested at all in the bit triggering the
  error, but some part after it, and the error prevents the user from seeing it

Fix this by returning an error string instead of raising an error, resulting in this output:
...
  DW_AT_upper_bound Unknown data type: <class 'elftools.construct.lib.container.ListContainer'>: \
    [255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255] DW_FORM_data16
...

Approved-By: Tom Tromey <tom@tromey.com>
gdb/contrib/dwarf-to-dwarf-assembler.py