]> granicus.if.org Git - llvm/commitdiff
Attempt to fix buildbot after r354972 [#2]. NFCI.
authorAlexey Lapshin <a.v.lapshin@mail.ru>
Fri, 1 Mar 2019 10:15:18 +0000 (10:15 +0000)
committerAlexey Lapshin <a.v.lapshin@mail.ru>
Fri, 1 Mar 2019 10:15:18 +0000 (10:15 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@355192 91177308-0d34-0410-b5e6-96231b3b80d8

tools/llvm-symbolizer/llvm-symbolizer.cpp

index 63f9693562b3ffd418472f7862ce04476442ad78..9a39c3019cd35cc959a923c8e1126ab7fe8795ae 100644 (file)
@@ -201,7 +201,20 @@ static bool parseCommand(StringRef InputString, bool &IsData,
 static uint64_t getModuleSectionIndexForAddress(const std::string &ModuleName,
                                                 uint64_t Address) {
 
-  Expected<OwningBinary<Binary>> BinaryOrErr = createBinary(ModuleName);
+  // following ModuleName processing was copied from
+  // LLVMSymbolizer::getOrCreateModuleInfo().
+  // it needs to be refactored to avoid code duplication.
+  std::string BinaryName = ModuleName;
+  size_t ColonPos = ModuleName.find_last_of(':');
+  // Verify that substring after colon form a valid arch name.
+  if (ColonPos != std::string::npos) {
+    std::string ArchStr = ModuleName.substr(ColonPos + 1);
+    if (Triple(ArchStr).getArch() != Triple::UnknownArch) {
+      BinaryName = ModuleName.substr(0, ColonPos);
+    }
+  }
+
+  Expected<OwningBinary<Binary>> BinaryOrErr = createBinary(BinaryName);
 
   if (error(BinaryOrErr))
     return object::SectionedAddress::UndefSection;