[llvm] r357026 - Revert "[llvm] Reapply "Prevent duplicate files in debug line header in dwarf 5.""
Ali Tamur via llvm-commits
llvm-commits at lists.llvm.org
Tue Mar 26 13:05:27 PDT 2019
Author: tamur
Date: Tue Mar 26 13:05:27 2019
New Revision: 357026
URL: http://llvm.org/viewvc/llvm-project?rev=357026&view=rev
Log:
Revert "[llvm] Reapply "Prevent duplicate files in debug line header in dwarf 5.""
This reverts commit rL357020.
The commit broke the test llvm/test/tools/llvm-objdump/embedded-source.test
on some builds including clang-ppc64be-linux-multistage,
clang-s390x-linux, clang-with-lto-ubuntu, clang-x64-windows-msvc,
llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast (and others).
Modified:
llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFDebugLine.h
llvm/trunk/include/llvm/MC/MCContext.h
llvm/trunk/include/llvm/MC/MCDwarf.h
llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h
llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
llvm/trunk/lib/CodeGen/AsmPrinter/DwarfUnit.cpp
llvm/trunk/lib/DebugInfo/DWARF/DWARFDebugLine.cpp
llvm/trunk/lib/MC/MCContext.cpp
llvm/trunk/lib/MC/MCDwarf.cpp
llvm/trunk/test/MC/ARM/dwarf-asm-multiple-sections.s
llvm/trunk/test/MC/ELF/debug-mixed-md5.ll
llvm/trunk/test/MC/ELF/dwarf-file0.s
llvm/trunk/test/tools/llvm-objdump/Inputs/embedded-source
llvm/trunk/test/tools/llvm-objdump/X86/function-sections-line-numbers.s
Modified: llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFDebugLine.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFDebugLine.h?rev=357026&r1=357025&r2=357026&view=diff
==============================================================================
--- llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFDebugLine.h (original)
+++ llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFDebugLine.h Tue Mar 26 13:05:27 2019
@@ -275,8 +275,6 @@ public:
SequenceVector Sequences;
private:
- const llvm::DWARFDebugLine::FileNameEntry &
- getFileNameEntry(uint64_t Index) const;
uint32_t findRowInSeq(const DWARFDebugLine::Sequence &Seq,
object::SectionedAddress Address) const;
Optional<StringRef>
Modified: llvm/trunk/include/llvm/MC/MCContext.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCContext.h?rev=357026&r1=357025&r2=357026&view=diff
==============================================================================
--- llvm/trunk/include/llvm/MC/MCContext.h (original)
+++ llvm/trunk/include/llvm/MC/MCContext.h Tue Mar 26 13:05:27 2019
@@ -521,7 +521,7 @@ namespace llvm {
}
MCDwarfLineTable &getMCDwarfLineTable(unsigned CUID) {
- return MCDwarfLineTablesCUMap.emplace(CUID, DwarfVersion).first->second;
+ return MCDwarfLineTablesCUMap[CUID];
}
const MCDwarfLineTable &getMCDwarfLineTable(unsigned CUID) const {
Modified: llvm/trunk/include/llvm/MC/MCDwarf.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCDwarf.h?rev=357026&r1=357025&r2=357026&view=diff
==============================================================================
--- llvm/trunk/include/llvm/MC/MCDwarf.h (original)
+++ llvm/trunk/include/llvm/MC/MCDwarf.h Tue Mar 26 13:05:27 2019
@@ -218,11 +218,9 @@ struct MCDwarfLineTableHeader {
private:
bool HasAllMD5 = true;
bool HasAnyMD5 = false;
- unsigned DwarfVersion;
public:
- explicit MCDwarfLineTableHeader(unsigned DwarfVersion) :
- DwarfVersion(DwarfVersion) {}
+ MCDwarfLineTableHeader() = default;
Expected<unsigned> tryGetFile(StringRef &Directory, StringRef &FileName,
MD5::MD5Result *Checksum,
@@ -247,17 +245,6 @@ public:
return MCDwarfFiles.empty() || (HasAllMD5 == HasAnyMD5);
}
- void setRootFile(StringRef Directory, StringRef FileName,
- MD5::MD5Result *Checksum, Optional<StringRef> Source) {
- CompilationDir = Directory;
- RootFile.Name = FileName;
- RootFile.DirIndex = 0;
- RootFile.Checksum = Checksum;
- RootFile.Source = Source;
- trackMD5Usage(Checksum);
- HasSource = Source.hasValue();
- }
-
private:
void emitV2FileDirTables(MCStreamer *MCOS) const;
void emitV5FileDirTables(MCStreamer *MCOS, Optional<MCDwarfLineStr> &LineStr,
@@ -268,8 +255,6 @@ class MCDwarfDwoLineTable {
MCDwarfLineTableHeader Header;
public:
- MCDwarfDwoLineTable(unsigned DwarfVersion) : Header(DwarfVersion) {}
-
void maybeSetRootFile(StringRef Directory, StringRef FileName,
MD5::MD5Result *Checksum, Optional<StringRef> Source) {
if (!Header.RootFile.Name.empty())
@@ -297,7 +282,6 @@ class MCDwarfLineTable {
MCLineSection MCLineSections;
public:
- MCDwarfLineTable(unsigned DwarfVersion) : Header(DwarfVersion) {}
// This emits the Dwarf file and the line tables for all Compile Units.
static void Emit(MCObjectStreamer *MCOS, MCDwarfLineTableParams Params);
Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h?rev=357026&r1=357025&r2=357026&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h Tue Mar 26 13:05:27 2019
@@ -101,7 +101,6 @@ class DwarfCompileUnit final : public Dw
}
public:
- unsigned getDwarfVersion() const { return DD->getDwarfVersion(); }
DwarfCompileUnit(unsigned UID, const DICompileUnit *Node, AsmPrinter *A,
DwarfDebug *DW, DwarfFile *DWU);
Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp?rev=357026&r1=357025&r2=357026&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp Tue Mar 26 13:05:27 2019
@@ -319,7 +319,6 @@ DwarfDebug::DwarfDebug(AsmPrinter *A, Mo
: DebugHandlerBase(A), DebugLocs(A->OutStreamer->isVerboseAsm()),
InfoHolder(A, "info_string", DIEValueAllocator),
SkeletonHolder(A, "skel_string", DIEValueAllocator),
- SplitTypeUnitFileTable(A->getDwarfVersion()),
IsDarwin(A->TM.getTargetTriple().isOSDarwin()) {
const Triple &TT = Asm->TM.getTargetTriple();
Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfUnit.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfUnit.cpp?rev=357026&r1=357025&r2=357026&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfUnit.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfUnit.cpp Tue Mar 26 13:05:27 2019
@@ -397,6 +397,7 @@ void DwarfUnit::addSourceLine(DIE &Die,
return;
unsigned FileID = getOrCreateSourceID(File);
+ assert(FileID && "Invalid file id");
addUInt(Die, dwarf::DW_AT_decl_file, None, FileID);
addUInt(Die, dwarf::DW_AT_decl_line, None, Line);
}
Modified: llvm/trunk/lib/DebugInfo/DWARF/DWARFDebugLine.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/DWARF/DWARFDebugLine.cpp?rev=357026&r1=357025&r2=357026&view=diff
==============================================================================
--- llvm/trunk/lib/DebugInfo/DWARF/DWARFDebugLine.cpp (original)
+++ llvm/trunk/lib/DebugInfo/DWARF/DWARFDebugLine.cpp Tue Mar 26 13:05:27 2019
@@ -1017,28 +1017,14 @@ bool DWARFDebugLine::LineTable::lookupAd
}
bool DWARFDebugLine::LineTable::hasFileAtIndex(uint64_t FileIndex) const {
- uint16_t DwarfVersion = Prologue.getVersion();
- assert(DwarfVersion != 0 && "LineTable has no dwarf version information");
- if (DwarfVersion >= 5)
- return FileIndex < Prologue.FileNames.size();
- else
- return FileIndex != 0 && FileIndex <= Prologue.FileNames.size();
-}
-const llvm::DWARFDebugLine::FileNameEntry &
-DWARFDebugLine::LineTable::getFileNameEntry(uint64_t Index) const {
- uint16_t DwarfVersion = Prologue.getVersion();
- assert(DwarfVersion != 0 && "LineTable has no dwarf version information");
- if (DwarfVersion >= 5)
- return Prologue.FileNames[Index];
- else
- return Prologue.FileNames[Index - 1];
+ return FileIndex != 0 && FileIndex <= Prologue.FileNames.size();
}
Optional<StringRef> DWARFDebugLine::LineTable::getSourceByIndex(uint64_t FileIndex,
FileLineInfoKind Kind) const {
if (Kind == FileLineInfoKind::None || !hasFileAtIndex(FileIndex))
return None;
- const FileNameEntry &Entry = getFileNameEntry(FileIndex);
+ const FileNameEntry &Entry = Prologue.FileNames[FileIndex - 1];
if (Optional<const char *> source = Entry.Source.getAsCString())
return StringRef(*source);
return None;
@@ -1058,7 +1044,7 @@ bool DWARFDebugLine::LineTable::getFileN
std::string &Result) const {
if (Kind == FileLineInfoKind::None || !hasFileAtIndex(FileIndex))
return false;
- const FileNameEntry &Entry = getFileNameEntry(FileIndex);
+ const FileNameEntry &Entry = Prologue.FileNames[FileIndex - 1];
StringRef FileName = Entry.Name.getAsCString().getValue();
if (Kind != FileLineInfoKind::AbsoluteFilePath ||
isPathAbsoluteOnWindowsOrPosix(FileName)) {
Modified: llvm/trunk/lib/MC/MCContext.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCContext.cpp?rev=357026&r1=357025&r2=357026&view=diff
==============================================================================
--- llvm/trunk/lib/MC/MCContext.cpp (original)
+++ llvm/trunk/lib/MC/MCContext.cpp Tue Mar 26 13:05:27 2019
@@ -603,8 +603,7 @@ Expected<unsigned> MCContext::getDwarfFi
MD5::MD5Result *Checksum,
Optional<StringRef> Source,
unsigned CUID) {
- MCDwarfLineTable &Table =
- MCDwarfLineTablesCUMap.emplace(CUID, DwarfVersion).first->second;
+ MCDwarfLineTable &Table = MCDwarfLineTablesCUMap[CUID];
return Table.tryGetFile(Directory, FileName, Checksum, Source, FileNumber);
}
@@ -613,7 +612,7 @@ Expected<unsigned> MCContext::getDwarfFi
bool MCContext::isValidDwarfFileNumber(unsigned FileNumber, unsigned CUID) {
const MCDwarfLineTable &LineTable = getMCDwarfLineTable(CUID);
if (FileNumber == 0)
- return getDwarfVersion() >= 5;
+ return getDwarfVersion() >= 5 && LineTable.hasRootFile();
if (FileNumber >= LineTable.getMCDwarfFiles().size())
return false;
Modified: llvm/trunk/lib/MC/MCDwarf.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCDwarf.cpp?rev=357026&r1=357025&r2=357026&view=diff
==============================================================================
--- llvm/trunk/lib/MC/MCDwarf.cpp (original)
+++ llvm/trunk/lib/MC/MCDwarf.cpp Tue Mar 26 13:05:27 2019
@@ -542,15 +542,6 @@ Expected<unsigned> MCDwarfLineTable::try
return Header.tryGetFile(Directory, FileName, Checksum, Source, FileNumber);
}
-bool isRootFile(const MCDwarfFile &RootFile, StringRef &Directory,
- StringRef &FileName, MD5::MD5Result *Checksum) {
- if (RootFile.Name.empty() || RootFile.Name != FileName.data())
- return false;
- if (!RootFile.Checksum)
- return !Checksum;
- return *RootFile.Checksum == *Checksum;
-}
-
Expected<unsigned>
MCDwarfLineTableHeader::tryGetFile(StringRef &Directory,
StringRef &FileName,
@@ -570,8 +561,6 @@ MCDwarfLineTableHeader::tryGetFile(Strin
trackMD5Usage(Checksum);
HasSource = (Source != None);
}
- if (isRootFile(RootFile, Directory, FileName, Checksum) && DwarfVersion >= 5)
- return 0;
if (FileNumber == 0) {
// File numbers start with 1 and/or after any file numbers
// allocated by inline-assembler .file directives.
Modified: llvm/trunk/test/MC/ARM/dwarf-asm-multiple-sections.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/ARM/dwarf-asm-multiple-sections.s?rev=357026&r1=357025&r2=357026&view=diff
==============================================================================
--- llvm/trunk/test/MC/ARM/dwarf-asm-multiple-sections.s (original)
+++ llvm/trunk/test/MC/ARM/dwarf-asm-multiple-sections.s Tue Mar 26 13:05:27 2019
@@ -2,9 +2,9 @@
// RUN: llvm-dwarfdump -v %t | FileCheck -check-prefix DWARF -check-prefix DWARF45 %s
// RUN: llvm-dwarfdump --debug-line %t | FileCheck -check-prefix DWARF-DL -check-prefix DWARF-DL-5 -DDWVER=5 -DDWFILE=0 %s
// RUN: llvm-objdump -r %t | FileCheck -check-prefix RELOC -check-prefix RELOC5 %s
-// RUN: llvm-mc < %s -triple=armv7-linux-gnueabi -filetype=obj -o %t -g -dwarf-version 4 -fdebug-compilation-dir=/tmp
+// RUN: llvm-mc < %s -triple=armv7-linux-gnueabi -filetype=obj -o %t -g -fdebug-compilation-dir=/tmp
// RUN: llvm-dwarfdump -v %t | FileCheck -check-prefix DWARF -check-prefix DWARF45 %s
-// RUN: llvm-dwarfdump --debug-line %t | FileCheck -check-prefix DWARF-DL -check-prefix DWARF-DL-4 -DDWVER=4 -DDWFILE=1 %s
+// RUN: llvm-dwarfdump --debug-line %t | FileCheck -check-prefix DWARF-DL -DDWVER=4 -DDWFILE=1 %s
// RUN: llvm-objdump -r %t | FileCheck -check-prefix RELOC -check-prefix RELOC4 %s
// RUN: llvm-mc < %s -triple=armv7-linux-gnueabi -filetype=obj -o %t -g -dwarf-version 3 -fdebug-compilation-dir=/tmp
// RUN: llvm-dwarfdump -v %t | FileCheck -check-prefix DWARF -check-prefix DWARF3 %s
@@ -57,14 +57,11 @@ b:
// DWARF-DL-5: include_directories[ 0] = "/tmp"
// DWARF-DL: file_names[ [[DWFILE]]]:
// DWARF-DL: name: "{{(<stdin>|-)}}"
-// DWARF-DL-5: 0x0000000000000000 17 0 0 0 0 is_stmt
-// DWARF-DL-5-NEXT: 0x0000000000000004 17 0 0 0 0 is_stmt end_sequence
-// DWARF-DL-5-NEXT: 0x0000000000000000 21 0 0 0 0 is_stmt
-// DWARF-DL-5-NEXT: 0x0000000000000004 21 0 0 0 0 is_stmt end_sequence
-// DWARF-DL-4: 0x0000000000000000 17 0 1 0 0 is_stmt
-// DWARF-DL-4-NEXT: 0x0000000000000004 17 0 1 0 0 is_stmt end_sequence
-// DWARF-DL-4-NEXT: 0x0000000000000000 21 0 1 0 0 is_stmt
-// DWARF-DL-4-NEXT: 0x0000000000000004 21 0 1 0 0 is_stmt end_sequence
+// DWARF-DL: 0x0000000000000000 17 0 1 0 0 is_stmt
+// DWARF-DL-NEXT: 0x0000000000000004 17 0 1 0 0 is_stmt end_sequence
+// DWARF-DL-NEXT: 0x0000000000000000 21 0 1 0 0 is_stmt
+// DWARF-DL-NEXT: 0x0000000000000004 21 0 1 0 0 is_stmt end_sequence
+
// DWARF: .debug_ranges contents:
// DWARF: 00000000 ffffffff 00000000
Modified: llvm/trunk/test/MC/ELF/debug-mixed-md5.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/ELF/debug-mixed-md5.ll?rev=357026&r1=357025&r2=357026&view=diff
==============================================================================
--- llvm/trunk/test/MC/ELF/debug-mixed-md5.ll (original)
+++ llvm/trunk/test/MC/ELF/debug-mixed-md5.ll Tue Mar 26 13:05:27 2019
@@ -1,7 +1,8 @@
; RUN: %llc_dwarf -filetype=asm -dwarf-version=5 %s -o - | FileCheck %s -check-prefix=ASM
; RUN: %llc_dwarf -filetype=obj -dwarf-version=5 %s -o - | llvm-dwarfdump -debug-line - | FileCheck %s -check-prefix=OBJ
; ASM: .file 0 "{{.+}}" md5
-; ASM: .file 1 "t1.cpp"
+; ASM: .file 1 "{{.+}}" md5
+; ASM: .file 2 "t1.cpp"
; ASM-NOT: md5
; OBJ: file_names[ 0]:
; OBJ-NOT: md5
Modified: llvm/trunk/test/MC/ELF/dwarf-file0.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/ELF/dwarf-file0.s?rev=357026&r1=357025&r2=357026&view=diff
==============================================================================
--- llvm/trunk/test/MC/ELF/dwarf-file0.s (original)
+++ llvm/trunk/test/MC/ELF/dwarf-file0.s Tue Mar 26 13:05:27 2019
@@ -19,14 +19,16 @@
# CHECK: file_names[ 1]:
# CHECK-NEXT: name: "header.h"
# CHECK-NEXT: dir_index: 1
-# CHECK-4: file_names[ 2]:
-# CHECK-4-NEXT: name: "root.cpp"
+# CHECK: file_names[ 2]:
+# CHECK-NEXT: name: "root.cpp"
# CHECK-4-NEXT: dir_index: 2
+# CHECK-5-NEXT: dir_index: 0
# ASM-NOT: .file
# ASM-5: .file 0 "/test" "root.cpp"
# ASM: .file 1 "/include" "header.h"
# ASM-4: .file 2 "/test" "root.cpp"
+# ASM-5: .file 2 "root.cpp"
# ASM-NOT: .file
# WARN: file 0 not supported prior to DWARF-5
Modified: llvm/trunk/test/tools/llvm-objdump/Inputs/embedded-source
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-objdump/Inputs/embedded-source?rev=357026&r1=357025&r2=357026&view=diff
==============================================================================
Binary files - no diff available.
Modified: llvm/trunk/test/tools/llvm-objdump/X86/function-sections-line-numbers.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-objdump/X86/function-sections-line-numbers.s?rev=357026&r1=357025&r2=357026&view=diff
==============================================================================
--- llvm/trunk/test/tools/llvm-objdump/X86/function-sections-line-numbers.s (original)
+++ llvm/trunk/test/tools/llvm-objdump/X86/function-sections-line-numbers.s Tue Mar 26 13:05:27 2019
@@ -30,7 +30,8 @@
_Z2f1v: # @_Z2f1v
.Lfunc_begin0:
.file 0 "/home/avl" "test.cpp" md5 0xefae234cc05b45384d782316d3a5d338
- .loc 0 1 0 # test.cpp:1:0
+ .file 1 "test.cpp" md5 0xefae234cc05b45384d782316d3a5d338
+ .loc 1 1 0 # test.cpp:1:0
.cfi_startproc
# %bb.0: # %entry
pushq %rbp
@@ -39,7 +40,7 @@ _Z2f1v:
movq %rsp, %rbp
.cfi_def_cfa_register %rbp
.Ltmp0:
- .loc 0 1 12 prologue_end # test.cpp:1:12
+ .loc 1 1 12 prologue_end # test.cpp:1:12
popq %rbp
.cfi_def_cfa %rsp, 8
retq
@@ -54,7 +55,7 @@ _Z2f1v:
.type _Z2f2v, at function
_Z2f2v: # @_Z2f2v
.Lfunc_begin1:
- .loc 0 2 0 # test.cpp:2:0
+ .loc 1 2 0 # test.cpp:2:0
.cfi_startproc
# %bb.0: # %entry
pushq %rbp
@@ -63,7 +64,7 @@ _Z2f2v:
movq %rsp, %rbp
.cfi_def_cfa_register %rbp
.Ltmp2:
- .loc 0 2 12 prologue_end # test.cpp:2:12
+ .loc 1 2 12 prologue_end # test.cpp:2:12
popq %rbp
.cfi_def_cfa %rsp, 8
retq
More information about the llvm-commits
mailing list