2015-02-08 08:29:29 +08:00
|
|
|
//===- PDBSymbolExe.cpp - ---------------------------------------*- C++ -*-===//
|
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2015-02-14 11:53:56 +08:00
|
|
|
#include "llvm/DebugInfo/PDB/PDBSymbolExe.h"
|
|
|
|
|
2015-02-23 06:03:38 +08:00
|
|
|
#include "llvm/DebugInfo/PDB/PDBSymDumper.h"
|
[llvm-pdbdump] More advanced class definition dumping.
Previously the dumping of class definitions was very primitive,
and it made it hard to do more than the most trivial of output
formats when dumping. As such, we would only dump one line for
each field, and then dump non-layout items like nested types
and enums.
With this patch, we do a complete analysis of the object
hierarchy including aggregate types, bases, virtual bases,
vftable analysis, etc. The only immediately visible effects
of this are that a) we can now dump a line for the vfptr where
before we would treat that as padding, and b) we now don't
treat virtual bases that come at the end of a class as padding
since we have a more detailed analysis of the class's storage
usage.
In subsequent patches, we should be able to use this analysis
to display a complete graphical view of a class's layout including
recursing arbitrarily deep into an object's base class / aggregate
member hierarchy.
llvm-svn: 300133
2017-04-13 07:18:21 +08:00
|
|
|
#include "llvm/DebugInfo/PDB/PDBSymbolTypePointer.h"
|
2015-02-08 08:29:29 +08:00
|
|
|
|
2015-02-14 11:53:56 +08:00
|
|
|
#include <utility>
|
|
|
|
|
2015-02-08 08:29:29 +08:00
|
|
|
using namespace llvm;
|
2016-05-05 04:32:13 +08:00
|
|
|
using namespace llvm::pdb;
|
2015-02-08 08:29:29 +08:00
|
|
|
|
2015-02-09 06:53:53 +08:00
|
|
|
PDBSymbolExe::PDBSymbolExe(const IPDBSession &PDBSession,
|
2015-02-09 04:58:09 +08:00
|
|
|
std::unique_ptr<IPDBRawSymbol> Symbol)
|
2017-04-10 14:14:09 +08:00
|
|
|
: PDBSymbol(PDBSession, std::move(Symbol)) {
|
|
|
|
assert(RawSymbol->getSymTag() == PDB_SymType::Exe);
|
|
|
|
}
|
2015-02-08 08:29:29 +08:00
|
|
|
|
2015-03-01 14:51:29 +08:00
|
|
|
void PDBSymbolExe::dump(PDBSymDumper &Dumper) const { Dumper.dump(*this); }
|
[llvm-pdbdump] More advanced class definition dumping.
Previously the dumping of class definitions was very primitive,
and it made it hard to do more than the most trivial of output
formats when dumping. As such, we would only dump one line for
each field, and then dump non-layout items like nested types
and enums.
With this patch, we do a complete analysis of the object
hierarchy including aggregate types, bases, virtual bases,
vftable analysis, etc. The only immediately visible effects
of this are that a) we can now dump a line for the vfptr where
before we would treat that as padding, and b) we now don't
treat virtual bases that come at the end of a class as padding
since we have a more detailed analysis of the class's storage
usage.
In subsequent patches, we should be able to use this analysis
to display a complete graphical view of a class's layout including
recursing arbitrarily deep into an object's base class / aggregate
member hierarchy.
llvm-svn: 300133
2017-04-13 07:18:21 +08:00
|
|
|
|
|
|
|
uint32_t PDBSymbolExe::getPointerByteSize() const {
|
|
|
|
auto Pointer = findOneChild<PDBSymbolTypePointer>();
|
|
|
|
if (Pointer)
|
|
|
|
return Pointer->getLength();
|
|
|
|
|
|
|
|
if (getMachineType() == PDB_Machine::x86)
|
|
|
|
return 4;
|
|
|
|
return 8;
|
|
|
|
}
|