我正在调试一个C ++应用程序,info shared
告诉我这个我要读入的库已被读取并具有调试符号,
0x00007fffedc1f530 0x00007ffff18e4e60 Yes /home/me/WPEWebKit/WebKitBuild/Debug/lib/libWPEWebKit.so
然后我在这个加载的共享库上运行nm
并找到了一个我想要打破的符号(只是为了确保名称是正确的):
$ nm /home/me/WPEWebKit/WebKitBuild/Debug/lib/libWPEWebKit.so | c++filt | grep -iw handleSyncmessage
0000000008a03e14 T WebCore::MediaPlayerPrivateGStreamer::handleSyncMessage(_GstMessage*)
我可能值得说libWPEWebKit.so
只有650MB以上,所以非常重量级。
现在在GDB中,我这样说,
(gdb) break WebCore::MediaPlayerPrivateGStreamer::handleSyncMessage
Function "WebCore::MediaPlayerPrivateGStreamer::handleSyncMessage" not defined.
Make breakpoint pending on future shared library load? (y or [n])
但是我们知道此时符号已加载。如果我重新运行断点集,它永远不会被触发,尽管已经证明函数确实正在运行。
我在这里做错了吗?
编辑:添加信息功能输出
(gdb) info functions handleSyncMessage
All functions matching regular expression "handleSyncMessage":
.. lots of template instantiations I am ommitting because they are from unrelated things that just ref. this type ..
File ../../Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
bool (anonymous namespace)::MediaPlayerPrivateGStreamer::handleSyncMessage(GstMessage*);
File ../../Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
bool (anonymous namespace)::MediaPlayerPrivateGStreamerBase::handleSyncMessage(GstMessage*);
..
Non-debugging symbols:
0x00007fffed84bcf0 WebCore::MediaPlayerPrivateGStreamerBase::handleSyncMessage(_GstMessage*)@plt
0x00007fffed84d810 WebCore::MediaPlayerPrivateGStreamer::handleSyncMessage(_GstMessage*)@plt
我现在注意到我错过了上面的一些输出,我添加了完整性
0000000008a03e14 T WebCore::MediaPlayerPrivateGStreamer::handleSyncMessage(_GstMessage*)
0000000008a11868 T WebCore::MediaPlayerPrivateGStreamerBase::handleSyncMessage(_GstMessage*)
0000000008a16fa8 t std::remove_reference<WebCore::MediaPlayerPrivateGStreamerBase::handleSyncMessage(_GstMessage*)::{lambda()#1}&>::type&& std::move<WebCore::MediaPlayerPrivateGStreamerBase::handleSyncMessage(_GstMessage*)::{lambda()#1}&>(std::remove_reference&&)
0000000008a16f78 t WebCore::MediaPlayerPrivateGStreamerBase::handleSyncMessage(_GstMessage*)::{lambda()#1}& std::forward<WebCore::MediaPlayerPrivateGStreamerBase::handleSyncMessage(_GstMessage*)::{lambda()#1}&>(std::remove_reference<WebCore::MediaPlayerPrivateGStreamerBase::handleSyncMessage(_GstMessage*)::{lambda()#1}&>::type&)
0000000008a17959 t WebCore::MediaPlayerPrivateGStreamerBase::handleSyncMessage(_GstMessage*)::{lambda()#1}&& std::forward<WebCore::MediaPlayerPrivateGStreamerBase::handleSyncMessage(_GstMessage*)::{lambda()#1}>(std::remove_reference<WebCore::MediaPlayerPrivateGStreamerBase::handleSyncMessage(_GstMessage*)::{lambda()#1}>::type&)
000000000bdac7d0 r WebCore::MediaPlayerPrivateGStreamerBase::handleSyncMessage(_GstMessage*)::__FUNCTION__
000000000bdac800 r WebCore::MediaPlayerPrivateGStreamerBase::handleSyncMessage(_GstMessage*)::__PRETTY_FUNCTION__
0000000008a11834 t WebCore::MediaPlayerPrivateGStreamerBase::handleSyncMessage(_GstMessage*)::{lambda()#2}::operator()() const
0000000008a115a4 t WebCore::MediaPlayerPrivateGStreamerBase::handleSyncMessage(_GstMessage*)::{lambda()#1}::operator()() const
0000000008a18128 t WebCore::MediaPlayerPrivateGStreamerBase::handleSyncMessage(_GstMessage*)::{lambda()#1}::_GstMessage({lambda()#1}&&)
0000000008a18128 t WebCore::MediaPlayerPrivateGStreamerBase::handleSyncMessage(_GstMessage*)::{lambda()#1}::_GstMessage({lambda()#1}&&)
0000000008a117f8 t WebCore::MediaPlayerPrivateGStreamerBase::handleSyncMessage(_GstMessage*)::{lambda()#1}::~_GstMessage()
0000000008a117f8 t WebCore::MediaPlayerPrivateGStreamerBase::handleSyncMessage(_GstMessage*)::{lambda()#1}::~_GstMessage()
000000000bdaddc8 r WebCore::MediaPlayerPrivateGStreamerBase::handleSyncMessage(_GstMessage*)::{lambda()#1}::operator()() const::__FUNCTION__
我尝试打破MediaPlayerPrivateGStreamerBase
符号以及MediaMediaPlayerPrivateGStreamer
符号,但没有成功。
编辑2
另一次尝试,
(gdb) rbreak ^WebCore::MediaPlayerPrivateGStreamerBase::handleSyncMessage
Breakpoint 1 at 0x7fffed84bcf0
<function, no debug info> WebCore::MediaPlayerPrivateGStreamerBase::handleSyncMessage(_GstMessage*)@plt;
所以我猜基础问题是为什么GDB只在过程链接表而不是真正的库函数上设置了中断?人们甚至如何在Linux平台上调试?这似乎完全是疯了。毋庸置疑,即使是plt条目上的断点也没有触发..