Skip to content

Commit d71fc32

Browse files
committed
[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
1 parent 17de7ed commit d71fc32

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

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

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44

55

66
device_id = os.environ.get('SANITIZER_IOSSIM_TEST_DEVICE_IDENTIFIER')
7+
iossim_run_verbose = os.environ.get('SANITIZER_IOSSIM_RUN_VERBOSE')
8+
wait_for_debug = os.environ.get('SANITIZER_IOSSIM_RUN_WAIT_FOR_DEBUGGER')
9+
710
if not device_id:
811
raise EnvironmentError("Specify SANITIZER_IOSSIM_TEST_DEVICE_IDENTIFIER to select which simulator to use.")
912

@@ -34,9 +37,25 @@
3437
rm_cmd_line = ["/bin/rm"] + rm_args
3538
rm_cmd_line_str = ' '.join(rm_cmd_line)
3639
# We use `shell=True` so that any wildcard globs get expanded by the shell.
40+
41+
if iossim_run_verbose:
42+
print("RUNNING: \t{}".format(rm_cmd_line_str))
43+
3744
exitcode = subprocess.call(rm_cmd_line_str, shell=True)
45+
3846
else:
39-
exitcode = subprocess.call(["xcrun", "simctl", "spawn", "--standalone", device_id] + sys.argv[1:])
47+
cmd = ["xcrun", "simctl", "spawn", "--standalone"]
48+
49+
if wait_for_debug:
50+
cmd.append("--wait-for-debugger")
51+
52+
cmd.append(device_id)
53+
cmd += sys.argv[1:]
54+
55+
if iossim_run_verbose:
56+
print("RUNNING: \t{}".format(" ".join(cmd)))
57+
58+
exitcode = subprocess.call(cmd)
4059
if exitcode > 125:
4160
exitcode = 126
4261
sys.exit(exitcode)

0 commit comments

Comments
 (0)