Skip to content

Commit 5b6ccfe

Browse files
committed
Add support for child process debugging to debug-cygwin.sh
1 parent 20e657c commit 5b6ccfe

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

.github/scripts/toolchain/debug-cygwin.sh

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ show_help() {
2626
echo " -t, --ttd <path> Specify TTD engine path (optional)"
2727
echo " -c, --collect Launch TDD recording"
2828
echo " -l, --launch Launch WinDbgX immediately after recording"
29+
echo " --child <id> Launch WinDbgx session for child process recording (optional)"
2930
echo " -f, --folder <path> Specify folder to copy binary and cygwin1.dll (optional)"
3031
echo ""
3132
echo "Example:"
@@ -42,6 +43,8 @@ EXECUTABLE_ARGS=""
4243
WINDBGX_PATH=""
4344
TTD_ENGINE=""
4445
COPY_FOLDER=""
46+
CHILD=0
47+
CHILD_ID="01"
4548

4649
while [[ $# -gt 0 ]]; do
4750
case $1 in
@@ -69,6 +72,11 @@ while [[ $# -gt 0 ]]; do
6972
LAUNCH_WINDBG=1
7073
shift
7174
;;
75+
--child)
76+
CHILD=1
77+
CHILD_ID="$2"
78+
shift 2
79+
;;
7280
-f|--folder)
7381
COPY_FOLDER="$2"
7482
shift 2
@@ -161,9 +169,15 @@ if [ $LAUNCH_TTD -eq 1 ]; then
161169
fi
162170

163171
if [ -f "$LOG_FILE" ]; then
172+
echo "Parent recording log:"
164173
cat "$LOG_FILE"
165174
fi
166175

176+
if [ $CHILD -eq 1 ]; then
177+
echo "Child $CHILD_ID recording log:"
178+
cat "${LOG_FILE%.out}$CHILD_ID.out"
179+
fi
180+
167181
if [ ! -f "$OUTPUT_FILE" ]; then
168182
echo "Error: TTD output file $OUTPUT_FILE has not been created."
169183
exit 1
@@ -179,6 +193,10 @@ if [ $LAUNCH_WINDBG -eq 1 ]; then
179193
exit 1
180194
fi
181195

196+
if [ $CHILD -eq 1 ]; then
197+
WIN_OUTPUT_FILE="${WIN_OUTPUT_FILE%.run}$CHILD_ID.run"
198+
fi
199+
182200
cat <<EOF > $EXECUTABLE_DIR/script
183201
bm main
184202
bm cygwin1!setjmp

0 commit comments

Comments
 (0)