GDB不能插入内部断点 [英] GDB can't insert internal breakpoint

查看:329
本文介绍了GDB不能插入内部断点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在一个共享库(.so)的函数中添加了两个断点,并运行 gdb 7.4 并将其附加到一个进程。

I added two breakpoints in functions of one shared library (.so) and ran gdb 7.4 and attached it to a process.

Gdb命中断点,我运行了 n 几个步骤,gdb报告了以下错误(用粗体文本):

Gdb hit the breakpoint and I ran n for several steps, and gdb reported the following errors(with bold text):


(gdb)b [函数名称]

0xf1f28a49处的断点1:file ../../。 ./../../ [文件名] .cpp,第167行。

0xf1f2dae5处的断点2:file ../../../../../ [文件名] .cpp,第60行。

警告:设置了多个断点。

使用delete命令删除不需要的断点。

(gdb)c < br>
继续。

[新主题0xcaafab90(LWP 28480)]

[线程0xcaafab90(LWP 28480)已退出]

[ 0xcaafab90(LWP 29558)]

[新主题0xc8cb6b90(LWP 29980)]

[切换到主题0xc8cb6b90(LWP 29980)]



断点2,[函数名](ostr = ...,clientResponse = ...,httpProtocol = ...,> reqType = ...)在../../../../。 ./ [文件名] .cpp:60

60 ../../../../../ [文件名] .cpp:没有此类文件或目录。

in ../../../../../ [文件名] .cpp

(gdb)ni

0xf1f2daed 60 in ../。 ./../../../ [文件名] .cpp

(gdb)n



断点1,[函数名]( ostr = ...,clientResponse = ...,httpProtocol = ...,> closeConn = ...,asynchResponse = ...,reqType = ...)

at ../ .. /../../../ [文件名] .cpp:167

167在../../../../../[文件名] .cpp

(gdb)n

警告:

无法插入断点0。

访问内存时出错地址0x36cc6dde:输入/输出错误



(gdb)地址0x36cc6dde:输入/

(gdb) b [function name]
Breakpoint 1 at 0xf1f28a49: file ../../../../../[file name].cpp, line 167.
Breakpoint 2 at 0xf1f2dae5: file ../../../../../[file name].cpp, line 60.
warning: Multiple breakpoints were set.
Use the "delete" command to delete unwanted breakpoints.
(gdb) c
Continuing.
[New Thread 0xcaafab90 (LWP 28480)]
[Thread 0xcaafab90 (LWP 28480) exited]
[New Thread 0xcaafab90 (LWP 29558)]
[New Thread 0xc8cb6b90 (LWP 29980)]
[Switching to Thread 0xc8cb6b90 (LWP 29980)]

Breakpoint 2, [function name] (ostr=..., clientResponse=..., httpProtocol=..., >reqType=...) at ../../../../../[file name].cpp:60
60 ../../../../../[file name].cpp: No such file or directory.
in ../../../../../[file name].cpp
(gdb) ni
0xf1f2daed 60 in ../../../../../[file name].cpp
(gdb) n

Breakpoint 1, [function name] (ostr=..., clientResponse=..., httpProtocol=..., >closeConn=..., asynchResponse=..., reqType=...)
at ../../../../../[file name].cpp:167
167 in ../../../../../[file name].cpp
(gdb) n
Warning:
Cannot insert breakpoint 0.
Error accessing memory address 0x36cc6dde: Input/output error.

0xf7082771 in siglongjmp () from /lib/libc.so.6
(gdb)

这是 / proc / [PID] / maps


08048000-08146000 r-xp 00000000 08:03 293876


08146000 -08150000 rw-p 000fe000 08:03 293876


08150000-099c8000 rw-p 08150000 00:00 0

[heap]
c21f9000-c21fa000 --- p c21f9000 00:00 0

c21fa000-c29fa000 rwxp c21fa000 00:00 0
c29fa000-c29fb000 --- p
c29fa000 00:00 0
......
f1e1b000 -f1e24000 rw-p f1e1b000 00:00
0
f1e24000-f2093000 r-xp 00000000 08:03 295549

.so
f2093000-f2094000 --- p 0026f000 08: 03 295549

.so
f2094000-f2098000 r - p 0026f000 08:03 295549

.so
f2098000-f209c000 rw-p 00273000 08:03 295549 < br>
.so
f209c000-f209d000 rw-p f209c000 00:00 0

08048000-08146000 r-xp 00000000 08:03 293876

08146000-08150000 rw-p 000fe000 08:03 293876

08150000-099c8000 rw-p 08150000 00:00 0
[heap]
c21f9000-c21fa000 ---p c21f9000 00:00 0
c21fa000-c29fa000 rwxp c21fa000 00:00 0
c29fa000-c29fb000 ---p c29fa000 00:00 0
……
f1e1b000-f1e24000 rw-p f1e1b000 00:00 0
f1e24000-f2093000 r-xp 00000000 08:03 295549
.so
f2093000-f2094000 ---p 0026f000 08:03 295549
.so
f2094000-f2098000 r--p 0026f000 08:03 295549
.so
f2098000-f209c000 rw-p 00273000 08:03 295549
.so
f209c000-f209d000 rw-p f209c000 00:00 0

我的问题are:


  1. Gdb无法为 ni 命令插入内部断点,但为什么它试图访问地址 0x36cc6dde 如果文本部分在 0xf1 ******

  1. Gdb fails to insert internal breakpoint for ni command, but why does it try to access address 0x36cc6dde if the text section is at 0xf1******?That address is not included in the output of maps as you can see.

更一般的问题,我被告知共享库从 0x40000000开始

More general question, I was told shared library starts at 0x40000000 but why this is not the case in my environment?

共享库被编译了,但是为什么在我的环境中不是这样?与 -fPIC 。我在上面的跟踪中隐藏了一些符号名称。

The shared library is compiled with -fPIC. I hide some symbol names in the traces above.

推荐答案

这可能与 http://sourceware.org/bugzilla/show_bug.cgi?id=13987 。请,你能尝试最新的FSF GDB HEAD(可以从:git://sourceware.org/git/gdb.git)。

This is probably related to http://sourceware.org/bugzilla/show_bug.cgi?id=13987. Please, could you try the latest FSF GDB HEAD (can be obtained from: git://sourceware.org/git/gdb.git).

这篇关于GDB不能插入内部断点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