Skip to content

Commit

Permalink
Attempt to fix buildbot after r354972 [#2]. NFCI.
Browse files Browse the repository at this point in the history
llvm-svn: 355192
  • Loading branch information
avl-llvm committed Mar 1, 2019
1 parent 54829ec commit b0224b1
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion llvm/tools/llvm-symbolizer/llvm-symbolizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit b0224b1

Please sign in to comment.