【发布时间】:2014-10-09 18:05:31
【问题描述】:
我已经用这个命令行编译了一个cpp文件:g++ -g test.cpp
它在第 28 行抛出异常。我想通过检查 lldb 中的变量来调查原因。我在第 28 行设置了一个断点并在 lldb 中运行 a.out。
(lldb) n
Process 84233 stopped
* thread #1: tid = 0xa44b86, 0x00000001000017fb a.out`say(s=<unavailable>) + 987 at so.cpp:28, queue = 'com.apple.main-thread', stop reason = step over
frame #0: 0x00000001000017fb a.out`say(s=<unavailable>) + 987 at so.cpp:28
25 }
26 else{
27 s.insert(0, to_string(sz));
-> 28 s.erase(2, sz-1);
29 }
30 return s;
31 }
(lldb) po s
error: Couldn't materialize: couldn't get the value of variable s: variable not available
Errored out in Execute, couldn't PrepareToExecuteJITExpression
为什么会出现错误消息?如何检查变量s?
lldb 版本:lldb-320.4.115.3
g++ 版本:Configured with: --prefix=/Applications/Xcode6-Beta5.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 6.0 (clang-600.0.45.3) (based on LLVM 3.5svn)
Target: x86_64-apple-darwin13.3.0
Thread model: posix
【问题讨论】:
标签: c++ osx-mavericks lldb