[英]lldb C++ debug for stl container containing dynamic class
I am writing C++ on Xcode and the only choice is lldb. 我在Xcode上编写C ++,唯一的选择是lldb。 I define a variable with the type of 我用以下类型定义变量
std::list<State> states;
and the Class is a self defined class. 该类是一个自定义的类。 I tried to use expr command and frame variable , but they can't help. 我尝试使用expr命令和frame变量 ,但它们无济于事。
The result for expr is expr的结果是
error: Couldn't materialize struct: size of variable states (24) disagrees with the ValueObject's size (0) 错误:无法实现结构:变量状态(24)的大小与ValueObject的大小(0)不同
and result for frame variable is 帧变量的结果是
(std::__1::list<State, std::__1::allocator<State> >) states = <variable not available>
The variable has been optimized away at this point in your program. 此时,该变量已在程序中进行了优化。 The error message from expr
/ p
is a little unfortunate - there's a change in top of tree which should allow the real error to be emitted - but the behavior is correct. 来自expr
/ p
的错误消息有点不幸-树的顶部发生了变化,这应该允许发出真正的错误-但行为是正确的。 The frame variable
output is the correct error message. frame variable
输出是正确的错误消息。
You can always do 你总是可以做
(lldb) image lookup -v -a $pc
to see the locations of all visible variables at a point in your program. 以查看程序中某个点处所有可见变量的位置。 They are expressed in the form of a DWARF expression which is usually expressed in terms of the frame base register ( DW_OP_fbreg
) which is usually rbp
on x86_64 for instance. 它们以DWARF表达式的形式表示,通常以帧基址寄存器( DW_OP_fbreg
)的形式表示,例如,它通常在x86_64上为rbp
。
If a variable is listed with an empty location=
field, that means that the variable's value is not available at this pc location. 如果列出的变量带有空的location=
字段,则表示该变量的值在此pc位置不可用。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.