[Lldb-commits] [lldb] 8ece6b7 - [lldb] Use getMainExecutable in SBDebugger::PrintStackTraceOnError

Jonas Devlieghere via lldb-commits lldb-commits at lists.llvm.org
Thu Apr 7 13:53:29 PDT 2022


Author: Jonas Devlieghere
Date: 2022-04-07T13:53:23-07:00
New Revision: 8ece6b78c0425ba587c34bbb046d1cb6529a4569

URL: https://github.com/llvm/llvm-project/commit/8ece6b78c0425ba587c34bbb046d1cb6529a4569
DIFF: https://github.com/llvm/llvm-project/commit/8ece6b78c0425ba587c34bbb046d1cb6529a4569.diff

LOG: [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.

Added: 
    

Modified: 
    lldb/source/API/SBDebugger.cpp

Removed: 
    


################################################################################
diff  --git a/lldb/source/API/SBDebugger.cpp b/lldb/source/API/SBDebugger.cpp
index 4d92a0a9b2805..c82ff0f1e878d 100644
--- a/lldb/source/API/SBDebugger.cpp
+++ b/lldb/source/API/SBDebugger.cpp
@@ -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() {


        


More information about the lldb-commits mailing list