[Dwarf-discuss] Re: Dwarf2 Beginner's Question: Pointer variable tracking with Optimization
Michael Eager
eager
Tue Jun 14 10:39:18 GMT 2005
Any DWARF question is appropriate for the mailing list.
Koji Noguchi wrote:
> Dear Mailing List Members,
>
>
> Hi. I am implementing a simple code/process migration system
> and was wondering if I can use this DWARF2 debug format to solve my problem.
>
> 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.
>
> @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
> #include <stdio.h>
> #include <stdlib.h>
>
> int main()
> {
> int aaa,bbb;
> int * p_int;
>
> aaa = 11;
> bbb = 22;
> p_int = &bbb;
>
> printf( "aaa = %d bbb = %d p_int = %p *p_int = %d\n",
> aaa, bbb, p_int, *p_int);
> return 0;
> }
>
>
> .long .LASF46 # DW_AT_name: "p_int"
> .byte 0x1 # DW_AT_decl_file
> .byte 0x8 # DW_AT_decl_line
> .long 0x2f3 # DW_AT_type
> .byte 0x0 # end of children of DIE 0x2b4
> .uleb128 0x5 # (DIE (0x2f3) DW_TAG_pointer_type)
> .byte 0x4 # DW_AT_byte_size
> .long 0x4f # DW_AT_type
> .byte 0x0 # end of children of DIE 0xb
>
> @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
>
> I thought the output would contain "DW_AT_location" info somewhere,
> but I couldn't find it. Am I missing something?
>
> Any suggestions would be greatly appreciated
>
> Thank you.
>
> Koji Noguchi
>
>
>
--
Michael Eager eager at eagercon.com
1960 Park Blvd., Palo Alto, CA 94306 650-325-8077
More information about the Dwarf-discuss
mailing list