[Dwarf-Discuss] DWARF has initial condition values? if not where then?

David Anderson davea42 at earthlink.net
Thu Dec 6 15:55:33 PST 2012


On 12/06/2012 01:02 PM, Long, Dan T wrote:
> Are the variables’ initial condition values stored in the DWARF files?
>
> For example (Ada language with gnat compiler):
>
> type  A_type is
>    record
>     B : Integer := 10;
>     C : Float   := 2.5;
>     D : Boolean := true;
>    End record;
>
> EE : Integer := 100;
> FF : Float   := 77.007;
>
> Where are the initial condition values: 10, 2.5, true, and 100 stored in DWARF files?  Or where in the compiled code are they?   I used  readelf –w filename.o  >  filename.dwarf   then
>
> I looked at its DWARF file and I can see the definition of structure A along with B, C, D type definitions and EE type too but I cannot find 10, 2.5, true nor 100 values anywhere.
>
> I needs to extract the variable names, types and initial values for input into a mySQL database.
>

Typically (with -g compilation, not by default) the type information and 
variable information is
in DWARF.

The initial values of data items (variables) are in the executable itself,
usually in some data section.   DW_AT_location attributes in the DWARF  
records describing
variables provide the means for you write code (or use a debugger) to 
access any visible data values.


Hope this helps.
DavidA.



More information about the Dwarf-Discuss mailing list