[PATCH] readelf: objdump: sframe: fix dumping with section name

Jan Beulich jbeulich@suse.com
Wed Jul 23 05:53:35 GMT 2025


On 23.07.2025 06:16, Indu Bhagat wrote:
> On 7/22/25 12:41 AM, Jan Beulich wrote:
>> On 20.07.2025 07:34, Indu Bhagat via Binutils wrote:
>>> @@ -17502,6 +17503,8 @@ display_debug_section (int shndx, Elf_Internal_Shdr * section, Filedata * fileda
>>>   
>>>   	  if (i == line && startswith (name, ".debug_line."))
>>
>> ... i is used here instead, and hence I'd like to ask that you use ...
>>
>>>   	    sec->name = name;
>>> +	  else if (i == sframe && section->sh_type == SHT_GNU_SFRAME)
>>
>> ... id here.
> 
> Earlier in the function display_debug_section (), it does a :
>        enum dwarf_section_display_enum  id = (enum 
> dwarf_section_display_enum) i;

Just to clarify: The above is exactly why I'm asking that you use id. If
we have a properly typed variable, we should also use it. It's pretty
clearly for this reason that this extra (and otherwise redundant) variable
was added.

> But I can change the code to use id for the two checks you point to above.

I wouldn't insist on you also altering the existing questionable use; all
I'm asking is that we at least not extend this bad example by adding
another one.

Jan


More information about the Binutils mailing list