qtdszws 发表于 2010-04-30 09:26

gdb中不能使用硬件断点?

(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.
什么原因

qtdszws 发表于 2010-04-30 14:58

新建程序从内核返回时,执行入口是在ld-linux.so.2中,如何在该入口处下断点?我想用hbreak却不行。

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

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

# 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 ) y
Breakpoint 1 (_start) pending.
(gdb) r
Starting program: /bin/ls
gcc.txtMail
(gdb) q
# uname -a
Linux mail 2.4.20-8smp #1 SMP Thu Mar 13 17:45:54 EST 2003 i686 i686 i386 GNU/Linux

这个不行


# 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 ) 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 will be killed.

Quit anyway? (y or n) y
# 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

这个又可以

# pgrep ftp
21880
# 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 will be detached.

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

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

aaaaa5aa 发表于 2010-05-13 22:48

gdb中可以使用硬件断点

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

notion001 发表于 2010-05-15 23:31

可以使用硬件断点
页: [1]
查看完整版本: gdb中不能使用硬件断点?