[PATCH] binutils/dwarf: Print embedded source, when available
Jan Beulich
jbeulich@suse.com
Thu Apr 16 15:06:21 GMT 2026
On 16.04.2026 16:56, Will Hawkins wrote:
> On Thu, Apr 16, 2026 at 10:47 AM Jan Beulich <jbeulich@suse.com> wrote:
>> On 16.04.2026 16:21, Will Hawkins wrote:
>>> @@ -5872,13 +5876,29 @@ 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)
>>> + != (namesourcepass == 2);
>>> +
>>> + char delimiter = '\t';
>>> +
>>> + /* Print Source last (if available) and print it
>>> + starting on the next line. */
>>> + if (namesourcepass == 2 && content_type == DW_LNCT_LLVM_source)
>>
>> DW_LNCT_LLVM_source being in the DW_LNCT_{lo,hi}_user range, how do you
>> know here that 0x2001 actually means DW_LNCT_LLVM_source?
>>
>
> The literal comes from
> https://github.com/llvm/llvm-project/blob/main/llvm/include/llvm/BinaryFormat/Dwarf.def#L1213
>
> I chose to use that one because clang is the most popular compiler
> that implements this feature and I was hoping for as much
> compatibility as possible.
>
> However, its value in v6 will be 0x6
> (https://dwarfstd.org/issues/180201.1.html).
And its name will be DW_LNCT_source. No LLVM in there. And no need for
disambiguation of the value (once Dwarf6 is finalized).
> We could consider using both? I have been working with this feature in
> lldb and would be more than happy to submit a patch there that changes
> it to use 0x6. Of course, there will likely need to be some support
> for backwards compatibility (assuming that there are binaries in the
> wild using 0x2001).
Sure, yet that won't eliminate the need to disambiguate LLVM's use of
0x2001 from any one else's.
Jan
More information about the Binutils
mailing list