It's a virtual address in RAM. You have a position-dependent executable, so the absolute address it will be loaded to is right there in the ELF metadata. (you can use readelf my_program
, or the GDB command info files
.)
If you had a PIE executable and set a breakpoint before starting it, GDB will give you a breakpoint address that isn't relocated yet, so the first byte of the file is treated as address 0
. e.g.
(gdb) b main
Breakpoint 1 at 0x64e: file hello.c, line 3.
(gdb) run
Starting program: /tmp/hello
Breakpoint 1, main () at hello.c:3
(gdb) info br
Num Type Disp Enb Address What
1 breakpoint keep y 0x000055555555464e in main at hello.c:3
breakpoint already hit 1 time
Note that 0x64e
and 0x000055555555464e
have the same offset within a 4k page, because the file gets mapped to a page-aligned address.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…