LLDB调试器无法打印结构内容
lldb debugger cannot print structure contents
我编译了一个使用asl_log的小程序,当在lldb中运行时,它无法从'aslclient'类型中打印全局变量的内容,尽管我在调试模式('-g'标志)下编译。
也许你可以告诉我这是否与以下错误有关,以及如何解决这个问题
[lldb-dev] [Bug 16191] New: LLDB fails to evaluate expressions that
dereference a struct when inferior is built with recent Clang
调试器的输入:
(lldb) print log_asl_client
(aslclient) $5 = 0x0000000100200000
(lldb) print *log_asl_client
(lldb) print *log_asl_client
error: incomplete type '__asl_object_s' where a complete type is required
note: forward declaration of '__asl_object_s'
error: 1 errors parsing expression
我的编译命令:
clang -g -c -Wall -DDEBUG=1 example.c -o example.o
clang example.o -o example
代码:
aslclient log_asl_client;
...
int main(int argc, char * const *argv) {
...
log_asl_client = asl_open(identity, facility, client_opts);
...
--> at this point i initiate the print command in debug mode.
我使用的版本:
clang --version
Apple LLVM version 6.1.0 (clang-602.0.53) (based on LLVM 3.6.0svn)
Target: x86_64-apple-darwin14.3.0
Thread model: posix
谢谢,
调试信息有对__asl_object_s
的前向引用的记录,但没有完整类型的记录。在这种特殊情况下,这并不完全令人惊讶,因为__asl_object_s
在OS X的公共头文件中的唯一出现是:
typedef struct __asl_object_s *asl_object_t;
所以这是对结构体的不透明引用,没有真正的定义。据推测,__asl_object_s
是一个占位符,指针在使用时被强制转换为它实际是什么。
无论如何,调试器并没有拒绝显示一些东西,实际上那里没有什么可看的…
相关文章:
- 如何循环打印顶点结构
- 如何将结构插入到集合中并打印集合的成员
- C++ 打印包含数据结构的数组
- 使用链表数据结构打印多项式
- 如何在级别上打印树,给定一个结构,该结构保存节点的值及其父节点的值,对于树中的每个节点
- 将文件目录打印到数据结构中
- 在结构向量中搜索一个数据成员,然后打印匹配的所有数据成员
- 从 STL 优先级队列C++ (QtCreator) 打印结构
- 如何在 c++ 中打印结构
- 是否有一个很好的方法可以在C 11中打印出像JSON一样的Trie结构(仅迭代解决方案)的扁平命名空间
- 从右到左计算当前索引中的数据结构中的元素数,并打印每个元素的计数
- 在结构成员的打印价值时遇到困难
- 如何从我的结构中打印人口最多的状态
- 在模板功能中打印任何结构
- 如何打印出结构指针
- 如何在我从文件中读取的结构中打印数据
- c++ 从结构体打印
- 使用泛型函数调用打印结构的所有嵌套成员变量
- C++层次结构打印练习
- 简单的输入/输出控制台应用程序,不按给定的顺序(结构)打印问题