C++ 外部框架的lldb源路径

C++ 外部框架的lldb源路径,c++,xcode,debugging,lldb,C++,Xcode,Debugging,Lldb,我在macOS上制作了一个小的WebRTC播放器,它与Googlelibwebrtc链接到我的WebRTC流媒体后端。但是我在libwebrtc中设置断点时遇到问题。例如,如果我在一个已知文件中设置一个断点,比如断点集--file packet_buffer.cc--line 365,lldb似乎会解析符号,因为lldb的输出是: Breakpoint 1: where = WebRTC`webrtc::video_coding::PacketBuffer::FindFrames(unsigne

我在macOS上制作了一个小的WebRTC播放器,它与Google
libwebrtc
链接到我的WebRTC流媒体后端。但是我在
libwebrtc
中设置断点时遇到问题。例如,如果我在一个已知文件中设置一个断点,比如
断点集--file packet_buffer.cc--line 365
,lldb似乎会解析符号,因为lldb的输出是:

Breakpoint 1: where = WebRTC`webrtc::video_coding::PacketBuffer::FindFrames(unsigned short) + 1827 at packet_buffer.cc:365:11, address = 0x0000000101331183
但当遇到断点时,Xcode显示反汇编: 困扰我的是源代码(我不确定Xcode/lldb在哪里解析)到加载的应用程序或模块的根的相对路径

如果我使用该文件中的函数执行
图像查找
,例如
图像查找-vn webrtc::video_coding::PacketBuffer::Packet::Packet
,则输出显示lldb似乎找到了符号:

