gdb如何简化内存地址/偏移量?

Sab*_*ina 1 c assembly gdb

这是我的示例C代码

user@linux:~$ gdb -q hello
Reading symbols from hello...done.
(gdb) 
(gdb) list 
1   #include<stdio.h>
2   
3   int main()
4   {
5       printf("Hello World!\n");
6       return 0;
7   }
8   
Run Code Online (Sandbox Code Playgroud)

这就是汇编代码。

(gdb) disassemble main 
Dump of assembler code for function main:
   0x000000000000063a <+0>: push   %rbp
   0x000000000000063b <+1>: mov    %rsp,%rbp
   0x000000000000063e <+4>: lea    0x9f(%rip),%rdi        # 0x6e4
   0x0000000000000645 <+11>:    callq  0x510 <puts@plt>
   0x000000000000064a <+16>:    mov    $0x0,%eax
   0x000000000000064f <+21>:    pop    %rbp
   0x0000000000000650 <+22>:    retq   
End of assembler dump.
(gdb) 
Run Code Online (Sandbox Code Playgroud)

内存地址包含18个字符,其中大多数是数字0

除了显示所有数字,还可以简化它吗?

让我们0x63a代替0x000000000000063a

Emp*_*ian 5

内存地址包含18个字符,大多数为数字0

这里没有“记忆”。您显然是在谈论显示地址。

假设用0x63a代替0x000000000000063a

You are on a 64-bit system, and every address is exactly 64-bits. Displaying addresses as something other than a 64-bit number would be very confusing.

P.S. You have a position-independent executable. It doesn't actually run at address 0x000000000000063a. If you use start and disas main, you will get a very different result.