flashburn
flashburn

Reputation: 4538

Interpretation of GDB output

I haven't used GDB much. Usually I examine simple variables but never classes. This time I'm examining classes as I'm starting on a new project (LLVM).

Here is the output of

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}

How do I interpret this output?

Any help is appreciated.

Upvotes: 0

Views: 311

Answers (1)

ks1322
ks1322

Reputation: 35845

This is output of data members of llvm::DenseMap class.
(http://llvm.org/docs/doxygen/html/DenseMap_8h_source.html)

The first part of output means that it's base class llvm::DenseMapBase has no data members:

<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>}

The rest output prints llvm::DenseMap data members values:

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

Usually it's hard to interpret one line outputs like this, especially for long structs/classes from unknown code, so it's worth to turn on gdb's pretty printing mode:

(gdb) set print pretty on 

See 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"
              }

Upvotes: 1

Related Questions