4 matches found in /Users/rudolfs/Git/webrtc-checkout/src/out/Debug/WebRTC.framework/WebRTC:
        Address: WebRTC[0x0000000000f1b8d0] (WebRTC.__TEXT.__text + 15835536)
        Summary: WebRTC`webrtc::video_coding::PacketBuffer::Packet::Packet(webrtc::RtpPacketReceived const&, webrtc::RTPVideoHeader const&, long long, long long) at packet_buffer.cc:58
         Module: file = "/Users/rudolfs/Git/webrtc-checkout/src/out/Debug/WebRTC.framework/WebRTC", arch = "x86_64"
    CompileUnit: id = {0x00000000}, file = "../../modules/video_coding/packet_buffer.cc", language = "c++14"
       Function: id = {0x4d30002c9f3}, name = "webrtc::video_coding::PacketBuffer::Packet::Packet(webrtc::RtpPacketReceived const&, webrtc::RTPVideoHeader const&, long long, long long)", mangled = "_ZN6webrtc12video_coding12PacketBuffer6PacketC2ERKNS_17RtpPacketReceivedERKNS_14RTPVideoHeaderExx", range = [0x000000010132e8d0-0x000000010132ea72)
       FuncType: id = {0x4d30002c9f3}, byte-size = 0, decl = packet_buffer.h:38, compiler_type = "void (const class webrtc::RtpPacketReceived &, const struct webrtc::RTPVideoHeader &, int64_t, int64_t)"
         Blocks: id = {0x4d30002c9f3}, range = [0x10132e8d0-0x10132ea72)
      LineEntry: [0x000000010132e8d0-0x000000010132e901): ../../modules/video_coding/packet_buffer.cc:58
         Symbol: id = {0x00057dfa}, range = [0x000000010132e8d0-0x000000010132ea80), name="webrtc::video_coding::PacketBuffer::Packet::Packet(webrtc::RtpPacketReceived const&, webrtc::RTPVideoHeader const&, long long, long long)", mangled="_ZN6webrtc12video_coding12PacketBuffer6PacketC2ERKNS_17RtpPacketReceivedERKNS_14RTPVideoHeaderExx"
       Variable: id = {0x4d30002ca11}, name = "this", type = "webrtc::video_coding::PacketBuffer::Packet *", location = DW_OP_fbreg(-80), decl = 
       Variable: id = {0x4d30002ca1f}, name = "rtp_packet", type = "const webrtc::RtpPacketReceived &", location = DW_OP_fbreg(-88), decl = packet_buffer.cc:42
       Variable: id = {0x4d30002ca2e}, name = "video_header", type = "const webrtc::RTPVideoHeader &", location = DW_OP_fbreg(-96), decl = packet_buffer.cc:43
       Variable: id = {0x4d30002ca3d}, name = "ntp_time_ms", type = "int64_t", location = DW_OP_fbreg(-104), decl = packet_buffer.cc:44
       Variable: id = {0x4d30002ca4c}, name = "receive_time_ms", type = "int64_t", location = DW_OP_fbreg(-112), decl = packet_buffer.cc:45
        Address: WebRTC[0x0000000000f1ba80] (WebRTC.__TEXT.__text + 15835968)
        Summary: WebRTC`webrtc::video_coding::PacketBuffer::Packet::Packet(webrtc::RtpPacketReceived const&, webrtc::RTPVideoHeader const&, long long, long long) at packet_buffer.cc:58
         Module: file = "/Users/rudolfs/Git/webrtc-checkout/src/out/Debug/WebRTC.framework/WebRTC", arch = "x86_64"
    CompileUnit: id = {0x00000000}, file = "../../modules/video_coding/packet_buffer.cc", language = "c++14"
       Function: id = {0x4d30002cbf0}, name = "webrtc::video_coding::PacketBuffer::Packet::Packet(webrtc::RtpPacketReceived const&, webrtc::RTPVideoHeader const&, long long, long long)", mangled = "_ZN6webrtc12video_coding12PacketBuffer6PacketC1ERKNS_17RtpPacketReceivedERKNS_14RTPVideoHeaderExx", range = [0x000000010132ea80-0x000000010132eabb)
       FuncType: id = {0x4d30002cbf0}, byte-size = 0, decl = packet_buffer.h:38, compiler_type = "void (const class webrtc::RtpPacketReceived &, const struct webrtc::RTPVideoHeader &, int64_t, int64_t)"
         Blocks: id = {0x4d30002cbf0}, range = [0x10132ea80-0x10132eabb)
      LineEntry: [0x000000010132ea80-0x000000010132eaa0): ../../modules/video_coding/packet_buffer.cc:58
         Symbol: id = {0x00057dfe}, range = [0x000000010132ea80-0x000000010132eac0), name="webrtc::video_coding::PacketBuffer::Packet::Packet(webrtc::RtpPacketReceived const&, webrtc::RTPVideoHeader const&, long long, long long)", mangled="_ZN6webrtc12video_coding12PacketBuffer6PacketC1ERKNS_17RtpPacketReceivedERKNS_14RTPVideoHeaderExx"
       Variable: id = {0x4d30002cc0e}, name = "this", type = "webrtc::video_coding::PacketBuffer::Packet *", location = DW_OP_fbreg(-8), decl = 
       Variable: id = {0x4d30002cc1b}, name = "rtp_packet", type = "const webrtc::RtpPacketReceived &", location = DW_OP_fbreg(-16), decl = packet_buffer.cc:42
       Variable: id = {0x4d30002cc29}, name = "video_header", type = "const webrtc::RTPVideoHeader &", location = DW_OP_fbreg(-24), decl = packet_buffer.cc:43
       Variable: id = {0x4d30002cc37}, name = "ntp_time_ms", type = "int64_t", location = DW_OP_fbreg(-32), decl = packet_buffer.cc:44
       Variable: id = {0x4d30002cc45}, name = "receive_time_ms", type = "int64_t", location = DW_OP_fbreg(-40), decl = packet_buffer.cc:45
        Address: WebRTC[0x0000000000f23740] (WebRTC.__TEXT.__text + 15867904)
        Summary: WebRTC`webrtc::video_coding::PacketBuffer::Packet::Packet() at packet_buffer.h:37
         Module: file = "/Users/rudolfs/Git/webrtc-checkout/src/out/Debug/WebRTC.framework/WebRTC", arch = "x86_64"
    CompileUnit: id = {0x00000000}, file = "../../modules/video_coding/packet_buffer.cc", language = "c++14"
       Function: id = {0x4d300038648}, name = "webrtc::video_coding::PacketBuffer::Packet::Packet()", mangled = "_ZN6webrtc12video_coding12PacketBuffer6PacketC1Ev", range = [0x0000000101336740-0x000000010133675b)
       FuncType: id = {0x4d300038648}, byte-size = 0, decl = packet_buffer.h:37, compiler_type = "void (void)"
         Blocks: id = {0x4d300038648}, range = [0x101336740-0x10133675b)
      LineEntry: [0x0000000101336740-0x0000000101336750): ../../modules/video_coding/packet_buffer.h:37
         Symbol: id = {0x0005803a}, range = [0x0000000101336740-0x0000000101336760), name="webrtc::video_coding::PacketBuffer::Packet::Packet()", mangled="_ZN6webrtc12video_coding12PacketBuffer6PacketC1Ev"
       Variable: id = {0x4d300038664}, name = "this", type = "webrtc::video_coding::PacketBuffer::Packet *", location = DW_OP_fbreg(-8), decl = 
        Address: WebRTC[0x0000000000f23760] (WebRTC.__TEXT.__text + 15867936)
        Summary: WebRTC`webrtc::video_coding::PacketBuffer::Packet::Packet() at packet_buffer.h:37
         Module: file = "/Users/rudolfs/Git/webrtc-checkout/src/out/Debug/WebRTC.framework/WebRTC", arch = "x86_64"
    CompileUnit: id = {0x00000000}, file = "../../modules/video_coding/packet_buffer.cc", language = "c++14"
       Function: id = {0x4d300038672}, name = "webrtc::video_coding::PacketBuffer::Packet::Packet()", mangled = "_ZN6webrtc12video_coding12PacketBuffer6PacketC2Ev", range = [0x0000000101336760-0x00000001013367e3)
       FuncType: id = {0x4d300038672}, byte-size = 0, decl = packet_buffer.h:37, compiler_type = "void (void)"
         Blocks: id = {0x4d300038672}, range = [0x101336760-0x1013367e3)
      LineEntry: [0x0000000101336760-0x0000000101336770): ../../modules/video_coding/packet_buffer.h:37
         Symbol: id = {0x0005803e}, range = [0x0000000101336760-0x00000001013367f0), name="webrtc::video_coding::PacketBuffer::Packet::Packet()", mangled="_ZN6webrtc12video_coding12PacketBuffer6PacketC2Ev"
       Variable: id = {0x4d30003868e}, name = "this", type = "webrtc::video_coding::PacketBuffer::Packet *", location = DW_OP_fbreg(-8), decl =
