ccwenlin ccwenlin - 1 year ago 42
Python Question

why the ESP is bigger than EBP for python in my 32bit server?

I use gdb to debug my program. The output like this, I break it at

Python/ceval.c:1071


(gdb) info reg
eax 0x7d 125
ecx 0x29 41
edx 0x8a44e04 144985604
ebx 0xce4518 13518104
esp 0xbfb24d10 0xbfb24d10
ebp 0xb7d72bed 0xb7d72bed
esi 0x8a563e4 145056740
edi 0x8a56294 145056404
eip 0xc400f8 0xc400f8 <PyEval_EvalFrameEx+936>
eflags 0x206 [ PF IF ]
cs 0x73 115
ss 0x7b 123
ds 0x7b 123
es 0x7b 123
fs 0x0 0
gs 0x33 51
(gdb)


so I want to know why esp is bigger than ebp?
some info,

Linux foxyfont2.uc.local 2.6.18-194.el5 #1 SMP Tue Mar 16 21:52:43 EDT 2010 i686 i686 i386 GNU/Linux
gcc 版本 4.6.2 (GCC)

Answer Source

Even though ebp is sometimes used as frame pointer it is nevertheless just another general purpose register. If it's not used as a frame pointer, its value can be anything. You might also be seeing leftover value from a previous use.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download