Skip to content

Revert "[LLDB] Add a target.launch-working-dir setting" #114973

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 5, 2024

Conversation

walter-erquinigo
Copy link
Member

@walter-erquinigo walter-erquinigo commented Nov 5, 2024

Reverts #113521 due to build bot failures mentioned in the original PR.

@llvmbot llvmbot added the lldb label Nov 5, 2024
@walter-erquinigo walter-erquinigo merged commit 5d39e0c into main Nov 5, 2024
7 of 9 checks passed
@walter-erquinigo walter-erquinigo deleted the revert-113521-users/walter-erquinigo/run branch November 5, 2024 12:12
@llvmbot
Copy link
Member

llvmbot commented Nov 5, 2024

@llvm/pr-subscribers-lldb

Author: Walter Erquinigo (walter-erquinigo)

Changes

Reverts llvm/llvm-project#113521 due to build bot failures mentioned in the original PR.


Full diff: https://github.com/llvm/llvm-project/pull/114973.diff

7 Files Affected:

  • (modified) lldb/include/lldb/Target/Target.h (-3)
  • (modified) lldb/source/Commands/CommandObjectProcess.cpp (-7)
  • (modified) lldb/source/Commands/Options.td (+1-4)
  • (modified) lldb/source/Target/Target.cpp (-5)
  • (modified) lldb/source/Target/TargetProperties.td (-7)
  • (modified) lldb/test/API/commands/process/launch/TestProcessLaunch.py (-57)
  • (modified) llvm/docs/ReleaseNotes.md (-2)
diff --git a/lldb/include/lldb/Target/Target.h b/lldb/include/lldb/Target/Target.h
index cab21c29a7486f..e4848f19e64d62 100644
--- a/lldb/include/lldb/Target/Target.h
+++ b/lldb/include/lldb/Target/Target.h
@@ -37,7 +37,6 @@
 #include "lldb/Utility/RealpathPrefixes.h"
 #include "lldb/Utility/Timeout.h"
 #include "lldb/lldb-public.h"
