[gdb/contrib] Handle DW_FORM_data16 in dwarf-to-dwarf-assembler.py

I ran gdb/contrib/dwarf-to-dwarf-assembler.py on testsuite executable
gdb.ada/task_bp/foo, and ran into:
...
Traceback (most recent call last):
  File "dwarf-to-dwarf-assembler.py", line 660, in <module>
    main(sys.argv)
    ~~~~^^^^^^^^^^
  File "dwarf-to-dwarf-assembler.py", line 656, in main
    generator.generate()
    ~~~~~~~~~~~~~~~~~~^^
  File "dwarf-to-dwarf-assembler.py", line 628, in generate
    self.generate_die(die, indent_count)
    ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^
  File "dwarf-to-dwarf-assembler.py", line 607, in generate_die
    die_lines = die.format(self.dwarf_parser.offset_to_die, indent_count)
  File "dwarf-to-dwarf-assembler.py", line 297, in format
    return "\n".join(self.format_lines(offset_die_lookup, indent_count))
                     ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "dwarf-to-dwarf-assembler.py", line 394, in format_lines
    inner_lines = super().format_lines(offset_die_lookup, indent_count + 1)
  File "dwarf-to-dwarf-assembler.py", line 285, in format_lines
    child_lines = child.format_lines(
        offset_die_lookup, indent_count=indent_count + 1
    )
  File "dwarf-to-dwarf-assembler.py", line 269, in format_lines
    attr_line = attr.format(
        offset_die_lookup, indent_count=indent_count + 1
    )
  File "dwarf-to-dwarf-assembler.py", line 219, in format
    s += self._format_value(offset_die_lookup)
         ~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^
  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'>
...
when trying to print the DW_FORM_data16 constant for this upper bound:
...
 <1><3af88>: Abbrev Number: 47 (DW_TAG_subrange_type)
    <3af89>   DW_AT_lower_bound : 0
    <3af89>   DW_AT_upper_bound : 0xffffffffffffffffffffffffffffffff
    <3af99>   DW_AT_name        : system__put_images__lll_integer_images__unsigned_typeXn
...

Fix this by handling elftools.construct.lib.container.ListContainer.

Approved-By: Tom Tromey <tom@tromey.com>
1 file changed