有重复的条目似乎很奇怪(我不知道为什么),但至少lldb似乎知道名称。另一件让我担心的事情是
CompileUnit
中的相对路径,但我不确定如何修复它(在构建libwebrtc时编译标志?)。如果将
/Users/rudolfs/Git/webrtc checkout/src/out/Debug/webrtc.framework/
作为基本名称,则相对路径不正确,因为它应该是
。/../../modules
,但lldb可能会以不同的方式对待框架,并使用
/Users/rudolfs/Git/webrtc checkout/src/out/Debug
作为基本路径

我在这里看到了许多关于
target.source map
的问题,但我不明白这是否有帮助,我应该覆盖什么


我还尝试在Xcode方案中设置自定义工作目录(to
/Users/rudolfs/Git/webrtc checkout/src/out/Debug
)希望不会解析相对路径,但这没有帮助。

图像查找-v的输出显示此源代码行的4个匹配项--此方法内联在四个不同的位置(最后两个看起来像一个ctor)

查看
行条目
s,lldb试图在
。/../modules/video\u coding/packet\u buffer.cc:58
。/../modules/video\u coding/packet\u buffer.h:37

对于lldb来说,这将是一个棘手的问题。编译器已创建具有相对路径的调试信息。我原以为大多数编译器会尝试为调试信息找到源文件位置的绝对路径,但我已经有一段时间没有研究过这样的问题了。如果您现在使用相对路径名调用编译器,那么使用绝对源路径名调用编译器可能会起作用

一个常见的问题是,当源代码在一台计算机上以
/build dir
的形式编译时,但在调试系统上,源代码位于
/src dir
中——有一个专门针对这种情况的lldb设置,
target.source map
,它在调试时查找源代码时重新映射调试信息中的文件路径。但这对你没有帮助