[Dwarf-Discuss] compilers generating ABI non-compliant function calls?

Jakub Jelinek jakub@redhat.com
Wed Mar 10 08:11:21 GMT 2021


On Tue, Mar 09, 2021 at 04:32:35PM -0800, David Blaikie wrote:
> Ah, OK. Hmm - do you have different call_site_parameters for registers
> versus parameters? Or I guess a call_site_parameter without a
> DW_AT_location and only a DW_AT_call_value?

Yes, those DW_TAG_call_site_parameter DIEs have DW_AT_call_parameter
and DW_AT_call_value attributes rather than DW_AT_location and
DW_AT_call_value, because there is no location for them.  And the
DW_AT_call_parameter refers to the DIE that needs to be matched by
DW_OP_GNU_parameter_ref.

> Hmm - is that "conforming" (I'm all for "DWARF provides some tools and
> here's a way we can use them to describe this situation") DWARF? I would've
> thought that there could only be one concrete instance of an abstract
> definition.

Why?  E.g. for inline function there can be thousands of them.
Yes, such copies have different assembler name, and what exactly the
consumers do with those is something some GDB folks on this list could
answer.  I never thought they would be a problem and the consumers handled
it fine.

What is known not to be handled fine are other cases, something that should
be handled somehow in DWARF6, e.g. the GCC partial inlining, OpenMP/OpenACC
regions offloaded to functions etc.
Partial inlining is where the compiler inlines some cheap part of an inline
function but decides that other part is too large/expensive to inline and so
outlines that part to a function.  Currently that outlined part of the
function also uses DW_AT_abstract_origin to point to the DIE of the whole
inline function.  The major problem is that consumers aren't told that
the entrypoint of that DIE doesn't represent entrypoint of the abstract
origin, if one places breakpoint at the start of the inline function, it
shouldn't be put at the start of this outlined function, but consumers don't
know that.
Similarly, for OpenMP/OpenACC construct bodies, various compilers outline
those regions into separate functions that are called e.g. as callbacks
by some runtime library routines.  Similarly to the partial inlining,
consumers should be told that it is not the whole function, but just a
region from them (and which one if it is possible to e.g. narrow it down
to a DW_TAG_lexical_scope in the abstract fn), but IMNSHO we also need a way
to say to the consumer what was the reason for the outlining, e.g. that it
is OpenMP parallel, teams, task or target region and similarly for OpenACC.
Then consumer can e.g. use OMPD to query some properties.

	Jakub




More information about the Dwarf-discuss mailing list