[RFC 2/4] objdump, readelf: sframe: apply relocations before textual dump

Jan Beulich jbeulich@suse.com
Thu Mar 13 14:09:13 GMT 2025


On 08.03.2025 08:38, Indu Bhagat wrote:
> PR libsframe/32589 - function start address is zero in SFrame section dump
> 
> Currently, readelf and objdump display SFrame section in object file
> with function start addresses of each function as 0.  This makes it
> difficult to correlate SFrame stack trace information with the
> individual functions in the object file.
> 
> Use the dump_dwarf () interface to dump SFrame section.  The current
> infrastructure (for DWARF debug sections) already supports relocating
> the section contents before dumping, so lets use that.
> 
> As a side effect, objdump now adds two new ways of dumping SFrame sections:
>   - objdump -WS <obj>
>   - objdump --dwarf=sframe
> We do not publicize these options.  The lone advertised user interfacing
> option (in --help) remains:
>   - objdump --sframe

How am I to understand "side effect" here? You don't need to ...

> @@ -12648,6 +12681,7 @@ static const debug_dump_long_opts debug_option_table[] =
>    /* For compatibility with earlier versions of readelf.  */
>    { 'r', "ranges", &do_debug_aranges, 1 },
>    { 's', "str", &do_debug_str, 1 },
> +  { 'S', "sframe", &do_sframe, 1 },
>    { 'T', "trace_aranges", &do_trace_aranges, 1 },
>    { 't', "pubtypes", &do_debug_pubtypes, 1 },
>    { 'U', "trace_info", &do_trace_info, 1 },

... make this and ...

> @@ -12806,6 +12841,7 @@ struct dwarf_section_display debug_displays[] =
>    { { ".debug_weaknames",   ".zdebug_weaknames",     "",	 NO_ABBREVS },	    display_debug_not_supported, NULL,		false },
>    { { ".gdb_index",	    "",			     "",	 NO_ABBREVS },	    display_gdb_index,	    &do_gdb_index,	false },
>    { { ".debug_names",	    "",			     "",	 NO_ABBREVS },	    display_debug_names,    &do_gdb_index,	false },
> +  { { ".sframe",	    "",			     "",	 NO_ABBREVS },	    display_sframe,	    &do_sframe,		true },
>    { { ".trace_info",	    "",			     "",	 ABBREV (trace_abbrev) }, display_trace_info, &do_trace_info,	true },
>    { { ".trace_abbrev",	    "",			     "",	 NO_ABBREVS },	    display_debug_abbrev,   &do_trace_abbrevs,	false },
>    { { ".trace_aranges",	    "",			     "",	 NO_ABBREVS },	    display_debug_aranges,  &do_trace_aranges,	false },

... this change, do you? Yet then that's a deliberate extra change, not
a side effect. Which in turn make me wonder why it's done, and then
deliberately without documenting the options.

Jan


More information about the Binutils mailing list