================
@@ -22,6 +25,60 @@ def _disallow(config, execName):
     config.substitutions.append((" {0} ".format(execName), 
warning.format(execName)))
 
 
+def get_lldb_args(config, suffix=""):
+    lldb_args = []
+    if "remote-linux" in config.available_features:
+        lldb_args += [
+            "-O",
+            '"platform select remote-linux"',
+            "-O",
+            f'"platform connect {config.lldb_platform_url}"',
+        ]
+        if config.lldb_platform_working_dir:
+            dir = posixpath.join(f"{config.lldb_platform_working_dir}", 
"shell")
+            if suffix:
+                dir += posixpath.join(dir, f"{suffix}")
+            lldb_args += [
+                "-O",
+                f'"platform shell mkdir -p {dir}"',
+                "-O",
+                f'"platform settings -w {dir}"',
+            ]
+    lldb_args += ["--no-lldbinit", "-S", _get_lldb_init_path(config)]
+    return lldb_args
+
+
+class ShTestLldb(ShTest):
+    def __init__(
+        self, execute_external=False, extra_substitutions=[], 
preamble_commands=[]
+    ):
+        super().__init__(execute_external, extra_substitutions, 
preamble_commands)
+
+    def execute(self, test, litConfig):
+        # Run each Shell test in a separate directory (on remote).
+
+        # Find directory change command in %lldb substitution.
+        for i, t in enumerate(test.config.substitutions):
+            if re.match(t[0], "%lldb"):
+                cmd = t[1]
+                if '-O "platform settings -w ' in cmd:
+                    # If command is present, it is added by get_lldb_args.
----------------
DavidSpickett wrote:

I'm struggling to see exactly what this is replacing and with what.

Can you add a comment giving an example? You say replace the path with the 
tests' path in the suite but it seems like you'd want to append to the path 
originally set wouldn't you?

Also adding something in get_lldb_args to immediately modify it here seems like 
one or the other should do it not both, but without an example that's just a 
feeling I have here.

https://github.com/llvm/llvm-project/pull/95986
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to