[compiler-rt] d71fc32 - [compiler-rt][NFC] add debugging options to iossim_run

Emily Shi via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 23 13:32:31 PDT 2021


Author: Emily Shi
Date: 2021-07-23T13:32:25-07:00
New Revision: d71fc323f998b0d2f063cfedf53a8d89f8857279

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

LOG: [compiler-rt][NFC] add debugging options to iossim_run

Add the ability to:
1. tell simctl to wait for debugger when spawning process
2. print the command that is called to launch the process

Reviewed By: delcypher

Differential Revision: https://reviews.llvm.org/D106700

Added: 
    

Modified: 
    compiler-rt/test/sanitizer_common/ios_commands/iossim_run.py

Removed: 
    


################################################################################
diff  --git a/compiler-rt/test/sanitizer_common/ios_commands/iossim_run.py b/compiler-rt/test/sanitizer_common/ios_commands/iossim_run.py
index 16b3434a741b4..c8ff980c8b616 100755
--- a/compiler-rt/test/sanitizer_common/ios_commands/iossim_run.py
+++ b/compiler-rt/test/sanitizer_common/ios_commands/iossim_run.py
@@ -4,6 +4,9 @@
 
 
 device_id = os.environ.get('SANITIZER_IOSSIM_TEST_DEVICE_IDENTIFIER')
+iossim_run_verbose = os.environ.get('SANITIZER_IOSSIM_RUN_VERBOSE')
+wait_for_debug = os.environ.get('SANITIZER_IOSSIM_RUN_WAIT_FOR_DEBUGGER')
+
 if not device_id:
   raise EnvironmentError("Specify SANITIZER_IOSSIM_TEST_DEVICE_IDENTIFIER to select which simulator to use.")
 
@@ -34,9 +37,25 @@
   rm_cmd_line = ["/bin/rm"] + rm_args
   rm_cmd_line_str = ' '.join(rm_cmd_line)
   # We use `shell=True` so that any wildcard globs get expanded by the shell.
+
+  if iossim_run_verbose:
+    print("RUNNING: \t{}".format(rm_cmd_line_str))
+
   exitcode = subprocess.call(rm_cmd_line_str, shell=True)
+
 else:
-  exitcode = subprocess.call(["xcrun", "simctl", "spawn", "--standalone", device_id] + sys.argv[1:])
+  cmd = ["xcrun", "simctl", "spawn", "--standalone"]
+
+  if wait_for_debug:
+    cmd.append("--wait-for-debugger")
+
+  cmd.append(device_id)
+  cmd += sys.argv[1:]
+
+  if iossim_run_verbose:
+    print("RUNNING: \t{}".format(" ".join(cmd)))
+
+  exitcode = subprocess.call(cmd)
 if exitcode > 125:
   exitcode = 126
 sys.exit(exitcode)


        


More information about the llvm-commits mailing list