RE: Setting registers

Dave Korn
2007-06-13T13:45:49Z

On 13 June 2007 11:28, Indira wrote:

> Hi,
>
> I was writing a macro in which i was trying to the variable ebp and eip as,
>
> set variable $ebp = *(int *)($sp+8)
> set variable $eip = *(int *)($sp+36)
>
> but, even though by doing this th eregister values dont get updated.
> Why is this so? Can anyone help me on this?

Dunno, works fine for me:

Breakpoint 1, main () at time.c:13
13 { double t0 = get_time(), t1 = get_time();
(gdb) info regis
eax 0x10 16
ecx 0x401080 4198528
edx 0x4c 76
ebx 0x0 0
esp 0x23cc80 0x23cc80
ebp 0x23ccb8 0x23ccb8
esi 0x611001a0 1628438944
edi 0x401430 4199472
eip 0x40108b 0x40108b <main+11>
eflags 0x202 [ IF ]
cs 0x1b 27
ss 0x23 35
ds 0x23 35
es 0x23 35
fs 0x3b 59
gs 0x0 0
(gdb) set variable $ebp = *(int *)($sp+8)
(gdb) set variable $eip = *(int *)($sp+36)
(gdb) info regis
eax 0x10 16
ecx 0x401080 4198528
edx 0x4c 76
ebx 0x0 0
esp 0x23cc80 0x23cc80
ebp 0x61166a78 0x61166a78
esi 0x611001a0 1628438944
edi 0x401430 4199472
eip 0x2f 0x2f
eflags 0x202 [ IF ]
cs 0x1b 27
ss 0x23 35
ds 0x23 35
es 0x23 35
fs 0x3b 59
gs 0x0 0
(gdb)

You're not by any chance trying to debug a core file are you?

cheers,
DaveK
--
Can't think of a witty .sigline today....