[PATCH] D117785: [DebugInfo] Fix handling '# line "file"' for DWARFv5

Igor Kudrin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 20 22:52:56 PST 2022


This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG75184f14aecd: [DebugInfo] Fix handling '# line "file"' for DWARFv5 (authored by ikudrin).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D117785/new/

https://reviews.llvm.org/D117785

Files:
  llvm/lib/MC/MCDwarf.cpp
  llvm/test/MC/ELF/debug-hash-file.s


Index: llvm/test/MC/ELF/debug-hash-file.s
===================================================================
--- llvm/test/MC/ELF/debug-hash-file.s
+++ llvm/test/MC/ELF/debug-hash-file.s
@@ -1,5 +1,8 @@
 // RUN: llvm-mc -triple x86_64-unknown-linux-gnu -filetype obj -g -dwarf-version 4 -o %t %s
-// RUN: llvm-dwarfdump -debug-info -debug-line %t | FileCheck %s
+// RUN: llvm-dwarfdump -debug-info -debug-line %t | FileCheck %s --check-prefixes=CHECK,DWARF4
+
+// RUN: llvm-mc -triple x86_64-unknown-linux-gnu -filetype obj -g -dwarf-version 5 -o %t %s
+// RUN: llvm-dwarfdump -debug-info -debug-line %t | FileCheck %s --check-prefixes=CHECK,DWARF5
 
 // CHECK: DW_TAG_compile_unit
 // CHECK-NOT: DW_TAG_
@@ -8,10 +11,17 @@
 // CHECK-NOT: DW_TAG_
 // CHECK: DW_AT_decl_file ("/MyTest/Inputs{{(/|\\)+}}other.S")
 
-// CHECK: include_directories[ 1] = "/MyTest/Inputs"
-// CHECK: file_names[ 1]:
-// CHECK-NEXT: name: "other.S"
-// CHECK-NEXT: dir_index: 1
+// DWARF4: include_directories[ 1] = "/MyTest/Inputs"
+// DWARF4: file_names[ 1]:
+// DWARF4-NEXT: name: "other.S"
+// DWARF4-NEXT: dir_index: 1
+
+// DWARF5:      include_directories[ 0] =
+// DWARF5-NOT:  include_directories[ 1] =
+// DWARF5:      file_names[ 0]:
+// DWARF5-NEXT:           name: "/MyTest/Inputs/other.S"
+// DWARF5-NEXT:      dir_index: 0
+// DWARF5-NOT:  file_names[ 1]:
 
 # 1 "/MyTest/Inputs/other.S"
 
Index: llvm/lib/MC/MCDwarf.cpp
===================================================================
--- llvm/lib/MC/MCDwarf.cpp
+++ llvm/lib/MC/MCDwarf.cpp
@@ -561,7 +561,7 @@
 
 static bool isRootFile(const MCDwarfFile &RootFile, StringRef &Directory,
                        StringRef &FileName, Optional<MD5::MD5Result> Checksum) {
-  if (RootFile.Name.empty() || RootFile.Name != FileName.data())
+  if (RootFile.Name.empty() || StringRef(RootFile.Name) != FileName)
     return false;
   return RootFile.Checksum == Checksum;
 }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D117785.401867.patch
Type: text/x-patch
Size: 1916 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220121/e6b4ad52/attachment.bin>


More information about the llvm-commits mailing list