gpt4 book ai didi

c++ - GDB输出的解释

转载 作者:行者123 更新时间:2023-11-28 05:58:38 28 4
gpt4 key购买 nike

我没怎么用过GDB。通常我检查简单变量但从不检查类。这次我正在检查类,因为我开始一个新项目 (LLVM)。

这是

的输出

disp CachedTable


CachedTable = {<llvm::DenseMapBase<llvm::DenseMap<std::pair<unsigned int, unsigned int>, unsigned int, llvm::DenseMapInfo<std::pair<unsigned int, unsigned int> > >, std::pair<unsigned int, unsigned int>, unsigned int, llvm::DenseMapInfo<std::pair<unsigned int, unsigned int> > >> = {<No data fields>}, Buckets = 0x1a9e190, NumEntries = 2, NumTombstones = 0, NumBuckets = 64}

我如何解释这个输出?

感谢任何帮助。

最佳答案

这是 llvm::DenseMap 类的数据成员的输出。
( http://llvm.org/docs/doxygen/html/DenseMap_8h_source.html )

输出的第一部分意味着它的基类 llvm::DenseMapBase 没有数据成员:

<llvm::DenseMapBase<llvm::DenseMap<std::pair<unsigned int, unsigned int>, unsigned int, llvm::DenseMapInfo<std::pair<unsigned int, unsigned int> > >, std::pair<unsigned int, unsigned int>, unsigned int, llvm::DenseMapInfo<std::pair<unsigned int, unsigned int> > >> = {<No data fields>}

其余输出打印 llvm::DenseMap 数据成员值:

Buckets = 0x1a9e190, NumEntries = 2, NumTombstones = 0, NumBuckets = 64

通常很难像这样解释一行输出,尤其是对于来自未知代码的长结构/类,因此值得打开 gdb 的 pretty-print 模式:

(gdb) set print pretty on 

参见 Print Settings :

set print pretty on
Cause gdb to print structures in an indented format with one member per line, like this:

$1 = {
next = 0x0,
flags = {
sweet = 1,
sour = 1
},
meat = 0x54 "Pork"
}

关于c++ - GDB输出的解释,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33703227/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com