diff options
author | Eric Beckmann <ecbeckmann@google.com> | 2017-09-15 18:20:28 +0000 |
---|---|---|
committer | Eric Beckmann <ecbeckmann@google.com> | 2017-09-15 18:20:28 +0000 |
commit | 349746f044302eb4c793fbcb7e5fdbada6858cd9 (patch) | |
tree | 57e78e99ba81d5dfd769ff3765336e5a44311cfc /llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp | |
parent | 7a183e27601d5241978c940f2381fe745d7bdbfb (diff) | |
download | bcm5719-llvm-349746f044302eb4c793fbcb7e5fdbada6858cd9.tar.gz bcm5719-llvm-349746f044302eb4c793fbcb7e5fdbada6858cd9.zip |
Fix Bug 30978 by emitting cv file checksums.
Summary:
The checksums had already been placed in the IR, this patch allows
MCCodeView to actually write it out to an MCStreamer.
Subscribers: llvm-commits, hiraditya
Differential Revision: https://reviews.llvm.org/D37157
llvm-svn: 313374
Diffstat (limited to 'llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp')
-rw-r--r-- | llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp b/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp index 87aeb1f03dd..db72269983f 100644 --- a/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp @@ -159,7 +159,10 @@ unsigned CodeViewDebug::maybeRecordFile(const DIFile *F) { if (Insertion.second) { // We have to compute the full filepath and emit a .cv_file directive. StringRef FullPath = getFullFilepath(F); - bool Success = OS.EmitCVFileDirective(NextId, FullPath); + StringRef Checksum = F->getChecksum(); + DIFile::ChecksumKind ChecksumKind = F->getChecksumKind(); + bool Success = OS.EmitCVFileDirective(NextId, FullPath, Checksum, + static_cast<unsigned>(ChecksumKind)); (void)Success; assert(Success && ".cv_file directive failed"); } @@ -681,8 +684,10 @@ void CodeViewDebug::emitInlineeLinesSubsection() { OS.AddComment("Inlinee lines subsection"); MCSymbol *InlineEnd = beginCVSubsection(DebugSubsectionKind::InlineeLines); - // We don't provide any extra file info. - // FIXME: Find out if debuggers use this info. + // We emit the checksum info for files. This is used by debuggers to + // determine if a pdb matches the source before loading it. Visual Studio, + // for instance, will display a warning that the breakpoints are not valid if + // the pdb does not match the source. OS.AddComment("Inlinee lines signature"); OS.EmitIntValue(unsigned(InlineeLinesSignature::Normal), 4); @@ -695,13 +700,10 @@ void CodeViewDebug::emitInlineeLinesSubsection() { OS.AddComment("Inlined function " + SP->getName() + " starts at " + SP->getFilename() + Twine(':') + Twine(SP->getLine())); OS.AddBlankLine(); - // The filechecksum table uses 8 byte entries for now, and file ids start at - // 1. - unsigned FileOffset = (FileId - 1) * 8; OS.AddComment("Type index of inlined function"); OS.EmitIntValue(InlineeIdx.getIndex(), 4); OS.AddComment("Offset into filechecksum table"); - OS.EmitIntValue(FileOffset, 4); + OS.EmitCVFileChecksumOffsetDirective(FileId); OS.AddComment("Starting line number"); OS.EmitIntValue(SP->getLine(), 4); } |