免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 5081 | 回复: 3
打印 上一主题 下一主题

gdb中不能使用硬件断点? [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2010-04-30 09:26 |只看该作者 |倒序浏览
(gdb) show version
GNU gdb (GDB) 7.0
Copyright (C) 2009 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 "i686-pc-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.

gdb中使用和hbreak报错
No hardware breakpoint support in the target.
什么原因

论坛徽章:
0
2 [报告]
发表于 2010-04-30 14:58 |只看该作者
新建程序从内核返回时,执行入口是在ld-linux.so.2中,如何在该入口处下断点?我想用hbreak却不行。

b _start有的机器行,有的不行.

后来发现attach的进程可以hbreak.

[root@mail ~]# gdb /bin/ls
GNU gdb (GDB) 7.0
(gdb) hbreak *0x4000be0
No hardware breakpoint support in the target.
(gdb) b _start
Function "_start" not defined.
Make breakpoint pending on future shared library load? (y or [n]) y
Breakpoint 1 (_start) pending.
(gdb) r
Starting program: /bin/ls
gcc.txt  Mail
(gdb) q
[root@mail ~]# uname -a
Linux mail 2.4.20-8smp #1 SMP Thu Mar 13 17:45:54 EST 2003 i686 i686 i386 GNU/Linux

这个不行


[root@ssq_pppoe ~]# gdb /bin/ls
GNU gdb (GDB) 7.0
(gdb) b _start
Function "_start" not defined.
Make breakpoint pending on future shared library load? (y or [n]) y
Breakpoint 1 (_start) pending.
(gdb) r
Starting program: /bin/ls

Breakpoint 1, 0x0000003dad000a80 in _start () from /lib64/ld-linux-x86-64.so.2
(gdb) q
A debugging session is active.

        Inferior 1 [process 26735] will be killed.

Quit anyway? (y or n) y
[root@ssq_pppoe ~]# uname -a
Linux ssq_pppoe 2.6.9-42.ELsmp #1 SMP Wed Jul 12 23:32:02 EDT 2006 x86_64 x86_64 x86_64 GNU/Linux

这个又可以

[root@mail ~]# pgrep ftp
21880
[root@mail ~]# gdb
GNU gdb (GDB) 7.0
(gdb) attach 21880
Attaching to process 21880
Reading symbols from /usr/bin/ftp...(no debugging symbols found)...done.
Reading symbols from /usr/lib/libreadline.so.4...(no debugging symbols found)...done.
Loaded symbols for /usr/lib/libreadline.so.4
Reading symbols from /usr/lib/libncurses.so.5...(no debugging symbols found)...done.
Loaded symbols for /usr/lib/libncurses.so.5
Reading symbols from /lib/tls/libc.so.6...(no debugging symbols found)...done.
Loaded symbols for /lib/tls/libc.so.6
Reading symbols from /lib/ld-linux.so.2...(no debugging symbols found)...done.
Loaded symbols for /lib/ld-linux.so.2
Reading symbols from /lib/libnss_files.so.2...(no debugging symbols found)...done.
Loaded symbols for /lib/libnss_files.so.2
0xffffe002 in ?? ()
(gdb) hbreak *0x4000be0
Hardware assisted breakpoint 1 at 0x4000be0
(gdb) q
A debugging session is active.

        Inferior 1 [process 21880] will be detached.

Quit anyway? (y or n) y
Detaching from program: /usr/bin/ftp, process 21880

调试运行中的进程可以使用hbreak

论坛徽章:
0
3 [报告]
发表于 2010-05-13 22:48 |只看该作者
gdb中可以使用硬件断点

不能设置的情况是有可能你那出现了错误

论坛徽章:
0
4 [报告]
发表于 2010-05-15 23:31 |只看该作者
可以使用硬件断点
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP