mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-26 12:43:36 +01:00
Only use argv[0] as the main executable name if it exists.
Under some environments, argv[0] doesn't hold a valid file name, but sys::fs::getMainExecutable will find the main executable properly. This patch tweaks the logic to fall back to sys::fs::getMainExecutable in more situations. Differential Revision: https://reviews.llvm.org/D60730 llvm-svn: 358455
This commit is contained in:
parent
5bf454216e
commit
f94937f3a4
@ -131,8 +131,8 @@ static bool printSymbolizedStackTrace(StringRef Argv0, void **StackTrace,
|
||||
// If we don't know argv0 or the address of main() at this point, try
|
||||
// to guess it anyway (it's possible on some platforms).
|
||||
std::string MainExecutableName =
|
||||
Argv0.empty() ? sys::fs::getMainExecutable(nullptr, nullptr)
|
||||
: (std::string)Argv0;
|
||||
sys::fs::exists(Argv0) ? (std::string)Argv0
|
||||
: sys::fs::getMainExecutable(nullptr, nullptr);
|
||||
BumpPtrAllocator Allocator;
|
||||
StringSaver StrPool(Allocator);
|
||||
std::vector<const char *> Modules(Depth, nullptr);
|
||||
|
Loading…
Reference in New Issue
Block a user