Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduces --debugger-command flag to krun #3687

Merged
merged 4 commits into from
Oct 4, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 27 additions & 4 deletions k-distribution/src/main/scripts/bin/krun
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,16 @@ filterSubst=
if [[ "$OSTYPE" == "darwin"* ]]; then
LLDB_FILE="$(dirname "$0")/../lib/kllvm/lldb/k_lldb_path"
if [ -f "$LLDB_FILE" ]; then
DBG_CMD="$(cat "$LLDB_FILE") -- "
DBG_EXE="$(cat "$LLDB_FILE")"
else
DBG_CMD="lldb --"
DBG_EXE="lldb"
fi
DBG_CMD=" --"
DBG_FLAG=" -s "
else
DBG_CMD="gdb --args "
DBG_EXE="gdb"
DBG_FLAG=" -x "
DBG_CMD=" --args "
fi


Expand Down Expand Up @@ -112,6 +116,10 @@ $KRUN options:
parser. This can be overridden with -p.
--debugger Launch the backend in a debugging console.
Currently only supported on LLVM backend.
--debugger-batch Launch the backend in a debugging console in batch
mode. Currently only supported on LLVM backend.
--debugger-command FILE Execute GDB commands from FILE to debug program.
Currently only supported on LLVM backend.
-d, --directory DIR [DEPRECATED] Look for a kompiled directory ending in "-kompiled"
under the directory DIR.
--dry-run Do not execute backend, but instead print the
Expand Down Expand Up @@ -392,9 +400,24 @@ do
;;

--debugger)
cmdprefix="$DBG_CMD"
cmdprefix="$DBG_EXE $DBG_CMD"
;;

--debugger-command)
debugCommandFile="$2"
cmdprefix="$DBG_EXE $DBG_FLAG $debugCommandFile $DBG_CMD"
shift
;;

--debugger-batch)
if [[ $cmdprefix == *gdb* || $cmdprefix == *lldb* ]]; then
cmdprefix="$DBG_EXE --batch $DBG_FLAG $debugCommandFile $DBG_CMD"
else
DBG_CMD=" --batch $DBG_CMD"
fi
;;


--statistics)
statistics=true
;;
Expand Down