[PATCH v6 0/5] Objdump: New feature display of global variable info based on DWARF info section
Jan Beulich
jbeulich@suse.com
Fri Nov 21 13:13:47 GMT 2025
On 21.11.2025 13:51, Guillaume VACHERIAS wrote:
> Following Nick's reply, I'm submitting a v6 version of this feature. I think I
> have covered all the comments on the last review!
You didn't Cc Nick, though. I think he may want to take over from here on.
Jan
> Changes since v1:
> - Added new prerequisite patch to better handle call and use sites.
> - Change function process_debug_info arguments bool to unsigned int.
> - Change option name to "--map-global-vars" instead of "-Y/--map-file".
> - Added information on DWARF dependencues of this option.
> - Correct switch-case braces alignment.
> - Correct type of structure container field holding DW_AT_name from
> (unsigned char *) to plain text (char *).
> - Change to sizeof (<expression>) to avoid risk of variable's types being
> changed.
> - Replace error messages with asserts.
> - Rename enumeration identifier UNKNOWN to UNKNWON_TYPE to be less generic.
> - Remove unnecessary typedef aliases.
>
> Changes since v2:
> - Fix defines DO_LOC and DO_TYPES values to lower-case x-exes.
> - Correctly set and clear do_flags anew.
> - Remove unnecessary parenthesis.
>
> Changes since v3:
> - Introduce `generic_type` structure which generalize all structure
> containers. `generic_type` will serve as linked list to contain different type
> of DWARF informaation.
> - Introduce `generic_type_l` structure for element insertion at tail of list.
> - Use tail and head pointers as well for enumeration and subrange contents.
> - Changed get_or_create_<structure> as well as free_<structure> function to
> match with new structure `generic_type`.
> - Changed objdump.exp test to ensure that DWARF2 is used and order of display
> of information does not matter.
>
> Changes since v4:
> - Test in binutils/testsuite/binutils-all/objdump.exp leverage order
> dependance of output matching.
>
> Changes since v5:
> - Modified `generic_type` to use it as a field to access a variable's
> underlying type.
> - Added enum `field_type` in each structure container to make manipulation
> easier when linking underlying types of a variable.
> - Added enum `size_type` to differentiate unsigned and signed value for type
> size and use the union structure to separate unsigned size and signed size
> value.
> - Introduce `base_type_l`, `type_def_l`, `enum_type_l`, `tab_type_l`,
> `type_ptr_l`, `type_ref_l`, `member_parent_l` and `variable_type_l` as
> container of head and tail linked list of `base_type`, ..., `variable_type` to
> speed up element insertion.
> - Use `base_type`, ..., `variable_type` instead of `generic_type` since we may
> be allocating very many of `generic_type` which is potentially more wasteful.
> - Reorder field placement in structures to avoid unnecessary padding holes.
> - Added field `is_specification` and `is_abtract_origin` in structure
> `variable_type` to treat when DW_TAG_variable has DW_AT_specification or
> DW_AT_abstract_origin, where it can have missing attribute such as
> DW_AT_name.
> - Similarly added field is_declaration in `member_parent` for
> DW_AT_declaration.
>
> Thanks for reviewing!
>
> Regards,
> Guillaume
>
> Guillaume VACHERIAS (5):
> Add suitable defines to use at call and use sites
> objdump: New feature display of global variable information based on
> DWARF info section
> objdump: Add variable types and structure for DWARF info parsing
> objdump: Link and display all variables information
> objdump: Add test on option --map-global-vars display global variable
> information
>
> binutils/doc/binutils.texi | 7 +
> binutils/dwarf.c | 1793 ++++++++++++++++-
> binutils/dwarf.h | 256 +++
> binutils/objdump.c | 76 +-
> .../binutils-all/objdump-map-global-vars.c | 48 +
> binutils/testsuite/binutils-all/objdump.exp | 74 +
> .../binutils-all/objdump.map-global-vars | 86 +
> 7 files changed, 2282 insertions(+), 58 deletions(-)
> create mode 100644 binutils/testsuite/binutils-all/objdump-map-global-vars.c
> create mode 100644 binutils/testsuite/binutils-all/objdump.map-global-vars
>
More information about the Binutils
mailing list