diff options
author | Alexey Samsonov <samsonov@google.com> | 2013-07-17 06:45:36 +0000 |
---|---|---|
committer | Alexey Samsonov <samsonov@google.com> | 2013-07-17 06:45:36 +0000 |
commit | df959c70c935fb98cf5adadc3e712d54ca322a85 (patch) | |
tree | a60b2a6e5285b91f7a0e8967028c9b150875727e /tools | |
parent | e0364b64d12330f6f8c47ef98fc658468e2b72e4 (diff) | |
download | external_llvm-df959c70c935fb98cf5adadc3e712d54ca322a85.zip external_llvm-df959c70c935fb98cf5adadc3e712d54ca322a85.tar.gz external_llvm-df959c70c935fb98cf5adadc3e712d54ca322a85.tar.bz2 |
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
Diffstat (limited to 'tools')
-rw-r--r-- | tools/llvm-symbolizer/LLVMSymbolize.cpp | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/tools/llvm-symbolizer/LLVMSymbolize.cpp b/tools/llvm-symbolizer/LLVMSymbolize.cpp index 1945d68..4f6e0cf 100644 --- a/tools/llvm-symbolizer/LLVMSymbolize.cpp +++ b/tools/llvm-symbolizer/LLVMSymbolize.cpp @@ -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); |