汇编报错:Warning: Cannot insert breakpoint 1. Cannot access memory at address 0x1135 解决办法(先不打断点run一遍)(代码
Posted Dontla
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了汇编报错:Warning: Cannot insert breakpoint 1. Cannot access memory at address 0x1135 解决办法(先不打断点run一遍)(代码相关的知识,希望对你有一定的参考价值。
在linux下用gdb打断点调试发现报错了:
(gdb) run
Starting program: /home/dontla/桌面/test/test
Warning:
Cannot insert breakpoint 1.
Cannot access memory at address 0x1135
解决办法:
先退出GDB
(gdb) quit
A debugging session is active.
Inferior 1 [process 32756] will be killed.
Quit anyway? (y or n)
dontla@dontla-virtual-machine:~/桌面/test$ c
然后用gdb打开程序先run一遍再打断点调试:
dontla@dontla-virtual-machine:~/桌面/test$ gdb ./test
GNU gdb (Ubuntu 9.2-0ubuntu1~20.04) 9.2
Copyright (C) 2020 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from ./test...
(No debugging symbols found in ./test)
(gdb) run
Starting program: /home/dontla/桌面/test/test
[Inferior 1 (process 32770) exited with code 03]
(gdb) disas main
Dump of assembler code for function main:
0x0000555555555130 <+0>: mov $0x1,%eax
0x0000555555555135 <+5>: mov $0x2,%ebx
0x000055555555513a <+10>: add %ebx,%eax
0x000055555555513c <+12>: retq
0x000055555555513d <+13>: nopl (%rax)
End of assembler dump.
(gdb) break *0x0000555555555135
Breakpoint 1 at 0x555555555135
(gdb) run
Starting program: /home/dontla/桌面/test/test
Breakpoint 1, 0x0000555555555135 in main ()
(gdb)
这是因为:
原因在于数据断点的设置有误。在没有用gdb运行(run)过可执行程序之前,使用disasemble指令反汇编出来的汇编语言的左边的地址偏移地址,不是逻辑地址。所以,即使break指令能够设置断点,当GDB运行时也不可能访问到这个地址。也就会出现上面的错误。
数据断点:给某个内存地址设置断点,改变该地址所装内容时会触发断点,运行到该地址时会触发断点。(从网上看的,参考)
而学过操作系统或者微机原理就该知道,程序给出来的只是逻辑地址,不可能直接给物理地址的,物理地址都是由系统将其映射成了逻辑地址。
以上是关于汇编报错:Warning: Cannot insert breakpoint 1. Cannot access memory at address 0x1135 解决办法(先不打断点run一遍)(代码的主要内容,如果未能解决你的问题,请参考以下文章
kali执行ifconfig报错Warning: cannot open /proc/net/dev (Permission denie
php5.6,Ajax报错,Warning: Cannot modify header information - headers already sent in Unknown on line 0(
终端SSH远程连接CentOS报错:-bash: warning: setlocale: LC_CTYPE: cannot change locale (UTF-8): No such file or
AndrodStudio报错: Cannot launch AVD in emulator.
Git (gnome-ssh-askpass:3871): Gtk-WARNING **: cannot open display:
ssh登录locale报错:cannot change locale (zh_CN.UTF-8): No such file or directory