gdb'x'命令是做什么的? [英] What does the gdb 'x' command do?
问题描述
为了更好地了解计算机,我偶然发现了一本关于反汇编,x86汇编语言以及C和x86汇编之间关系的书。现在我一直在阅读这个 GDB
命令,但我无法完全理解它。
该命令与其结果如下:
pre $ code $(gdb)x / 32xw $ esp
0xbffff7e0:0xb8000ce0 0x08048510 0xbffff848 0xb7eafebc
0xbffff7f0:0x00000002 0xbffff874 0xbffff880 0xb8001898
0xbffff800:00000000 00000001 00000001 00000000
0xbffff810:0xb7fd6ff4 0xb8000ce0 00000000 0xbffff848
0xbffff820:0x40f5f7f0 0x48e0fe81 00000000 00000000
0xbffff830:00000000 0xb7ff9300 0xb7eafded 0xb8000ff4
0xbffff840:0x00000002 0x08048350 0x00000000 0x08048371
0xbffff850:0x08048474 0x00000002 0xbffff874 0x08048510
现在,我明白了,我发出的命令告诉调试器:
一直困扰着我的是我如何找到所有这些字节?由于我正在检查一个寄存器,谁的大小是32位,我不应该只得到32位或4个字节(只有上面的1行)?如果我对我的假设是正确的,那么我们是否可以找到其余的数据?它是否需要对堆栈和特定的堆栈框架进行操作,目前我还没有意识到这一点?
我很感谢您的意见,以便我能够澄清我的想法。
这给你32字的内存,其中 esp
寄存器正在指向(显然这个寄存器包含地址0xbffff7e0)。
In my quest to learn more about the computer in general, I stumbled upon a book which has some chapters about disassembling, the x86 assembly language, and the relationship between C and x86 assembly. Now I have been reading this GDB
command but I am unable to fully understand it.
The command, along with its results, follows:
(gdb) x/32xw $esp
0xbffff7e0: 0xb8000ce0 0x08048510 0xbffff848 0xb7eafebc
0xbffff7f0: 0x00000002 0xbffff874 0xbffff880 0xb8001898
0xbffff800: 0x00000000 0x00000001 0x00000001 0x00000000
0xbffff810: 0xb7fd6ff4 0xb8000ce0 0x00000000 0xbffff848
0xbffff820: 0x40f5f7f0 0x48e0fe81 0x00000000 0x00000000
0xbffff830: 0x00000000 0xb7ff9300 0xb7eafded 0xb8000ff4
0xbffff840: 0x00000002 0x08048350 0x00000000 0x08048371
0xbffff850: 0x08048474 0x00000002 0xbffff874 0x08048510
Now, from what I understand, the command that I issue tells the debugger to:
- x (first one): examine the memory
- 32: get 32 of what follows
- x: enable hexadecimal representation
- w: show me
Word
size data. **Note:**
I know that I ask about the esp register, but I don't quite fully understand what $ is doing in front of it. When I try not to use it, I get a missing symbol error, so I get it has something to do with reference/de-reference?
What has been bugging me is how did I find all those bytes? Since I am examining a register, who's size is 32 bit, shouldn't I get only 32 bits, or 4 bytes (only 1 row of the above)? If I am correct with my assumption, then were did we find the rest of the data? Does it have to do something with the stack, and a particular stack frame, which I currently am unaware of?
I would appreciate your input so that I can clarify things in my mind.
It's giving you 32 words of memory where the esp
register is pointing (apparently that register contains the address 0xbffff7e0).
这篇关于gdb'x'命令是做什么的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!