llvm-symbolizer: be more careful with colons in file names

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186493 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Alexey Samsonov 2013-07-17 06:45:36 +00:00
parent e0364b64d1
commit df959c70c9

View File

@ -278,15 +278,14 @@ LLVMSymbolizer::getOrCreateModuleInfo(const std::string &ModuleName) {
return I->second;
std::string BinaryName = ModuleName;
std::string ArchName = Opts.DefaultArch;
size_t ColonPos = ModuleName.find(':');
#if defined(_WIN32)
// Recognize a drive letter on win32.
if (ColonPos == 1 && isalpha(ModuleName[0]))
ColonPos = ModuleName.find(':', 2);
#endif
size_t ColonPos = ModuleName.find_last_of(':');
// Verify that substring after colon form a valid arch name.
if (ColonPos != std::string::npos) {
BinaryName = ModuleName.substr(0, ColonPos);
ArchName = ModuleName.substr(ColonPos + 1);
std::string ArchStr = ModuleName.substr(ColonPos + 1);
if (Triple(ArchStr).getArch() != Triple::ArchType::UnknownArch) {
BinaryName = ModuleName.substr(0, ColonPos);
ArchName = ArchStr;
}
}
BinaryPair Binaries = getOrCreateBinary(BinaryName);
ObjectFile *Obj = getObjectFileFromBinary(Binaries.first, ArchName);