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

Martin dwarf@mfriebe.de
Thu May 16 14:10:02 GMT 2024

If a compiler adds a DW_TAG_subprogram for a routine from a different 
compilation unit ...
Maybe because
- the other CU has no debug info
- The compiler does not support referencing cross CU

Would there be any reason why the compiler would not be allowed to 
include a  DW_AT_low_pc  for that routine (if the compiler has the address)?

In the concrete example the compiler in question (on some platforms, due 
to afaik linker restrictions) repeats any structure definitions from 
other CU, if they are needed as base classes for inheritance). But that 
is just background on why (afaik) this situation exists.

The only such reason that I can find (if I didn't miss any) is in 
chapter 3.3.3 on "subroutine declaration". The complier in question does 
not add a DW_AT_declaration though.

 > 3.3.3 Subroutine and Entry Point Locations
 > ...
 > A subroutine entry representing a subroutine declaration that is not 
also a definition does not have code address or range attributes.

If such a "repeated" subroutine would somehow fall into that category, 
how could the routines address be communicated to the debugger?

More information about the Dwarf-discuss mailing list