[Dwarf-Discuss] Query re DWARF, Ada (GNAT), and "in", "out, "in out" parameters

Wallace, John John.Wallace at goodrich.com
Mon May 17 09:33:45 PDT 2010

This note attempts to ask a question which relates to DWARF and Ada/gcc
(specifically, GNAT Ada), as they are today (DWARF V3, and here we're
looking at GCC V4.4 or so) and perhaps at DWARF and Ada/gcc as they may
be before too long - e.g. I note that DWARF V4 is out for review. Please
accept my apologies if this isn't the right place to start with this
question, but it looked promising (to someone new to DWARF and modern
compilers in general).

I have inherited a requirement for a tool [1] which takes an Ada program
executable in ELF format and generates from it a command script whose
contents are based on some of the attributes of the program's variables
- for example, the address and datatype of static or global variables,
or the parameter list of a function or subprogram. Another important
aspect in the tool's output file is whether a parameter is (in Ada
terms) "in", "out", or "in out".  

An earlier version of this tool uses STABS rather than DWARF, but we are
planning on following the general trend to DWARF.

The address and datatype part works fine with STABS, unsurprisingly, but
because the "in", "out" (etc) information does not seem to be present in
STABS, the tool generally uses debug info to refer back to the relevant
Ada source which is then parsed to determine this aspect of the passing
mechanism. As far as I can tell a similar approach would work with DWARF
too, but it might be more convenient if this info was also in the DWARF

Having briefly looked at the DWARF V3 spec and at the libdwarf consumer
library interface document I don't (yet) see anything that says core
DWARF currently includes anything which can be used to derive the "in"
"out" (etc) information. As far as I know this is a relatively unusual
requirement (specific to Ada?) so it may not currently be present, or I
could have overlooked the means of achieving it, or it could be in an
extension documented elsewhere. Also, I've had a quick read through the
DWARF-discuss mailing list archive (titles and search results) and
didn't see anything which looked similar to this question.

So, the two real questions:
1) Any ideas for alternatives to referring to the source to obtain the
"in", "out", "in out" information? E.g. have I overlooked an extension
2) Is this likely to be of sufficient interest to justify someone
incorporating it centrally at some stage ?

Thanks in advance,
John Wallace

[1] This output from this tool is used as part of the process of testing
Ada programs binaries, rather than for more traditional debugging;  the
"in", "out", or "in out" information is used for setting up the run-time
test environment.

This message (and any attachment) is confidential and is intended for the named recipient only.
If you receive it in error please e-mail back the sender and permanently delete the original message and any copies.
Rolls-Royce Goodrich Engine Control Systems Limited.
Registered Office: Moor Lane, PO Box 31, Derby, DE24 8BJ.
Registered in England No. 06686268.

More information about the Dwarf-Discuss mailing list