最近一段時間在研究dbg方面的細(xì)節(jié)技術(shù),最終也想排除困擾自己已久的一些寄存器概念。在寄存器中最重要的3個指針概念就是EIP(指令指針),EBP(frame pointer),和ESP(stack pointer)。其中,eip的概念很好理解,就是指向?qū)⒁獔?zhí)行的指令,比如函數(shù)地址等。但ebp和esp理解起來經(jīng)常會有些混淆。說實話到現(xiàn)在我還是沒有徹底理解,不過我好像記住了一句話:
The stack pointer always points to the top (or bottom, if you prefer)of the stack. The frame pointer always points to the frame. Stack operations (e.g., push, pop, call) do not modify the frame (in a properly operating system) or the frame pointer (ever).
大概理解起來就是esp指向是棧頂?shù)牡刂罚鴈bp指向當(dāng)前動作幀,比如當(dāng)前執(zhí)行的函數(shù)幀,這里面用幀來理解再確切不過了。
下面轉(zhuǎn)載一篇文章,有助于更深一步的加深理解。
http://lazyflai.blogspot.com/2008/07/cfunction-callstack-frame.html
另:我發(fā)現(xiàn)臺灣的一些bloger寫的技術(shù)水平要比大陸稍微高一些。早上找到兩篇有用的文章均是來自臺灣同胞。同一個世界,同一個中國。