[lldb] Use getMainExecutable in SBDebugger::PrintStackTraceOnError

Implement Pavel's suggestion to use llvm::sys::fs::getMainExecutable to
find the executable name for llvm::sys::PrintStackTraceOnErrorSignal.
This commit is contained in:
Jonas Devlieghere
2022-04-07 13:43:47 -07:00
parent b05027aaf9
commit 8ece6b78c0

View File

@@ -212,9 +212,9 @@ void SBDebugger::PrintStackTraceOnError() {
LLDB_INSTRUMENT();
llvm::EnablePrettyStackTrace();
// We don't have a meaningful argv[0] to use, so use "SBDebugger" as a
// substitute.
llvm::sys::PrintStackTraceOnErrorSignal("SBDebugger");
static std::string executable =
llvm::sys::fs::getMainExecutable(nullptr, nullptr);
llvm::sys::PrintStackTraceOnErrorSignal(executable);
}
void SBDebugger::Terminate() {