无法检查lldb中的std :: string变量

问题描述 投票:0回答:1

[当我尝试使用LLDB检查std :: string变量时,出现“错误:摘要字符串分析错误”。

#include <iostream>
#include <string>

int main() {
    std::string a{"123"};
    std::cout << a << std::endl;
    return 0;
}
Process 4492 stopped
* thread #1, name = 'main', stop reason = breakpoint 1.1
    frame #0: 0x00005555555551e9 main`main at main.cpp:6:1
   3    
   4    int main() {
   5        std::string a{"123"};
-> 6        std::cout << a << std::endl;
   7        return 0;
   8    }
(lldb) v a
(std::string) a = error: summary string parsing error

附加信息:

$ clang++ --version
clang version 8.0.1 (tags/RELEASE_801/final)
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
$ lldb --version
lldb version 8.0.1
uname -s -r -m -o
Linux 5.3.5-arch1-1-ARCH x86_64 GNU/Linux
c++ clang lldb clang++
1个回答
0
投票

尝试使用-fstandalone-debug标志重新编译您的源代码。我今天使用lldb时遇到了同样的问题,当我尝试按字符访问字符串时,它抛出了一个错误,建议使用此标志进行编译。重新编译二进制lldb处理的字符串后,就可以了。

© www.soinside.com 2019 - 2024. All rights reserved.