diff options
author | Walter Erquinigo <a20012251@gmail.com> | 2024-11-05 06:33:25 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-11-05 06:33:25 -0500 |
commit | 6620cd25234a42ca4b51490627afcb93fa443dc3 (patch) | |
tree | 0ea7a1e66420ad6c76dedd59582c120709eec66a /lldb/source/Commands/CommandObjectProcess.cpp | |
parent | 9f0f6df03b1f6bc4feac8ca5670638b005d20d96 (diff) | |
download | llvm-6620cd25234a42ca4b51490627afcb93fa443dc3.zip llvm-6620cd25234a42ca4b51490627afcb93fa443dc3.tar.gz llvm-6620cd25234a42ca4b51490627afcb93fa443dc3.tar.bz2 |
[LLDB] Add a target.launch-working-dir setting (#113521)
Internally we use bazel in a way in which it can drop you in a LLDB
session with the target launched in a particular cwd, which is needed
for things to work. We've been making this automation work via `process
launch -w`. However, if later the user wants to restart the process with
`r`, then they end up using a different cwd for relaunching the process.
As a way to fix this, I'm adding a target-level setting that allows
configuring a default cwd used for launching the process without needing
the user to specify it manually.
Diffstat (limited to 'lldb/source/Commands/CommandObjectProcess.cpp')
-rw-r--r-- | lldb/source/Commands/CommandObjectProcess.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/lldb/source/Commands/CommandObjectProcess.cpp b/lldb/source/Commands/CommandObjectProcess.cpp index e7c7d07..7444e46 100644 --- a/lldb/source/Commands/CommandObjectProcess.cpp +++ b/lldb/source/Commands/CommandObjectProcess.cpp @@ -201,6 +201,13 @@ protected: if (target->GetDisableSTDIO()) m_options.launch_info.GetFlags().Set(eLaunchFlagDisableSTDIO); + if (!m_options.launch_info.GetWorkingDirectory()) { + if (llvm::StringRef wd = target->GetLaunchWorkingDirectory(); + !wd.empty()) { + m_options.launch_info.SetWorkingDirectory(FileSpec(wd)); + } + } + // Merge the launch info environment with the target environment. Environment target_env = target->GetEnvironment(); m_options.launch_info.GetEnvironment().insert(target_env.begin(), |