如何检查LLDB是否从共享库中加载了调试符号? [英] How to check if LLDB loaded debug symbols from shared libraries?

查看:148
本文介绍了如何检查LLDB是否从共享库中加载了调试符号?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Linux上使用

(gdb) i shared

gdb和gdb中的

打印一个库列表,如果没有加载调试符号,则用星号*;如果未加载调试符号,则不带库,例如:

in gdb and gdb prints a list of libraries either with a star * if no debug symbols are loaded or without it if loaded, e.g:

0x0000000100c18660  0x0000000100c489a0  Yes (*)     /Users/anon/work/software/webrtc-audio-processing-0.1/build_darwin/../bin/darwin/lib/libwebrtc_audio_processing.0.dylib
0x0000000100c57ca0  0x0000000100c76978  Yes         /Users/anon/work/software/speex/speex/speex-1.2rc2/build_darwin/../bin/darwin/lib/libspeex.1.dylib

我发现在LLDB中我应该使用

I found that in LLDB I should use

(lldb) image list

执行相同的操作.但是我得到了一个库列表,它对是否为lib加载调试符号没有任何帮助,例如:

to do the same. But I get a list of libraries which says nothing to me on whether debug symbols are loaded for the lib or not, e.g:

[181] 19269C1D-EB29-384A-83F3-7DDDEB7D9DAD 0x00007fff8d2d3000 /System/Library/PrivateFrameworks/CoreWiFi.framework/Versions/A/CoreWiFi
[182] 8D7BA9BA-EB36-307A-9119-0B3D9732C953 0x00007fff879ee000 /System/Library/Frameworks/CoreBluetooth.framework/Versions/A/CoreBluetooth
[183] 6F03761D-7C3A-3C80-8031-AA1C1AD7C706 0x00007fff92e52000 /System/Library/PrivateFrameworks/DebugSymbols.framework/Versions/A/DebugSymbols

那我如何检查LLDB是否加载了调试符号?

So how do I check if debug symbols are loaded by LLDB?

更新:我刚决定发布(lldb) image lookup -vn <function>的输出(感谢吉姆),让其他人知道它的外观:

UPDATE: I just decided to post output of (lldb) image lookup -vn <function> (thanks Jim) for others to know what it looks like:

image lookup -vn Herqq::Upnp::HSsdp::init
2 matches found in libHUpnp.2.dylib:
        Address: libHUpnp.2.dylib[0x00000000000283f0] (libHUpnp.2.dylib.__TEXT.__text + 150384)
        Summary: libHUpnp.2.dylib`Herqq::Upnp::HSsdp::init() at hssdp.cpp:804
         Module: file = "libHUpnp.2.dylib", arch = "x86_64"
    CompileUnit: id = {0x00000000}, file = "/Users/blade/work/software/HUPnP/build-herqq-Desktop_Qt_5_5_0_clang_64bit-Debug/hupnp/../../herqq/hupnp/src/ssdp/hssdp.cpp", language = "c89"
       Function: id = {0xa0002401f}, name = "init", range = [0x00000000000283f0-0x0000000000028511)
       FuncType: id = {0xa0002401f}, decl = hssdp.h:304, clang_type = "_Bool (void)"
         Blocks: id = {0xa0002401f}, range = [0x000283f0-0x00028511)
      LineEntry: [0x00000000000283f0-0x00000000000283ff): /Users/blade/work/software/HUPnP/build-herqq-Desktop_Qt_5_5_0_clang_64bit-Debug/hupnp/../../herqq/hupnp/src/ssdp/hssdp.cpp:804
         Symbol: id = {0x00000c9b}, range = [0x00000000000283f0-0x0000000000028520), name="Herqq::Upnp::HSsdp::init()", mangled="_ZN5Herqq4Upnp5HSsdp4initEv"
       Variable: id = {0xa0002403a}, name = "this", type= "Herqq::Upnp::HSsdp *", location = DW_OP_fbreg(-16), decl =
       Variable: id = {0xa00024047}, name = "herqqLog__", type= "HLogger", location = DW_OP_fbreg(-32), decl = hssdp.cpp:805
       Variable: id = {0xa00024056}, name = "ha", type= "QHostAddress", location = DW_OP_fbreg(-56), decl = hssdp.cpp:812
        Address: libHUpnp.2.dylib[0x0000000000028550] (libHUpnp.2.dylib.__TEXT.__text + 150736)
        Summary: libHUpnp.2.dylib`Herqq::Upnp::HSsdp::init(QHostAddress const&) at hssdp.cpp:817
         Module: file = "libHUpnp.2.dylib", arch = "x86_64"
    CompileUnit: id = {0x00000000}, file = "/Users/blade/work/software/HUPnP/build-herqq-Desktop_Qt_5_5_0_clang_64bit-Debug/hupnp/../../herqq/hupnp/src/ssdp/hssdp.cpp", language = "ISO C++:1998"
       Function: id = {0xa0002408f}, name = "init", range = [0x0000000000028550-0x000000000002862d)
       FuncType: id = {0xa0002408f}, decl = hssdp.h:321, clang_type = "_Bool (const class QHostAddress &)"
         Blocks: id = {0xa0002408f}, range = [0x00028550-0x0002862d)
      LineEntry: [0x0000000000028550-0x0000000000028564): /Users/blade/work/software/HUPnP/build-herqq-Desktop_Qt_5_5_0_clang_64bit-Debug/hupnp/../../herqq/hupnp/src/ssdp/hssdp.cpp:817
         Symbol: id = {0x00000ca3}, range = [0x0000000000028550-0x0000000000028630), name="Herqq::Upnp::HSsdp::init(QHostAddress const&)", mangled="_ZN5Herqq4Upnp5HSsdp4initERK12QHostAddress"
       Variable: id = {0xa000240aa}, name = "this", type= "Herqq::Upnp::HSsdp *", location = DW_OP_fbreg(-16), decl =
       Variable: id = {0xa000240b7}, name = "unicastAddress", type= "const QHostAddress &", location = DW_OP_fbreg(-24), decl = hssdp.cpp:816
       Variable: id = {0xa000240c6}, name = "herqqLog__", type= "HLogger", location = DW_OP_fbreg(-40), decl = hssdp.cpp:818

推荐答案

如果您的二进制文件是使用dSYM构建的,则dSYM将显示在二进制文件在图像列表中列出的行之后.

If your binary was built with a dSYM, then the dSYM will show up on the line after the binary's listing in image list.

如果二进制文件使用的是将调试信息保留在.o文件中"样式,这是一种简单的方法,这是Xcode中调试"配置的默认样式.我提出了一个错误,使它更容易看到.

There isn't an easy way to do this if the binary is using the "leave the debug information in the .o file" style which is the default for the Debug configuration in Xcode. I filed a bug to make that easier to see.

一种相当简单的方法是:

One fairly simple way to do it is:

(lldb) image lookup -vn <SomeFunctionNameThatShouldHaveDebugInfo>

如果该命令的输出包含CompileUnit,则包含该函数的.o文件具有调试信息,否则,则没有.

If the output of that command includes a CompileUnit, then the .o file containing that function has debug information, otherwise, not.

这篇关于如何检查LLDB是否从共享库中加载了调试符号?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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