From abb17cc084d917a54b3e5021bbb3ecdfc1a49d23 Mon Sep 17 00:00:00 2001 From: Zachary Turner Date: Fri, 1 Sep 2017 20:06:56 +0000 Subject: [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 --- .../lib/DebugInfo/CodeView/StringsAndChecksums.cpp | 28 +++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-) (limited to 'llvm/lib/DebugInfo/CodeView/StringsAndChecksums.cpp') 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(); + OwnedStrings = std::make_shared(); 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(); + *OwnedStrings = StringsRef; + Strings = OwnedStrings.get(); +} + void StringsAndChecksumsRef::setChecksums( const DebugChecksumsSubsectionRef &CS) { - OwnedChecksums = llvm::make_unique(); + OwnedChecksums = std::make_shared(); *OwnedChecksums = CS; Checksums = OwnedChecksums.get(); } @@ -53,7 +75,7 @@ void StringsAndChecksumsRef::initializeChecksums( if (Checksums) return; - OwnedChecksums = llvm::make_unique(); + OwnedChecksums = std::make_shared(); consumeError(OwnedChecksums->initialize(FCR.getRecordData())); Checksums = OwnedChecksums.get(); } -- cgit v1.2.3