[Lldb-commits] [lldb] f918c05 - [lldb] Allow env override for LLDB_ARGDUMPER_PATH (#91688)
via lldb-commits
lldb-commits at lists.llvm.org
Tue May 14 13:43:08 PDT 2024
Author: Keith Smiley
Date: 2024-05-14T13:43:04-07:00
New Revision: f918c056f06968763870bc3e6b9f9d7074e1f867
URL: https://github.com/llvm/llvm-project/commit/f918c056f06968763870bc3e6b9f9d7074e1f867
DIFF: https://github.com/llvm/llvm-project/commit/f918c056f06968763870bc3e6b9f9d7074e1f867.diff
LOG: [lldb] Allow env override for LLDB_ARGDUMPER_PATH (#91688)
This mirrors the LLDB_DEBUGSERVER_PATH environment variable and allows
you to have lldb-argdumper in a non-standard location and still use it
at runtime.
Added:
Modified:
lldb/source/Host/macosx/objcxx/Host.mm
Removed:
################################################################################
diff --git a/lldb/source/Host/macosx/objcxx/Host.mm b/lldb/source/Host/macosx/objcxx/Host.mm
index 4fba5550ba10a..e6f1c0ea3d295 100644
--- a/lldb/source/Host/macosx/objcxx/Host.mm
+++ b/lldb/source/Host/macosx/objcxx/Host.mm
@@ -1387,18 +1387,31 @@ static bool ShouldLaunchUsingXPC(ProcessLaunchInfo &launch_info) {
Status Host::ShellExpandArguments(ProcessLaunchInfo &launch_info) {
Status error;
if (launch_info.GetFlags().Test(eLaunchFlagShellExpandArguments)) {
- FileSpec expand_tool_spec = HostInfo::GetSupportExeDir();
- if (!expand_tool_spec) {
- error.SetErrorString(
- "could not get support executable directory for lldb-argdumper tool");
- return error;
+ FileSpec expand_tool_spec;
+ Environment host_env = Host::GetEnvironment();
+ std::string env_argdumper_path = host_env.lookup("LLDB_ARGDUMPER_PATH");
+ if (!env_argdumper_path.empty()) {
+ expand_tool_spec.SetFile(env_argdumper_path, FileSpec::Style::native);
+ Log *log(GetLog(LLDBLog::Host | LLDBLog::Process));
+ LLDB_LOGF(log,
+ "lldb-argdumper exe path set from environment variable: %s",
+ env_argdumper_path.c_str());
}
- expand_tool_spec.AppendPathComponent("lldb-argdumper");
- if (!FileSystem::Instance().Exists(expand_tool_spec)) {
- error.SetErrorStringWithFormat(
- "could not find the lldb-argdumper tool: %s",
- expand_tool_spec.GetPath().c_str());
- return error;
+ bool argdumper_exists = FileSystem::Instance().Exists(env_argdumper_path);
+ if (!argdumper_exists) {
+ expand_tool_spec = HostInfo::GetSupportExeDir();
+ if (!expand_tool_spec) {
+ error.SetErrorString("could not get support executable directory for "
+ "lldb-argdumper tool");
+ return error;
+ }
+ expand_tool_spec.AppendPathComponent("lldb-argdumper");
+ if (!FileSystem::Instance().Exists(expand_tool_spec)) {
+ error.SetErrorStringWithFormat(
+ "could not find the lldb-argdumper tool: %s",
+ expand_tool_spec.GetPath().c_str());
+ return error;
+ }
}
StreamString expand_tool_spec_stream;
More information about the lldb-commits
mailing list