读取寄存器指向GDB的内存 [英] Reading memory pointed by register with GDB
问题描述
如果我知道内存位置,有没有办法从GDB查看内存内容?
这是我正在调试为我的操作系统课程编写的x86汇编程序。我想要做的是在x86上用C和gas(GNU汇编器)编写用于Linux的用户级线程库。我分配了自己的堆栈,并将esp寄存器指向了该内存位置。现在我想要做的是读取内存,看看我分配的堆栈中有什么。
( gdb
)
p(int *)$ esp
x / 20x $ esp
p((int *)$ esp)[3]
Is there a way to look at memory content from GDB if I know the memory location.
That is I'm debugging a x86 assembly program I written for my Operating Systems Course. What I'm trying to do is to write a user level thread library for linux on x86 with C and gas (GNU assembler). I allocated my own stacks and I made the esp register point to that memory location. Now what I want to do is read the memory to see what is in that stack I allocated.
I would try something like the following commands (under gdb
)
p (int*)$esp
x /20x $esp
p ((int*)$esp)[3]
这篇关于读取寄存器指向GDB的内存的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!