Skip to content

Commit 6489d7b

Browse files
author
Zachary Turner
committedApr 23, 2015
Move DIContext.h to common DebugInfo location.
This will enable us to create a PDBContext so as to expose some amount of debug info functionality through a common interace. Differential Revision: http://reviews.llvm.org/D9205 Reviewed by: Alexey Samsonov llvm-svn: 235612
1 parent 5461d45 commit 6489d7b

File tree

13 files changed

+30
-45
lines changed

13 files changed

+30
-45
lines changed
 

‎llvm/include/llvm/DebugInfo/DWARF/DIContext.h renamed to ‎llvm/include/llvm/DebugInfo/DIContext.h

+3-12
Original file line numberDiff line numberDiff line change
@@ -113,25 +113,16 @@ enum DIDumpType {
113113
DIDT_AppleObjC
114114
};
115115

116-
// In place of applying the relocations to the data we've read from disk we use
117-
// a separate mapping table to the side and checking that at locations in the
118-
// dwarf where we expect relocated values. This adds a bit of complexity to the
119-
// dwarf parsing/extraction at the benefit of not allocating memory for the
120-
// entire size of the debug info sections.
121-
typedef DenseMap<uint64_t, std::pair<uint8_t, int64_t> > RelocAddrMap;
122-
123116
class DIContext {
124117
public:
125118
enum DIContextKind {
126-
CK_DWARF
119+
CK_DWARF,
120+
CK_PDB
127121
};
128122
DIContextKind getKind() const { return Kind; }
129123

130124
DIContext(DIContextKind K) : Kind(K) {}
131-
virtual ~DIContext();
132-
133-
/// getDWARFContext - get a context for binary DWARF data.
134-
static DIContext *getDWARFContext(const object::ObjectFile &Obj);
125+
virtual ~DIContext() {}
135126

136127
virtual void dump(raw_ostream &OS, DIDumpType DumpType = DIDT_All) = 0;
137128

‎llvm/include/llvm/DebugInfo/DWARF/DWARFContext.h

+8-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
#include "llvm/ADT/MapVector.h"
1414
#include "llvm/ADT/SmallVector.h"
15-
#include "llvm/DebugInfo/DWARF/DIContext.h"
15+
#include "llvm/DebugInfo/DIContext.h"
1616
#include "llvm/DebugInfo/DWARF/DWARFCompileUnit.h"
1717
#include "llvm/DebugInfo/DWARF/DWARFDebugAranges.h"
1818
#include "llvm/DebugInfo/DWARF/DWARFDebugFrame.h"
@@ -25,6 +25,13 @@
2525

2626
namespace llvm {
2727

28+
// In place of applying the relocations to the data we've read from disk we use
29+
// a separate mapping table to the side and checking that at locations in the
30+
// dwarf where we expect relocated values. This adds a bit of complexity to the
31+
// dwarf parsing/extraction at the benefit of not allocating memory for the
32+
// entire size of the debug info sections.
33+
typedef DenseMap<uint64_t, std::pair<uint8_t, int64_t> > RelocAddrMap;
34+
2835
/// DWARFContext
2936
/// This data structure is the top level entity that deals with dwarf debug
3037
/// information parsing. The actual data is supplied through pure virtual

‎llvm/include/llvm/DebugInfo/DWARF/DWARFDebugInfoEntry.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
#define LLVM_LIB_DEBUGINFO_DWARFDEBUGINFOENTRY_H
1212

1313
#include "llvm/ADT/SmallVector.h"
14-
#include "llvm/DebugInfo/DWARF/DIContext.h"
14+
#include "llvm/DebugInfo/DIContext.h"
1515
#include "llvm/DebugInfo/DWARF/DWARFAbbreviationDeclaration.h"
1616
#include "llvm/DebugInfo/DWARF/DWARFDebugRangeList.h"
1717
#include "llvm/Support/DataTypes.h"

‎llvm/include/llvm/DebugInfo/DWARF/DWARFDebugLine.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
#ifndef LLVM_LIB_DEBUGINFO_DWARFDEBUGLINE_H
1111
#define LLVM_LIB_DEBUGINFO_DWARFDEBUGLINE_H
1212

13-
#include "llvm/DebugInfo/DWARF/DIContext.h"
13+
#include "llvm/DebugInfo/DIContext.h"
1414
#include "llvm/DebugInfo/DWARF/DWARFRelocMap.h"
1515
#include "llvm/Support/DataExtractor.h"
1616
#include <map>

‎llvm/lib/DebugInfo/DWARF/CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
add_llvm_library(LLVMDebugInfoDWARF
2-
DIContext.cpp
32
DWARFAbbreviationDeclaration.cpp
43
DWARFAcceleratorTable.cpp
54
DWARFCompileUnit.cpp
@@ -19,4 +18,5 @@ add_llvm_library(LLVMDebugInfoDWARF
1918

2019
ADDITIONAL_HEADER_DIRS
2120
${LLVM_MAIN_INCLUDE_DIR}/llvm/DebugInfo/DWARF
21+
${LLVM_MAIN_INCLUDE_DIR}/llvm/DebugInfo
2222
)

‎llvm/lib/DebugInfo/DWARF/DIContext.cpp

-18
This file was deleted.

‎llvm/lib/DebugInfo/DWARF/DWARFUnit.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ DWARFUnit::DWOHolder::DWOHolder(StringRef DWOPath)
256256
return;
257257
DWOFile = std::move(Obj.get());
258258
DWOContext.reset(
259-
cast<DWARFContext>(DIContext::getDWARFContext(*DWOFile.getBinary())));
259+
cast<DWARFContext>(new DWARFContextInMemory(*DWOFile.getBinary())));
260260
if (DWOContext->getNumDWOCompileUnits() > 0)
261261
DWOU = DWOContext->getDWOCompileUnitAtIndex(0);
262262
}

‎llvm/lib/ExecutionEngine/IntelJITEvents/IntelJITEventListener.cpp

+3-2
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@
1616
#include "IntelJITEventsWrapper.h"
1717
#include "llvm/ADT/DenseMap.h"
1818
#include "llvm/CodeGen/MachineFunction.h"
19-
#include "llvm/DebugInfo/DWARF/DIContext.h"
19+
#include "llvm/DebugInfo/DIContext.h"
20+
#include "llvm/DebugInfo/DWARF/DWARFContext.h"
2021
#include "llvm/ExecutionEngine/JITEventListener.h"
2122
#include "llvm/IR/DebugInfo.h"
2223
#include "llvm/IR/Function.h"
@@ -102,7 +103,7 @@ void IntelJITEventListener::NotifyObjectEmitted(
102103

103104
// Get the address of the object image for use as a unique identifier
104105
const void* ObjData = DebugObj.getData().data();
105-
DIContext* Context = DIContext::getDWARFContext(DebugObj);
106+
DIContext* Context = new DWARFContextInMemory(DebugObj);
106107
MethodAddressVector Functions;
107108

108109
// Use symbol info to iterate functions in the object.

‎llvm/tools/llvm-dwarfdump/llvm-dwarfdump.cpp

+3-2
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@
1313

1414
#include "llvm/ADT/STLExtras.h"
1515
#include "llvm/ADT/Triple.h"
16-
#include "llvm/DebugInfo/DWARF/DIContext.h"
16+
#include "llvm/DebugInfo/DIContext.h"
17+
#include "llvm/DebugInfo/DWARF/DWARFContext.h"
1718
#include "llvm/Object/ObjectFile.h"
1819
#include "llvm/Object/RelocVisitor.h"
1920
#include "llvm/Support/CommandLine.h"
@@ -86,7 +87,7 @@ static void DumpInput(StringRef Filename) {
8687
}
8788
ObjectFile &Obj = *ObjOrErr.get();
8889

89-
std::unique_ptr<DIContext> DICtx(DIContext::getDWARFContext(Obj));
90+
std::unique_ptr<DIContext> DICtx(new DWARFContextInMemory(Obj));
9091

9192
outs() << Filename
9293
<< ":\tfile format " << Obj.getFileFormatName() << "\n\n";

‎llvm/tools/llvm-objdump/MachODump.cpp

+3-2
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@
1717
#include "llvm/ADT/StringExtras.h"
1818
#include "llvm/ADT/Triple.h"
1919
#include "llvm/Config/config.h"
20-
#include "llvm/DebugInfo/DWARF/DIContext.h"
20+
#include "llvm/DebugInfo/DIContext.h"
21+
#include "llvm/DebugInfo/DWARF/DWARFContext.h"
2122
#include "llvm/MC/MCAsmInfo.h"
2223
#include "llvm/MC/MCContext.h"
2324
#include "llvm/MC/MCDisassembler.h"
@@ -6115,7 +6116,7 @@ static void DisassembleMachO(StringRef Filename, MachOObjectFile *MachOOF,
61156116
}
61166117

61176118
// Setup the DIContext
6118-
diContext.reset(DIContext::getDWARFContext(*DbgObj));
6119+
diContext.reset(new DWARFContextInMemory(*DbgObj));
61196120
}
61206121

61216122
if (DumpSections.size() == 0)

‎llvm/tools/llvm-rtdyld/llvm-rtdyld.cpp

+3-2
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@
1212
//===----------------------------------------------------------------------===//
1313

1414
#include "llvm/ADT/StringMap.h"
15-
#include "llvm/DebugInfo/DWARF/DIContext.h"
15+
#include "llvm/DebugInfo/DIContext.h"
16+
#include "llvm/DebugInfo/DWARF/DWARFContext.h"
1617
#include "llvm/ExecutionEngine/RTDyldMemoryManager.h"
1718
#include "llvm/ExecutionEngine/RuntimeDyld.h"
1819
#include "llvm/ExecutionEngine/RuntimeDyldChecker.h"
@@ -227,7 +228,7 @@ static int printLineInfoForInput() {
227228
OwningBinary<ObjectFile> DebugObj = LoadedObjInfo->getObjectForDebug(Obj);
228229

229230
std::unique_ptr<DIContext> Context(
230-
DIContext::getDWARFContext(*DebugObj.getBinary()));
231+
new DWARFContextInMemory(*DebugObj.getBinary()));
231232

232233
// Use symbol info to iterate functions in the object.
233234
for (object::symbol_iterator I = DebugObj.getBinary()->symbol_begin(),

‎llvm/tools/llvm-symbolizer/LLVMSymbolize.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
#include "LLVMSymbolize.h"
1515
#include "llvm/ADT/STLExtras.h"
1616
#include "llvm/Config/config.h"
17+
#include "llvm/DebugInfo/DWARF/DWARFContext.h"
1718
#include "llvm/Object/ELFObjectFile.h"
1819
#include "llvm/Object/MachO.h"
1920
#include "llvm/Support/Casting.h"
@@ -460,7 +461,7 @@ LLVMSymbolizer::getOrCreateModuleInfo(const std::string &ModuleName) {
460461
Modules.insert(make_pair(ModuleName, (ModuleInfo *)nullptr));
461462
return nullptr;
462463
}
463-
DIContext *Context = DIContext::getDWARFContext(*Objects.second);
464+
DIContext *Context = new DWARFContextInMemory(*Objects.second);
464465
assert(Context);
465466
ModuleInfo *Info = new ModuleInfo(Objects.first, Context);
466467
Modules.insert(make_pair(ModuleName, Info));

‎llvm/tools/llvm-symbolizer/LLVMSymbolize.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
#define LLVM_TOOLS_LLVM_SYMBOLIZER_LLVMSYMBOLIZE_H
1515

1616
#include "llvm/ADT/SmallVector.h"
17-
#include "llvm/DebugInfo/DWARF/DIContext.h"
17+
#include "llvm/DebugInfo/DIContext.h"
1818
#include "llvm/Object/MachOUniversal.h"
1919
#include "llvm/Object/ObjectFile.h"
2020
#include "llvm/Support/DataExtractor.h"

0 commit comments

Comments
 (0)
Please sign in to comment.