繁体   English   中英

GDB没有看到来源

[英]GDB doesn't see sources

我有以下问题。 我运行了一个创建了多个线程的程序。 Gdb输出以下线程:

(gdb) info thread
  Id   Target Id         Frame 
  3    LWP 23941         0x00007f5fc327c2d4 in ?? ()
  2    LWP 22925         0x00007f5fc327e420 in ?? ()
* 1    LWP 23934         0x00007f5fc2779475 in ?? ()

第二个线程的Backtrace如下所示:

(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*) ()
....

回溯使我满意,因为我知道程序在哪里停止。 我对第一个回溯感到困惑:

(gdb) thread 1
[Switching to thread 1 (LWP 23934)]
#0  0x00007f5fc2779475 in ?? ()
(gdb) bt
#0  0x00007f5fc2779475 in ?? ()
#1  0x00007f5fc277c675 in ?? ()
#2  0x0000000000000000 in ?? ()

也许这个线程运行到一个共享库中,在该库中我没有调试符号和源,我也同意。 我想知道我的程序在哪里调用了共享库方法。 我无法通过此回溯来确定它。 我可以下载一些带有调试符号的共享库,但是如何知道哪个共享库进入了线程? 也许这是使用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文件中的某个位置set auto-solib-add off

您应该可以通过以下任一方法解决此问题

  • (gdb) shared . -强制GDB读取所有共享库,或者
  • 只需从任何地方取出set auto-solib-add off

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM