Question

I'm learning Assembler and this is my problem.

When i use gdb i see the registers with the following names:

 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.

But i wanna see them with those names:

(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.

I'm using Arch Linux with an Intel processor.

The difference on the names is really making me harder the work. Thank you for your time.

Was it helpful?

Solution

Register names are depending on the architecture and processor bit size(32 or 64 bit)
for which you compiled your code and running. You can't change register names as you want.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top