Cannot access memory - gdb

后端 未结 1 983
迷失自我
迷失自我 2021-01-28 09:58

Here is my disas code:

Dump of assembler code for function main:
0x00000000000006b0 <+0>:    push   %rbp
0x00000000000006b1 <+1>:    mov    %rsp,%rbp         


        
相关标签:
1条回答
  • 2021-01-28 11:02

    Dump of assembler code for function main: 0x00000000000006b0 <+0>: push %rbp 0x00000000000006b1 <+1>: mov %rsp,%rbp

    You are looking at position-independent executable (a special kind of shared library). The code for main gets relocated to a different address when the executable starts running.

    Because there is no code at 0x6b4 once the executable is relocated, GDB complains that it can't set a breakpoint there.

    but when I do it with b 4 and run the code ,it is working normal.

    In this case, GDB understands that you want to set breakpoint on line 4, and inserts appropriate breakpoint after the executable has been relocated.

    Use info break to see what the relocated address is.

    0 讨论(0)
提交回复
热议问题