summaryrefslogtreecommitdiffstats
path: root/llvm/lib/DebugInfo/CodeView/ModuleDebugInlineeLinesFragment.cpp
diff options
context:
space:
mode:
authorZachary Turner <zturner@google.com>2017-05-03 17:11:40 +0000
committerZachary Turner <zturner@google.com>2017-05-03 17:11:40 +0000
commitcf468d86f33003e7591848a2d8f404f402b52005 (patch)
tree66903bc00daae69ddb7d5d1cabbc3929e2b6f6bf /llvm/lib/DebugInfo/CodeView/ModuleDebugInlineeLinesFragment.cpp
parent2d5c2cd3ce208ebfac2bceb4c73157bef4e00fdc (diff)
downloadbcm5719-llvm-cf468d86f33003e7591848a2d8f404f402b52005.tar.gz
bcm5719-llvm-cf468d86f33003e7591848a2d8f404f402b52005.zip
[CodeView] Use actual strings for dealing with checksums and lines.
The raw CodeView format references strings by "offsets", but it's confusing what table the offset refers to. In the case of line number information, it's an offset into a buffer of records, and an indirection is required to get another offset into a different table to find the final string. And in the case of checksum information, there is no indirection, and the offset refers directly to the location of the string in another buffer. This would be less confusing if we always just referred to the strings by their value, and have the library be smart enough to correctly resolve the offsets on its own from the right location. This patch makes that possible. When either reading or writing, all the user deals with are strings, and the library does the appropriate translations behind the scenes. llvm-svn: 302053
Diffstat (limited to 'llvm/lib/DebugInfo/CodeView/ModuleDebugInlineeLinesFragment.cpp')
-rw-r--r--llvm/lib/DebugInfo/CodeView/ModuleDebugInlineeLinesFragment.cpp17
1 files changed, 12 insertions, 5 deletions
diff --git a/llvm/lib/DebugInfo/CodeView/ModuleDebugInlineeLinesFragment.cpp b/llvm/lib/DebugInfo/CodeView/ModuleDebugInlineeLinesFragment.cpp
index c54fb2d784a..a908e7df28b 100644
--- a/llvm/lib/DebugInfo/CodeView/ModuleDebugInlineeLinesFragment.cpp
+++ b/llvm/lib/DebugInfo/CodeView/ModuleDebugInlineeLinesFragment.cpp
@@ -10,7 +10,9 @@
#include "llvm/DebugInfo/CodeView/ModuleDebugInlineeLinesFragment.h"
#include "llvm/DebugInfo/CodeView/CodeViewError.h"
+#include "llvm/DebugInfo/CodeView/ModuleDebugFileChecksumFragment.h"
#include "llvm/DebugInfo/CodeView/ModuleDebugFragmentRecord.h"
+#include "llvm/DebugInfo/CodeView/StringTable.h"
using namespace llvm;
using namespace llvm::codeview;
@@ -55,9 +57,10 @@ bool ModuleDebugInlineeLineFragmentRef::hasExtraFiles() const {
}
ModuleDebugInlineeLineFragment::ModuleDebugInlineeLineFragment(
+ ModuleDebugFileChecksumFragment &Checksums, StringTable &Strings,
bool HasExtraFiles)
: ModuleDebugFragment(ModuleDebugFragmentKind::InlineeLines),
- HasExtraFiles(HasExtraFiles) {}
+ Checksums(Checksums), Strings(Strings), HasExtraFiles(HasExtraFiles) {}
uint32_t ModuleDebugInlineeLineFragment::calculateSerializedLength() {
// 4 bytes for the signature
@@ -100,18 +103,22 @@ Error ModuleDebugInlineeLineFragment::commit(BinaryStreamWriter &Writer) {
return Error::success();
}
-void ModuleDebugInlineeLineFragment::addExtraFile(uint32_t FileOffset) {
+void ModuleDebugInlineeLineFragment::addExtraFile(StringRef FileName) {
+ uint32_t Offset = Checksums.mapChecksumOffset(FileName);
+
auto &Entry = Entries.back();
- Entry.ExtraFiles.push_back(ulittle32_t(FileOffset));
+ Entry.ExtraFiles.push_back(ulittle32_t(Offset));
++ExtraFileCount;
}
void ModuleDebugInlineeLineFragment::addInlineSite(TypeIndex FuncId,
- uint32_t FileOffset,
+ StringRef FileName,
uint32_t SourceLine) {
+ uint32_t Offset = Checksums.mapChecksumOffset(FileName);
+
Entries.emplace_back();
auto &Entry = Entries.back();
- Entry.Header.FileID = FileOffset;
+ Entry.Header.FileID = Offset;
Entry.Header.SourceLineNum = SourceLine;
Entry.Header.Inlinee = FuncId;
}
OpenPOWER on IntegriCloud