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

David Blaikie dblaikie@gmail.com
Mon May 20 20:34:01 GMT 2024

On Thu, May 16, 2024 at 1:05 PM Martin via Dwarf-discuss <
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 with debug info (or at least a base class is in such a
> Tiny but important mistake..., it meant to write
>   uses a class/struct that is defined in a unit *WITHOUT* debug info
> > unit), then IMHO the debugger should be able to show the entire
> > structure, including fields/methods from that unit without debug info.
> > (because only the type is in the other unit, but the variable itself is
> > in a unit with 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.

- Dave
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.dwarfstd.org/pipermail/dwarf-discuss/attachments/20240520/16fbdf01/attachment.htm>

More information about the Dwarf-discuss mailing list