[llvm] r186493 - llvm-symbolizer: be more careful with colons in file names
Alexey Samsonov
samsonov at google.com
Tue Jul 16 23:45:36 PDT 2013
Author: samsonov
Date: Wed Jul 17 01:45:36 2013
New Revision: 186493
URL: http://llvm.org/viewvc/llvm-project?rev=186493&view=rev
Log:
llvm-symbolizer: be more careful with colons in file names
Modified:
llvm/trunk/tools/llvm-symbolizer/LLVMSymbolize.cpp
Modified: llvm/trunk/tools/llvm-symbolizer/LLVMSymbolize.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-symbolizer/LLVMSymbolize.cpp?rev=186493&r1=186492&r2=186493&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-symbolizer/LLVMSymbolize.cpp (original)
+++ llvm/trunk/tools/llvm-symbolizer/LLVMSymbolize.cpp Wed Jul 17 01:45:36 2013
@@ -278,15 +278,14 @@ LLVMSymbolizer::getOrCreateModuleInfo(co
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);
More information about the llvm-commits
mailing list