[PATCH 3/5] objdump: Add variable types and structure for DWARF info parsing
Guillaume VACHERIAS - foss
guillaume.vacherias@foss.st.com
Wed Aug 27 11:35:24 GMT 2025
+/* Container for map info information to be generated. */ typedef
+struct base_type {
+ uint64_t die_offset;
+ uint64_t usize;
+ int64_t ssize;
+ const unsigned char *name;
I forgot to explain why the field storing attribute DW_AT_name is unsigned char *
and not plain text. It is mentioned in the DWARF Debugging Information Format
Standard that:
"Any debugging information entry representing a program entity that has been
given a name may have a DW_AT_name attribute, whose value of class string
represents the name".
Where again mentioned that a string:
" A string is a sequence of contiguous non-null bytes followed by one null
byte. A string may be represented:
- Immediately in the debugging information entry itself (DW_FORM_string),
- As an offset into a string table contained in the .debug_str section of
the object file (DW_FORM_strp), the .debug_line_str section of the
object file (DW_FORM_line_strp), or as an offset into a string table
contained in the .debug_str section of a supplementary object file
(DW_FORM_strp_sup). DW_FORM_strp_sup offsets from the
.debug_info section of a supplementary object file refer to the local
.debug_str section of that same file. In the 32-bit DWARF format, the
representation of a DW_FORM_strp, DW_FORM_line_strp or
DW_FORM_strp_sup value is a 4-byte unsigned offset; in the 64-bit
DWARF format, it is an 8-byte unsigned offset.
- As an indirect offset into the string table using an index into a table of
offsets contained in the .debug_str_offsets section of the object file
(DW_FORM_strx, DW_FORM_strx1, DW_FORM_strx2,
DW_FORM_strx3 and DW_FORM_strx4). The representation of a
DW_FORM_strx value is an unsigned LEB128 value, which is
interpreted as a zero-based index into an array of offsets in the
.debug_str_offsets section. The representation of a
DW_FORM_strx1, DW_FORM_strx2, DW_FORM_strx3 or
DW_FORM_strx4 value is a 1-, 2-, 3- or 4-byte unsigned integer value,
respectively, which is similarly interpreted. The offset entries in the
.debug_str_offsets section have the same representation as
DW_FORM_strp values. ".
Guillaume.
More information about the Binutils
mailing list