[Dwarf-discuss] Re: Dwarf2 Beginner's Question: Pointer variable...
Tue Jun 14 13:45:20 GMT 2005
Koji Noguchi wrote:
> The problem is, when I decide to migrate the process, I want to know
> all the (potential) locations of the pointers on the stack and the registers.
> Input is a C code without type casting, union, pointer arithmetic, etc.
> Does DWARF2 provide enough information for this purpose?
> (I'm using gcc with -O3 -g option).
> I think this is not possible, but I wanted to ask you before I
> completely give up.
> To show how beginner I am,
> I tried the following simple code but couldn't figure out the
> register for pointer 'p_int' from the DWARF2 output.
The lack of a DW_AT_location attribute on the DIE for p_int
indicates that it has no address. That is, it was "optimized
away". In this example, value propagation might well move the
address of bbb directly into the point of use without ever
allocating a place specifically for p_int.
Of itself, such optimized away variables should not be problem
for your purpose.
However, bear in mind that debugging descriptions (DWARF or
otherwise) generally describe only entities that occur in the
source program. Code generation, especially in optimizing
compilers, can often create additional "variables" for the
convenience of the code generator but which are not described in
the debugging information. Compilers for so-called "garbage
collected languages" generally need to be especially tuned to
avoid creating temporaries that cannot be handled by the runtime
>From what you have said, this does seem likely to be a problem
for your purposes. But it would take a lot more knowledge about
both the run-time environment and the code generation of that
compiler to be definitive.
More information about the Dwarf-discuss