开发者

Using GDB to inspect the Machine Stack

开发者 https://www.devze.com 2023-01-22 03:47 出处:网络
Is there any way to get GDB to print the last \"n\" values pushed on the machine\'s stack. For example, currently if I want to inspect the contents of the stack I do the following (assuming x86 archit

Is there any way to get GDB to print the last "n" values pushed on the machine's stack. For example, currently if I want to inspect the contents of the stack I do the following (assuming x86 architecture):

(gdb) # get last value pushed on stack
(gdb) p *(int *)($esp)
(gdb) # get 2nd to last value pushed on stack
(gdb) p *(int *)($esp + 4) 

Is there a better way to view the machine stack? Pr开发者_运维知识库inted nicely, maybe?


Examine 16 words on the top of stack:

x/16wx $esp

The "w" is for printing words

0

精彩评论

暂无评论...
验证码 换一张
取 消