[Dwarf-discuss] Question on DW_AT_low_pc for "repeated" DW_TAG_subprogram

Martin lists@mfriebe.de
Wed May 22 10:21:33 GMT 2024

On 20/05/2024 22:34, David Blaikie via Dwarf-discuss wrote:
> On Thu, May 16, 2024 at 1:05 PM Martin via Dwarf-discuss 
> <dwarf-discuss@lists.dwarfstd.org 
> <mailto:dwarf-discuss@lists.dwarfstd.org>> wrote:
>     On 16/05/2024 21:58, Martin via Dwarf-discuss wrote:
>      >
>      > If there is code (with debug info) that uses a class/struct that is
>      > defined in a unit WITHOUT debug info (or at least a base class is
>      > in such a 
>      > unit), then IMHO the debugger should be able to show the entire
>      > structure, including fields/methods from that unit without debug
>     info.
>      >
>      > For that, the declaration of that class can be repeated. But if
>     the user
>      > then wants to call (from the debugger) a function on that (base-)
>     class,
>      > then it needs the DW_AT_low_pc?
> Oh, perhaps the easier thing is to address this question directly.
> I believe this is done with existing producers and consumers by having 
> the DW_AT_linkage_name attached to the function declaration. Hmm, just 
> tried with GDB and even if I omit the linkage name, it's able to call 
> the function - I guess by using the DWARF it has, and searching the 
> mangled names of the symbols, it can demangle them and match them up (or 
> create a mangled name from the DWARF to match that up - though that 
> might fail in some cases where the DWARF doesn't have enough info to 
> produce the matching mangled name) and it knows the return type and can 
> decode the bits to render them correctly.
> So, there's a couple of options at least.

Many thanks.

That gives indeed a couple of working options.

More information about the Dwarf-discuss mailing list