Mirror of the gdb mailing list
 help / color / mirror / Atom feed
* Frame lost after 'leave' and before 'ret' instruction on i386?
@ 2008-05-16 15:32 Aleksandar Ristovski
  2008-05-16 15:58 ` Daniel Jacobowitz
  2008-05-16 17:24 ` Mark Kettenis
  0 siblings, 2 replies; 24+ messages in thread
From: Aleksandar Ristovski @ 2008-05-16 15:32 UTC (permalink / raw)
  To: gdb

Hello,

I noticed that after 'leave' asm instruction (and before 'ret') one frame will be lost (skipped).

For example:

(gdb) disassemble doSth
Dump of assembler code for function doSth:
0x080484f4 <doSth+0>:   push   %ebp
0x080484f5 <doSth+1>:   mov    %esp,%ebp
0x080484f7 <doSth+3>:   sub    $0x8,%esp
0x080484fa <doSth+6>:   sub    $0xc,%esp
0x080484fd <doSth+9>:   push   $0x8048570
0x08048502 <doSth+14>:  call   0x8048348 <printf@plt>
0x08048507 <doSth+19>:  add    $0x10,%esp
0x0804850a <doSth+22>:  leave
0x0804850b <doSth+23>:  ret
End of assembler dump.
(gdb) info registers
...
eip            0x804850b        0x804850b <doSth+23>
...
(gdb) bt
#0  0x080483c3 in doSth () at main.c:6
#1  0xb7ebffdc in __libc_start_main () from /lib/libc.so.6
#2  0x08048331 in _start ()

(note 'main' that really made the call is missing... e.g., just before "leave" was executed:
(gdb) bt
#0  doSth () at main.c:6
#1  0x080483da in main () at main.c:10
)

What happens is, we have restored the stack pointer but gdb is unaware of that fact and tries to unwind using already unwound value...

how is this supposed to work?


^ permalink raw reply	[flat|nested] 24+ messages in thread

end of thread, other threads:[~2008-06-05 20:12 UTC | newest]

Thread overview: 24+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-05-16 15:32 Frame lost after 'leave' and before 'ret' instruction on i386? Aleksandar Ristovski
2008-05-16 15:58 ` Daniel Jacobowitz
2008-05-16 16:02   ` Aleksandar Ristovski
2008-05-16 16:09     ` Daniel Jacobowitz
2008-05-22 14:29   ` Aleksandar Ristovski
2008-05-22 14:40     ` Aleksandar Ristovski
2008-05-22 14:50     ` Daniel Jacobowitz
2008-05-22 15:05       ` Aleksandar Ristovski
2008-05-22 16:00         ` Aleksandar Ristovski
2008-05-22 16:02         ` Daniel Jacobowitz
2008-05-23 15:19           ` Aleksandar Ristovski
2008-05-22 18:06             ` Aleksandar Ristovski
2008-05-23 17:11             ` Daniel Jacobowitz
2008-05-23 17:23         ` Michael Snyder
2008-05-26 23:08           ` Aleksandar Ristovski
2008-05-27 21:33             ` Aleksandar Ristovski
2008-05-29  6:21             ` Thiago Jung Bauermann
2008-05-29  6:22               ` Aleksandar Ristovski
2008-06-04 13:12             ` Aleksandar Ristovski
2008-06-05 20:12               ` Mark Kettenis
2008-05-16 17:24 ` Mark Kettenis
2008-05-16 17:28   ` Aleksandar Ristovski
2008-05-16 17:47     ` Daniel Jacobowitz
2008-05-16 17:48     ` Mark Kettenis

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox