retdec
debugformat.h
Go to the documentation of this file.
1 
7 #ifndef RETDEC_DEBUGFORMAT_DEBUGFORMAT_H
8 #define RETDEC_DEBUGFORMAT_DEBUGFORMAT_H
9 
10 #include <llvm/DebugInfo/DIContext.h>
11 #include <llvm/DebugInfo/DWARF/DWARFContext.h>
12 #include <llvm/Object/ObjectFile.h>
13 #include <llvm/Support/Debug.h>
14 #include <llvm/Support/Format.h>
15 #include <llvm/Support/MemoryBuffer.h>
16 
17 #include "retdec/common/function.h"
18 #include "retdec/common/object.h"
19 #include "retdec/common/type.h"
21 
24 #include "retdec/loader/loader.h"
25 
26 namespace retdec {
27 namespace debugformat {
28 
33 {
34  public:
35  using SymbolTable = std::map<retdec::common::Address, const retdec::fileformat::Symbol*>;
36 
37  public:
38  DebugFormat();
40  retdec::loader::Image* inFile,
41  const std::string& pdbFile,
42  SymbolTable* symtab,
44  );
45 
48 
49  bool hasInformation() const;
50 
51  private:
52  void loadPdb();
53  void loadPdbTypes();
55  void loadPdbFunctions();
57 
58  void loadDwarf();
59  void loadDwarf_CU(llvm::DWARFDie die);
61  std::string loadDwarf_type(llvm::DWARFDie die);
62  std::string _loadDwarf_type(llvm::DWARFDie die);
64  llvm::DWARFDie die,
65  unsigned argCntr);
66  retdec::common::Object loadDwarf_variable(llvm::DWARFDie die);
67 
68  void loadSymtab();
69 
70  private:
72  std::string _inputFile;
74  SymbolTable* _symtab = nullptr;
81 
83  std::map<std::pair<llvm::DWARFUnit*, uint32_t>, std::string> dieOff2type;
84 
85  public:
88 
89  std::map<retdec::common::Address, retdec::common::Function> functions;
90 };
91 
92 } // namespace debugformat
93 } // namespace retdec
94 
95 #endif
Definition: address.h:21
Definition: function.h:36
Definition: object.h:123
Definition: object.h:34
Definition: type.h:22
Definition: debugformat.h:33
void loadPdbGlobalVariables()
Definition: pdb.cpp:43
std::string _inputFile
Input file used to initialize this debug information.
Definition: debugformat.h:72
SymbolTable * _symtab
Symbol table to read symbols from.
Definition: debugformat.h:74
std::string _loadDwarf_type(llvm::DWARFDie die)
Definition: dwarf.cpp:284
std::map< retdec::common::Address, retdec::common::Function > functions
Definition: debugformat.h:89
retdec::common::Type loadPdbType(retdec::pdbparser::PDBTypeDef *type)
Definition: pdb.cpp:156
const retdec::common::Object * getGlobalVar(retdec::common::Address a)
Definition: debugformat.cpp:132
retdec::common::Object loadDwarf_formal_parameter(llvm::DWARFDie die, unsigned argCntr)
Definition: dwarf.cpp:492
retdec::common::Object loadDwarf_variable(llvm::DWARFDie die)
Definition: dwarf.cpp:519
retdec::pdbparser::PDBFile * _pdbFile
Underlying PDB representation.
Definition: debugformat.h:78
std::string loadDwarf_type(llvm::DWARFDie die)
Definition: dwarf.cpp:257
retdec::common::TypeContainer types
Definition: debugformat.h:87
void loadDwarf_CU(llvm::DWARFDie die)
Definition: dwarf.cpp:77
retdec::common::GlobalVarContainer globals
Definition: debugformat.h:86
void loadPdb()
Definition: pdb.cpp:14
void loadPdbTypes()
Definition: pdb.cpp:24
std::map< std::pair< llvm::DWARFUnit *, uint32_t >, std::string > dieOff2type
Dwarf named types cache.
Definition: debugformat.h:83
retdec::common::Function * getFunction(retdec::common::Address a)
Definition: debugformat.cpp:126
retdec::demangler::Demangler * _demangler
Demangler.
Definition: debugformat.h:80
retdec::loader::Image * _inFile
Underlying binary file representation.
Definition: debugformat.h:76
void loadPdbFunctions()
Definition: pdb.cpp:66
bool hasInformation() const
Definition: debugformat.cpp:65
std::map< retdec::common::Address, const retdec::fileformat::Symbol * > SymbolTable
Definition: debugformat.h:35
DebugFormat()
Definition: debugformat.cpp:17
retdec::common::Function loadDwarf_subprogram(llvm::DWARFDie die)
Definition: dwarf.cpp:106
void loadDwarf()
Definition: dwarf.cpp:28
void loadSymtab()
Definition: debugformat.cpp:73
Definition: demangler_base.h:31
Definition: image.h:22
Definition: pdb_file.h:133
Definition: pdb_types.h:84
Common function representation.
Common object representation.
Common data type representation.
File to include for demangling work.
Interface to fileformat library.
Interface to loader library.
std::set< Type > TypeContainer
Definition: type.h:57
Definition: archive_wrapper.h:19
PDB file.