[PATCH v3] binutils/dwarf: Print embedded source, when available
Jan Beulich
jbeulich@suse.com
Wed Apr 22 05:58:41 GMT 2026
On 22.04.2026 02:26, Will Hawkins wrote:
> On Tue, Apr 21, 2026 at 12:03 PM Jan Beulich <jbeulich@suse.com> wrote:
>> On 21.04.2026 04:02, Will Hawkins wrote:
>>> @@ -5861,8 +5865,10 @@ display_formatted_table (unsigned char *data,
>>> unsigned char *datapass = data;
>>>
>>> printf (" %d", last_entry++);
>>> - /* Delay displaying name as the last entry for better screen layout. */
>>> - for (namepass = 0; namepass < 2; namepass++)
>>> + /* Delay displaying name/source as the last entry for better screen
>>> + layout. */
>>> + int namesourcepass;
>>> + for (namesourcepass = 0; namesourcepass < 3; namesourcepass++)
>>
>> for (unsigned int namesourcepass = 0; namesourcepass < 3; namesourcepass++)
>>
>> (suitably line wrapped if necessary)
>
> I surely would have written it the way that you suggested. However,
> when I looked through existing code, I did not see any formatted this
> way. I assumed that was because of an interest in maintaining
> compatibility with C89. I will absolutely make the update, of course,
> but I just wanted to make sure you knew that I was trying my best to
> follow the project's standards.
There may not be examples in this particular file, but after we switched
to C99, examples have appeared in various places of the codebase.
>>> @@ -5872,13 +5878,31 @@ display_formatted_table (unsigned char *data,
>>>
>>> READ_ULEB (content_type, format, end);
>>> READ_ULEB (form, format, end);
>>> - bool do_loc = (content_type == DW_LNCT_path) != (namepass == 1);
>>> +
>>> + bool do_loc = (content_type == DW_LNCT_path)
>>> + != (namesourcepass == 1);
>>> + do_loc |= (content_type == DW_LNCT_LLVM_source
>>> + || content_type == DW_LNCT_source)
>>> + != (namesourcepass == 2);
>>
>> Indentation is better now that it (iirc) was in v1, but it's still not
>> quite right. Binary operators wrapped to the next line want to align
>> with the corresponding part of the expression on the earlier line. At
>> the example ...
>
> I will gladly fix! I was also wondering: These expressions are hard to
> grok. I found the meaning hard to identify even in the existing code.
> With the additional elements, it now seems like it might be a good
> idea to expand into an if statement? I'd love feedback!
Personally I prefer as-is (I'd even go as far as combining decl and
statement into just a decl), but of course this is entirely subjective.
Jan
More information about the Binutils
mailing list