Neeraj kushwaha | 4 Feb 2008 07:39
Picon

Re: value of local variable stored in register

Hi Rohit,

thanks for the reply.

segmentation occurs due to unreferencing null pointer. (this was done
intensionally)
I am running gdb on core dump.

My main intention to get the value of the local variable stored in register.
From the dwarf dump information i can say it was stored in DW_OP_reg2.

Also if for the arithmetic operations, data is moved to register from
memory, but when the printf function returns all the saved register
value should be restored.

this is the dwarf information extracted from a.out

<1><  276>      DW_TAG_subprogram
               DW_AT_sibling               <341>
               DW_AT_external              yes(1)
               DW_AT_name                  main
               DW_AT_decl_file             1
/home/neeraj/SSG/Release2/gdblocal/2.c
               DW_AT_decl_line             5
               DW_AT_type                  <199>
               DW_AT_low_pc                0x80483a4
               DW_AT_high_pc               0x80483f5
               DW_AT_frame_base            [
0]<lowpc=0x0><highpc=0x4>DW_OP_breg4+4
                                       [ 1]<lowpc=0x4><highpc=0xa>DW_OP_reg1
(Continue reading)

Rohit Arul Raj | 4 Feb 2008 08:02
Picon

Re: value of local variable stored in register

Hi,

Then, the register value is getting corrupted due to the segmentation fault.
Try to set the break-point before the *a = 0 statement, and try to get
the register info and local variable info.

Regards,
Rohit

On Feb 4, 2008 12:09 PM, Neeraj kushwaha <kushneeraj <at> gmail.com> wrote:
>
> Hi Rohit,
>
> thanks for the reply.
>
> segmentation occurs due to unreferencing null pointer. (this was done
> intensionally)
> I am running gdb on core dump.
>
> My main intention to get the value of the local variable stored in register.
> From the dwarf dump information i can say it was stored in DW_OP_reg2.
>
> Also if for the arithmetic operations, data is moved to register from
> memory, but when the printf function returns all the saved register
> value should be restored.
>
> this is the dwarf information extracted from a.out
>
> <1><  276>      DW_TAG_subprogram
>                DW_AT_sibling               <341>
(Continue reading)

Rohit Arul Raj | 4 Feb 2008 08:42
Picon

Re: value of local variable stored in register

Hi,

Since the live range of value 'c' is dead after printf, the compiler
may be discarding it.
Try to use something like b = c + 200; after printf statement, so that
we extend the live range of variable 'c'.

Regards,
Rohit

On Feb 4, 2008 12:32 PM, Rohit Arul Raj <rohitarulraj <at> gmail.com> wrote:
> Hi,
>
> Then, the register value is getting corrupted due to the segmentation fault.
> Try to set the break-point before the *a = 0 statement, and try to get
> the register info and local variable info.
>
> Regards,
> Rohit
>
>
> On Feb 4, 2008 12:09 PM, Neeraj kushwaha <kushneeraj <at> gmail.com> wrote:
> >
> > Hi Rohit,
> >
> > thanks for the reply.
> >
> > segmentation occurs due to unreferencing null pointer. (this was done
> > intensionally)
> > I am running gdb on core dump.
(Continue reading)


Gmane