summaryrefslogtreecommitdiffstats
path: root/llvm/lib/DebugInfo/CodeView/StringsAndChecksums.cpp
diff options
context:
space:
mode:
authorZachary Turner <zturner@google.com>2017-09-01 20:06:56 +0000
committerZachary Turner <zturner@google.com>2017-09-01 20:06:56 +0000
commitabb17cc084d917a54b3e5021bbb3ecdfc1a49d23 (patch)
tree2ceb0b03a84f9954158397e0222afba212cf9227 /llvm/lib/DebugInfo/CodeView/StringsAndChecksums.cpp
parentc36039f462a8270a69b64309810f537e4991bb1c (diff)
downloadbcm5719-llvm-abb17cc084d917a54b3e5021bbb3ecdfc1a49d23.tar.gz
bcm5719-llvm-abb17cc084d917a54b3e5021bbb3ecdfc1a49d23.zip
[llvm-pdbutil] Support dumping CodeView from object files.
We have llvm-readobj for dumping CodeView from object files, and llvm-pdbutil has always been more focused on PDB. However, llvm-pdbutil has a lot of useful options for summarizing debug information in aggregate and presenting high level statistical views. Furthermore, it's arguably better as a testing tool since we don't have to write tests to conform to a state-machine like structure where you match multiple lines in succession, each depending on a previous match. llvm-pdbutil dumps much more concisely, so it's possible to use single-line matches in many cases where as with readobj tests you have to use multi-line matches with an implicit state machine. Because of this, I'm adding object file support to llvm-pdbutil. In fact, this mirrors the cvdump tool from Microsoft, which also supports both object files and pdb files. In the future we could perhaps rename this tool llvm-cvutil. In the meantime, this allows us to deep dive into object files the same way we already can with PDB files. llvm-svn: 312358
Diffstat (limited to 'llvm/lib/DebugInfo/CodeView/StringsAndChecksums.cpp')
-rw-r--r--llvm/lib/DebugInfo/CodeView/StringsAndChecksums.cpp28
1 files changed, 25 insertions, 3 deletions
diff --git a/llvm/lib/DebugInfo/CodeView/StringsAndChecksums.cpp b/llvm/lib/DebugInfo/CodeView/StringsAndChecksums.cpp
index 306af1d1ef6..85d9dbb8c7d 100644
--- a/llvm/lib/DebugInfo/CodeView/StringsAndChecksums.cpp
+++ b/llvm/lib/DebugInfo/CodeView/StringsAndChecksums.cpp
@@ -35,14 +35,36 @@ void StringsAndChecksumsRef::initializeStrings(
assert(SR.kind() == DebugSubsectionKind::StringTable);
assert(!Strings && "Found a string table even though we already have one!");
- OwnedStrings = llvm::make_unique<DebugStringTableSubsectionRef>();
+ OwnedStrings = std::make_shared<DebugStringTableSubsectionRef>();
consumeError(OwnedStrings->initialize(SR.getRecordData()));
Strings = OwnedStrings.get();
}
+void StringsAndChecksumsRef::reset() {
+ resetStrings();
+ resetChecksums();
+}
+
+void StringsAndChecksumsRef::resetStrings() {
+ OwnedStrings.reset();
+ Strings = nullptr;
+}
+
+void StringsAndChecksumsRef::resetChecksums() {
+ OwnedChecksums.reset();
+ Checksums = nullptr;
+}
+
+void StringsAndChecksumsRef::setStrings(
+ const DebugStringTableSubsectionRef &StringsRef) {
+ OwnedStrings = std::make_shared<DebugStringTableSubsectionRef>();
+ *OwnedStrings = StringsRef;
+ Strings = OwnedStrings.get();
+}
+
void StringsAndChecksumsRef::setChecksums(
const DebugChecksumsSubsectionRef &CS) {
- OwnedChecksums = llvm::make_unique<DebugChecksumsSubsectionRef>();
+ OwnedChecksums = std::make_shared<DebugChecksumsSubsectionRef>();
*OwnedChecksums = CS;
Checksums = OwnedChecksums.get();
}
@@ -53,7 +75,7 @@ void StringsAndChecksumsRef::initializeChecksums(
if (Checksums)
return;
- OwnedChecksums = llvm::make_unique<DebugChecksumsSubsectionRef>();
+ OwnedChecksums = std::make_shared<DebugChecksumsSubsectionRef>();
consumeError(OwnedChecksums->initialize(FCR.getRecordData()));
Checksums = OwnedChecksums.get();
}
OpenPOWER on IntegriCloud