c - 不同的 gdb 寄存器名称

标签 c assembly gdb cpu-registers

我正在学习汇编程序,这是我的问题。

当我使用 gdb 时,我看到具有以下名称的寄存器:

 Dump of assembler code for function return_input:
 0x000000000040053d <+0>:   push   %rbp
 0x000000000040053e <+1>:   mov    %rsp,%rbp
 0x0000000000400541 <+4>:   sub    $0x20,%rsp
 0x0000000000400545 <+8>:   lea    -0x20(%rbp),%rax
 0x0000000000400549 <+12>:  mov    %rax,%rdi
 0x000000000040054c <+15>:  callq  0x400440 <gets@plt>
 0x0000000000400551 <+20>:  lea    -0x20(%rbp),%rax
 0x0000000000400555 <+24>:  mov    %rax,%rdi
 0x0000000000400558 <+27>:  callq  0x400410 <puts@plt>
 0x000000000040055d <+32>:  leaveq 
 0x000000000040055e <+33>:  retq   
 End of assembler dump.

但我想看到他们有那些名字:

(gdb) disas return_input
Dump of assembler code for function return_input:
0x080483c4 <return_input+0>:    push   %ebp
0x080483c5 <return_input+1>:    mov    %esp,%ebp
0x080483c7 <return_input+3>:    sub    $0x28,%esp
0x080483ca <return_input+6>:    lea    0xffffffe0(%ebp),%eax
0x080483cd <return_input+9>:    mov    %eax,(%esp)
0x080483d0 <return_input+12>:   call   0x80482c4 <_init+40>
0x080483d5 <return_input+17>:   lea    0xffffffe0(%ebp),%eax
0x080483d8 <return_input+20>:   mov    %eax,0x4(%esp)
0x080483dc <return_input+24>:   movl   $0x8048514,(%esp)
0x080483e3 <return_input+31>:   call   0x80482e4 <_init+72>
0x080483e8 <return_input+36>:   leave
0x080483e9 <return_input+37>:   ret
End of assembler dump.

我正在使用带有 Intel 处理器的 Arch Linux。

名字的不同确实让我更加努力地工作。 感谢您的宝贵时间。

最佳答案

寄存器名称取决于架构和处理器位大小(32 位或 64 位)
您为其编译代码并运行。您不能随意更改注册名称。

关于c - 不同的 gdb 寄存器名称,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20877696/

相关文章:

c - 在 xinu 中恢复中断 128 0x80

c++ - 代码对齐会显着影响性能

c++ - GDB:走进图书馆

我可以编写自己的 GDB 可读内核吗?

assembly - 使用 NASM 程序集将 16 位十进制数转换为其他基数

c - 如何在到达给定断点之前自动打印 GDB 中的每一行?

c - 函数不会返回 0,找不到逻辑错误

c 在不知道长度的情况下分配内存

c - 当分配增加超过 malloc 大小时不会出现段错误

c - 无法确定此汇编代码中的常量