[Dwarf-Discuss] Fw: Extending calling convention information in DWARF output for x86

Michael Eager eager@eagerm.com
Wed Jun 6 15:29:46 GMT 2012


On 06/06/2012 06:40 AM, Roger Cruz wrote:

Adding dwarf-discuss@ to CC.

>
> I am interested in parsing DWARF debug output in order to know the calling convention of each
> function.  Reading the spec for DWARF-4, I can see that there is an attribute
> DW_AT_calling_convention but its only defined values are (pg 52):
>
> DW_CC_normal
 > DW_CC_program
 > DW_CC_nocall

The DW_CC_nocall attribute are used tell a debugger that the common calling conventions,
say for saving/restoring registers or passing arguments, are not being followed,
for example, by a function which is intended to be called as an interrupt handler.

Almost everything about calling functions is described in DWARF, including
where the arguments are saved and how to unwind the stack.

What are you trying to describe?

> The spec also allows compilers to generate their own extensions (pg 153) which can be used to
> enhanced that attribute's information.

Yes, DWARF can add extensions.

> My questions are:  Is there a way to coax GCC to use these extensions to spell out the calling
> convention for each function for an x86 target?  If not, has anyone added these extensions for
> other targets which I can use to add support for x86?  Can someone estimate how big of an effort
> it would be for someone who has no knowledge of GCC's internals but may be able to use another
> target as a template?

What do you mean by "calling conventions"?   What information do you want that is not available?

The general answer to the question "how much effort for someone who doesn't know GCC internals"
is "lots".

-- 
Michael Eager	 eager at eagercon.com
1960 Park Blvd., Palo Alto, CA 94306  650-325-8077




More information about the Dwarf-discuss mailing list