Skip to content

Commit b0224b1

Browse files
committed
Attempt to fix buildbot after r354972 [#2]. NFCI.
llvm-svn: 355192
1 parent 54829ec commit b0224b1

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

llvm/tools/llvm-symbolizer/llvm-symbolizer.cpp

+14-1
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,20 @@ static bool parseCommand(StringRef InputString, bool &IsData,
201201
static uint64_t getModuleSectionIndexForAddress(const std::string &ModuleName,
202202
uint64_t Address) {
203203

204-
Expected<OwningBinary<Binary>> BinaryOrErr = createBinary(ModuleName);
204+
// following ModuleName processing was copied from
205+
// LLVMSymbolizer::getOrCreateModuleInfo().
206+
// it needs to be refactored to avoid code duplication.
207+
std::string BinaryName = ModuleName;
208+
size_t ColonPos = ModuleName.find_last_of(':');
209+
// Verify that substring after colon form a valid arch name.
210+
if (ColonPos != std::string::npos) {
211+
std::string ArchStr = ModuleName.substr(ColonPos + 1);
212+
if (Triple(ArchStr).getArch() != Triple::UnknownArch) {
213+
BinaryName = ModuleName.substr(0, ColonPos);
214+
}
215+
}
216+
217+
Expected<OwningBinary<Binary>> BinaryOrErr = createBinary(BinaryName);
205218

206219
if (error(BinaryOrErr))
207220
return object::SectionedAddress::UndefSection;

0 commit comments

Comments
 (0)