C++ GDB不';我看不到消息来源
我有以下问题。我运行了一个创建了几个线程的程序。 Gdb输出以下线程:C++ GDB不';我看不到消息来源,c++,gdb,shared-libraries,C++,Gdb,Shared Libraries,我有以下问题。我运行了一个创建了几个线程的程序。 Gdb输出以下线程: (gdb) info thread Id Target Id Frame 3 LWP 23941 0x00007f5fc327c2d4 in ?? () 2 LWP 22925 0x00007f5fc327e420 in ?? () * 1 LWP 23934 0x00007f5fc2779475 in ?? () 第二个线
(gdb) info thread
Id Target Id Frame
3 LWP 23941 0x00007f5fc327c2d4 in ?? ()
2 LWP 22925 0x00007f5fc327e420 in ?? ()
* 1 LWP 23934 0x00007f5fc2779475 in ?? ()
第二个线程的回溯如下所示:
(gdb) thread 2
[Switching to thread 2 (LWP 22925)]
#0 0x00007f5fc327e420 in ?? ()
(gdb) bt
#0 0x00007f5fc327e420 in ?? ()
#1 0x00007f5fb406f300 in ?? ()
#2 0x0000000000439021 in AaSemWait (semPtr=0x7f5fb406f300) at ../bm/testing/unit/src/ccs/AaSem.cpp:97
#3 0x00000000004197d5 in bm_semaphore_base::wait (this=0x7fff75b01db8) at /home/michaelfrysztacki/bm_local_build2/BTS_SC_BM/bm/interface/framework/bm_semaphore.h:174
#4 0x0000000000500e1c in radio::thread_synchroniser::wait (this=0x7fff75b01c00) at /home/michaelfrysztacki/bm_local_build2/BTS_SC_BM/bm/radio/testing/stubs/radio_module_receiver.h:107
#5 0x00000000005034a5 in radio::mt_radio_service::send_messages (this=0x7f5fb406d140) at ../bm/radio/testing/unit/mt_radio_service.cpp:236
#6 0x0000000000503010 in radio::mt_radio_service::simulate_radio_modules (this=0x7f5fb406d140, set_timeoff_test=false) at ../bm/radio/testing/unit/mt_radio_service.cpp:189
#7 0x00000000004fde77 in radio::mt_radio_service_module_test_sending_message_and_receive_from_radio_service_Test::TestBody (this=0x7f5fb406d140) at ../bm/radio/testing/unit/mt_radio_service.cpp:347
#8 0x000000000069cab1 in void testing::internal::HandleSehExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) ()
....
也许这个线程运行到一个共享库中,在那里我没有调试符号和源代码,我可以接受它。我想知道我的程序在哪里调用了共享库方法。我不能用这个回溯来确定它。我可以下载一些带有调试符号的共享库,但如何知道哪个共享库进入了我的线程?或者这可能是使用pthread启动线程的入口点?为什么回溯这么差?最后,我不完全确定这是否是一个共享库,我如何才能获得它
(gdb) info sharedlibrary
warning: Can't read pathname for load map: Input/output error.
From To Syms Read Shared Object Library
No /lib/x86_64-linux-gnu/librt.so.1
No /lib/x86_64-linux-gnu/libexpat.so.1
No /usr/lib/libboost_thread.so.1.49.0
No /usr/lib/libboost_system.so.1.49.0
No /usr/local/lib/libprotobuf.so.8
No /lib/x86_64-linux-gnu/libpthread.so.0
No /usr/lib/x86_64-linux-gnu/libstdc++.so.6
No /lib/x86_64-linux-gnu/libm.so.6
No /lib/x86_64-linux-gnu/libgcc_s.so.1
No /lib/x86_64-linux-gnu/libc.so.6
No /lib64/ld-linux-x86-64.so.2
“info sharedlibrary”命令列出了没有调试符号的共享库。如何使用调试符号(和源代码)获取库,例如/usr/lib/libboost_thread.so.1.49.0?您的
info shared
输出显示GDB没有加载任何共享库的符号
最可能的原因是:您在~/.gdbinit
文件中的某个位置设置了auto solib add off
您应该能够通过以下任一方法解决此问题:
--强制gdb读取所有共享库,或(gdb)共享。
- 只要从任何地方取出
set auto solib add off
/usr/lib/debug/lib/x86_64-linux-gnulibpthread-2.11.1中,确保您使用的是类似的线程。第二个线程的回溯已经告诉我们,我的应用程序是用调试符号构建的。我在上面的第一篇文章中添加了一些关于缺少共享库调试符号的信息。一种可能是它(意味着您的代码:)损坏了另一个线程的堆栈跟踪。也许我会首先怀疑我的代码,除非我使用的是非常不保证的第三部分库。
(gdb) info sharedlibrary
warning: Can't read pathname for load map: Input/output error.
From To Syms Read Shared Object Library
No /lib/x86_64-linux-gnu/librt.so.1
No /lib/x86_64-linux-gnu/libexpat.so.1
No /usr/lib/libboost_thread.so.1.49.0
No /usr/lib/libboost_system.so.1.49.0
No /usr/local/lib/libprotobuf.so.8
No /lib/x86_64-linux-gnu/libpthread.so.0
No /usr/lib/x86_64-linux-gnu/libstdc++.so.6
No /lib/x86_64-linux-gnu/libm.so.6
No /lib/x86_64-linux-gnu/libgcc_s.so.1
No /lib/x86_64-linux-gnu/libc.so.6
No /lib64/ld-linux-x86-64.so.2