Skip to content

Commit 4807b04

Browse files
committed
Merge remote-tracking branch 'origin/develop'
2 parents 553f3d4 + 5b5affe commit 4807b04

File tree

1 file changed

+22
-9
lines changed

1 file changed

+22
-9
lines changed

bin/llvm-krun

Lines changed: 22 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#!/bin/bash
22
set -e
3+
set -x
34

45
params=()
56
pretty=()
@@ -17,8 +18,8 @@ trap 'cleanup' INT TERM EXIT
1718

1819
initializer="LblinitGeneratedTopCell{}"
1920
dir=.
20-
debug=
21-
debug_command=
21+
debug=()
22+
debug_command=()
2223
depth=-1
2324
verbose=0
2425
binary_input=false
@@ -164,22 +165,34 @@ do
164165
;;
165166

166167
--debug)
167-
debug="gdb --args "
168+
if [[ "$OSTYPE" == "darwin"* ]]; then
169+
debug=("lldb" "--")
170+
else
171+
debug=("gdb" "--args")
172+
fi
168173
shift;
169174
;;
170175

171176
--debug-command)
172-
debug_command="$2"
173-
if [[ -z $debug ]]; then
174-
debug="gdb -x ${debug_command} --args "
177+
debug_command+=("$2")
178+
if [[ "$OSTYPE" == "darwin"* ]]; then
179+
debug=("lldb" "-s")
175180
else
176-
debug="${debug/--args /} -x ${debug_command} --args "
181+
debug=("gdb" "-x")
177182
fi
183+
debug+=("${debug_command[@]}")
184+
debug+=("--args")
178185
shift;
186+
shift
179187
;;
180188

181189
--debug-batch)
182-
debug="gdb --batch --args "
190+
if [[ "$OSTYPE" == "darwin"* ]]; then
191+
debug=("lldb" "--batch" "--")
192+
else
193+
debug=("gdb" "batch" "--args")
194+
fi
195+
shift
183196
;;
184197

185198
--depth)
@@ -472,7 +485,7 @@ set +e
472485
if [ "$verbose" -ge 1 ]; then
473486
set -x
474487
fi
475-
$debug "$dir"/interpreter "$expanded_input_file" "$depth" "$output_file" "${interpreter_flags[@]}"
488+
"${debug[@]}" "${dir}/interpreter" "$expanded_input_file" "$depth" "$output_file" "${interpreter_flags[@]}"
476489
)
477490
EXIT=$?
478491
set -e

0 commit comments

Comments
 (0)