[PATCH] D75390: Fix GSYM tests to run the yaml files and fix test failures on some machines.

Greg Clayton via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 2 12:55:32 PST 2020


clayborg updated this revision to Diff 247714.
clayborg added a comment.
This revision is now accepted and ready to land.
Herald added a subscriber: hiraditya.

Fixed an issue causing buildbots to fail where strings from files in the file table could be added in an undefined order.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D75390

Files:
  llvm/lib/DebugInfo/GSYM/GsymCreator.cpp
  llvm/test/tools/llvm-gsymutil/lit.local.cfg
  llvm/tools/llvm-gsym/llvm-gsymutil.cpp


Index: llvm/tools/llvm-gsym/llvm-gsymutil.cpp
===================================================================
--- llvm/tools/llvm-gsym/llvm-gsymutil.cpp
+++ llvm/tools/llvm-gsym/llvm-gsymutil.cpp
@@ -179,7 +179,8 @@
   if (ArchFilters.empty())
     return true;
 
-  StringRef ObjArch = Obj.getArchTriple().getArchName();
+  Triple ObjTriple(Obj.getArchTriple());
+  StringRef ObjArch = ObjTriple.getArchName();
 
   for (auto Arch : ArchFilters) {
     // Match name.
@@ -350,7 +351,8 @@
   error(Filename, errorToErrorCode(BinOrErr.takeError()));
 
   if (auto *Obj = dyn_cast<ObjectFile>(BinOrErr->get())) {
-    auto ArchName = Obj->makeTriple().getArchName();
+    Triple ObjTriple(Obj->makeTriple());
+    auto ArchName = ObjTriple.getArchName();
     outs() << "Output file (" << ArchName << "): " << OutFile << "\n";
     if (auto Err = handleObjectFile(*Obj, OutFile.c_str()))
       return Err;
@@ -374,7 +376,8 @@
 
     // Now handle each architecture we need to convert.
     for (auto &Obj: FilterObjs) {
-      auto ArchName = Obj->getArchTriple().getArchName();
+      Triple ObjTriple(Obj->getArchTriple());
+      auto ArchName = ObjTriple.getArchName();
       std::string ArchOutFile(OutFile);
       // If we are only handling a single architecture, then we will use the
       // normal output file. If we are handling multiple architectures append
Index: llvm/test/tools/llvm-gsymutil/lit.local.cfg
===================================================================
--- /dev/null
+++ llvm/test/tools/llvm-gsymutil/lit.local.cfg
@@ -0,0 +1 @@
+config.suffixes = ['.test', '.yaml']
Index: llvm/lib/DebugInfo/GSYM/GsymCreator.cpp
===================================================================
--- llvm/lib/DebugInfo/GSYM/GsymCreator.cpp
+++ llvm/lib/DebugInfo/GSYM/GsymCreator.cpp
@@ -29,7 +29,13 @@
                                  llvm::sys::path::Style Style) {
   llvm::StringRef directory = llvm::sys::path::parent_path(Path, Style);
   llvm::StringRef filename = llvm::sys::path::filename(Path, Style);
-  FileEntry FE(insertString(directory), insertString(filename));
+  // We must insert the strings first, then call the FileEntry constructor.
+  // If we inline the insertString() function call into the constructor, the
+  // call order is undefined due to parameter lists not having any ordering
+  // requirements.
+  const uint32_t Dir = insertString(directory);
+  const uint32_t Base = insertString(filename);
+  FileEntry FE(Dir, Base);
 
   std::lock_guard<std::recursive_mutex> Guard(Mutex);
   const auto NextIndex = Files.size();


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D75390.247714.patch
Type: text/x-patch
Size: 2581 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200302/01bed4ba/attachment.bin>


More information about the llvm-commits mailing list