-#include "llvm/ADT/StringRef.h"
 
 namespace lldb_private {
 
@@ -115,8 +114,6 @@ class TargetProperties : public Properties {
 
   void SetDisableSTDIO(bool b);
 
-  llvm::StringRef GetLaunchWorkingDirectory() const;
-
   const char *GetDisassemblyFlavor() const;
 
   InlineStrategy GetInlineStrategy() const;
diff --git a/lldb/source/Commands/CommandObjectProcess.cpp b/lldb/source/Commands/CommandObjectProcess.cpp
index 7444e46aa729e7..e7c7d07ad47722 100644
--- a/lldb/source/Commands/CommandObjectProcess.cpp
+++ b/lldb/source/Commands/CommandObjectProcess.cpp
@@ -201,13 +201,6 @@ class CommandObjectProcessLaunch : public CommandObjectProcessLaunchOrAttach {
     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(),
diff --git a/lldb/source/Commands/Options.td b/lldb/source/Commands/Options.td
index 9d8d45d083eca4..4276d9e7f9c8b0 100644
--- a/lldb/source/Commands/Options.td
+++ b/lldb/source/Commands/Options.td
@@ -691,10 +691,7 @@ let Command = "process launch" in {
   def process_launch_plugin : Option<"plugin", "P">, Arg<"Plugin">,
     Desc<"Name of the process plugin you want to use.">;
   def process_launch_working_dir : Option<"working-dir", "w">, Arg<"DirectoryName">,
-    Desc<"Set the current working directory to <path> when running the inferior. This option "
-         "applies only to the current `process launch` invocation. If "
-         "`target.launch-working-dir` is set and this option is given, the value of this "
-         "option will be used instead of the setting.">;
+    Desc<"Set the current working directory to <path> when running the inferior.">;
   def process_launch_arch : Option<"arch", "a">, Arg<"Architecture">,
     Desc<"Set the architecture for the process to launch when ambiguous.">;
   def process_launch_environment : Option<"environment", "E">,
diff --git a/lldb/source/Target/Target.cpp b/lldb/source/Target/Target.cpp
index 242d2eaec2a15a..8cd3fa8af6bae1 100644
--- a/lldb/source/Target/Target.cpp
+++ b/lldb/source/Target/Target.cpp
@@ -4471,11 +4471,6 @@ void TargetProperties::SetDisableSTDIO(bool b) {
   const uint32_t idx = ePropertyDisableSTDIO;
   SetPropertyAtIndex(idx, b);
 }
-llvm::StringRef TargetProperties::GetLaunchWorkingDirectory() const {
-  const uint32_t idx = ePropertyLaunchWorkingDir;
-  return GetPropertyAtIndexAs<llvm::StringRef>(
-      idx, g_target_properties[idx].default_cstr_value);
-}
 
 const char *TargetProperties::GetDisassemblyFlavor() const {
   const uint32_t idx = ePropertyDisassemblyFlavor;
diff --git a/lldb/source/Target/TargetProperties.td b/lldb/source/Target/TargetProperties.td
index 00ad8dd2a9f7f9..fb61478fb752dc 100644
--- a/lldb/source/Target/TargetProperties.td
+++ b/lldb/source/Target/TargetProperties.td
@@ -201,13 +201,6 @@ let Definition = "target" in {
   def DebugUtilityExpression: Property<"debug-utility-expression", "Boolean">,
     DefaultFalse,
     Desc<"Enable debugging of LLDB-internal utility expressions.">;
-  def LaunchWorkingDir: Property<"launch-working-dir", "String">,
-    DefaultStringValue<"">,
-    Desc<"A default value for the working directory to use when launching processes. "
-         "It is ignored when empty. This setting is only used when the target is "
-         "launched. If you change this setting, the new value will only apply to "
-         "subsequent launches. Commands that take an explicit working directory "
-         "will override this setting.">;
 }
 
 let Definition = "process_experimental" in {
diff --git a/lldb/test/API/commands/process/launch/TestProcessLaunch.py b/lldb/test/API/commands/process/launch/TestProcessLaunch.py
index 2da75544dd5c90..45f9f494ab8f5c 100644
--- a/lldb/test/API/commands/process/launch/TestProcessLaunch.py
+++ b/lldb/test/API/commands/process/launch/TestProcessLaunch.py
@@ -8,7 +8,6 @@
 from lldbsuite.test.decorators import *
 from lldbsuite.test.lldbtest import *
 from lldbsuite.test import lldbutil
-from pathlib import Path
 
 
 class ProcessLaunchTestCase(TestBase):
@@ -207,59 +206,3 @@ def test_environment_with_special_char(self):
         self.assertEqual(value, evil_var)
         process.Continue()
         self.assertState(process.GetState(), lldb.eStateExited, PROCESS_EXITED)
-
-    def test_target_launch_working_dir_prop(self):
-        """Test that the setting `target.launch-working-dir` is correctly used when launching a process."""
-        d = {"CXX_SOURCES": "print_cwd.cpp"}
-        self.build(dictionary=d)
-        self.setTearDownCleanup(d)
-        exe = self.getBuildArtifact("a.out")
-        self.runCmd("file " + exe)
-
-        mywd = "my_working_dir"
-        out_file_name = "my_working_dir_test.out"
-
-        my_working_dir_path = self.getBuildArtifact(mywd)
-        lldbutil.mkdir_p(my_working_dir_path)
-        out_file_path = os.path.join(my_working_dir_path, out_file_name)
-        another_working_dir_path = Path(
-            os.path.join(my_working_dir_path, "..")
-        ).resolve()
-
-        # If -w is not passed to process launch, then the setting will be used.
-        self.runCmd(
-            f"settings set target.launch-working-dir {another_working_dir_path}"
-        )
-        launch_command = f"process launch -o {out_file_path}"
-
-        self.expect(
-            launch_command,
-            patterns=["Process .* launched: .*a.out"],
-        )
-
-        out = lldbutil.read_file_on_target(self, out_file_path)
-
-        self.assertIn(f"stdout: {another_working_dir_path}", out)
-
-        # If -w is passed to process launch, that value will be used instead of the setting.
-        launch_command = f"process launch -w {my_working_dir_path} -o {out_file_path}"
-
-        self.expect(
-            launch_command,
-            patterns=["Process .* launched: .*a.out"],
-        )
-
-        out = lldbutil.read_file_on_target(self, out_file_path)
-        self.assertIn(f"stdout: {my_working_dir_path}", out)
-
-        # If set to empty, then LLDB's cwd will be used to launch the process.
-        self.runCmd(f"settings set target.launch-working-dir ''")
-        launch_command = f"process launch -o {out_file_path}"
-
-        self.expect(
-            launch_command,
-            patterns=["Process .* launched: .*a.out"],
-        )
-
-        out = lldbutil.read_file_on_target(self, out_file_path)
-        self.assertNotIn(f"stdout: {another_working_dir_path}", out)
diff --git a/llvm/docs/ReleaseNotes.md b/llvm/docs/ReleaseNotes.md
index 5252ae5aadcf6a..290473cdb46f4c 100644
--- a/llvm/docs/ReleaseNotes.md
+++ b/llvm/docs/ReleaseNotes.md
@@ -309,8 +309,6 @@ Changes to LLDB
 * Program stdout/stderr redirection will now open the file with O_TRUNC flag, make sure to truncate the file if path already exists.
   * eg. `settings set target.output-path/target.error-path <path/to/file>`
 
-* A new setting `target.launch-working-dir` can be used to set a persistent cwd that is used by default by `process launch` and `run`.
-
 Changes to BOLT
 ---------------------------------
 

@llvm-ci
Copy link
Collaborator

llvm-ci commented Nov 5, 2024

LLVM Buildbot has detected a new failure on builder openmp-s390x-linux running on systemz-1 while building lldb,llvm at step 6 "test-openmp".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/88/builds/4281

Here is the relevant piece of the build log for the reference
Step 6 (test-openmp) failure: test (failure)
******************** TEST 'libomp :: tasking/issue-94260-2.c' FAILED ********************
Exit Code: -11

Command Output (stdout):
--
# RUN: at line 1
/home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/./bin/clang -fopenmp   -I /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/runtimes/runtimes-bins/openmp/runtime/src -I /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.src/openmp/runtime/test -L /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/runtimes/runtimes-bins/openmp/runtime/src  -fno-omit-frame-pointer -mbackchain -I /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.src/openmp/runtime/test/ompt /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.src/openmp/runtime/test/tasking/issue-94260-2.c -o /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/runtimes/runtimes-bins/openmp/runtime/test/tasking/Output/issue-94260-2.c.tmp -lm -latomic && /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/runtimes/runtimes-bins/openmp/runtime/test/tasking/Output/issue-94260-2.c.tmp
# executed command: /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/./bin/clang -fopenmp -I /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/runtimes/runtimes-bins/openmp/runtime/src -I /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.src/openmp/runtime/test -L /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/runtimes/runtimes-bins/openmp/runtime/src -fno-omit-frame-pointer -mbackchain -I /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.src/openmp/runtime/test/ompt /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.src/openmp/runtime/test/tasking/issue-94260-2.c -o /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/runtimes/runtimes-bins/openmp/runtime/test/tasking/Output/issue-94260-2.c.tmp -lm -latomic
# executed command: /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/runtimes/runtimes-bins/openmp/runtime/test/tasking/Output/issue-94260-2.c.tmp
# note: command had no output on stdout or stderr
# error: command failed with exit status: -11

--

********************


PhilippRados pushed a commit to PhilippRados/llvm-project that referenced this pull request Nov 6, 2024
Reverts llvm#113521 due to build bot failures mentioned in
the original PR.
@keith
Copy link
Member

keith commented Dec 20, 2024

did this one reland somewhere?

@DavidSpickett
Copy link
Collaborator

e952728 relanded this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants