On 3/9/21 7:13 AM, Frank Ch. Eigler via Dwarf-Discuss wrote:
As I understand it, the location of*function return values* is however a gap in DWARF, and a consumer tool must resort to ABI specs. (Thus the elfutils dwfl_module_return_value_location() function.) I'm sure there's a Reason for this, but having worked on a consumer, it'd be handy if DWARF did explicitly identify the return value location too.
DWARF does not duplicate information which is documented in the ABI or in other information which is shared by compilers and debuggers. For example, DWARF does not describe the calling convention for a function. Producers and consumers are expected to know this info. The rationale is that duplicating shared ABI knowledge would greatly increase the size of a debug file, while not improving the ability to debug a program. For example, DWARF describes the arguments to a function. It doesn't describe the calling convention, which registers are preserved, which are clobbered, or anything else which is specified by the ABI. In most ABIs, the location of a function return value is similarly constrained. If there are multiple calling conventions, this is identified to allow a debugger to generate a valid call to a function. DWARF only contains information which describes what a compiler generates which cannot be unambiguous determined by knowledge of the ABI. A limited exception is the CFI, which in many cases mirrors the ABI. If there are occasions when a compiler might place a function return value in a variety of different locations, not constrained by the ABI, a DWARF attribute might be useful. -- Michael Eager _______________________________________________ Dwarf-Discuss mailing list Dwarf-Discuss@lists.dwarfstd.org http://lists.dwarfstd.org/listinfo.cgi/dwarf-discuss-dwarfstd.org