mirror of
https://github.com/RGBCube/serenity
synced 2025-07-28 12:17:45 +00:00
Meta: Support 'serenity.sh gdb lagom'
This commit is contained in:
parent
eb5b2b4b4f
commit
89602c6fc0
1 changed files with 26 additions and 10 deletions
|
@ -17,8 +17,10 @@ Usage: $ARG0 COMMAND [TARGET] [ARGS...]
|
||||||
Runs the built image in QEMU, and optionally passes the
|
Runs the built image in QEMU, and optionally passes the
|
||||||
KERNEL_CMD_LINE to the Kernel
|
KERNEL_CMD_LINE to the Kernel
|
||||||
gdb: Same as run, but also starts a gdb remote session.
|
gdb: Same as run, but also starts a gdb remote session.
|
||||||
$ARG0 gdb [TARGET] [kernel_cmd_line] [-ex 'any gdb command']...
|
TARGET lagom: $ARG0 gdb lagom LAGOM_EXECUTABLE [-ex 'any gdb command']...
|
||||||
If specified, passes the kernel_cmd_line to the Kernel
|
Passes through '-ex' commands to gdb
|
||||||
|
All other TARGETs: $ARG0 gdb [TARGET] [KERNEL_CMD_LINE] [-ex 'any gdb command']...
|
||||||
|
If specified, passes the KERNEL_CMD_LINE to the Kernel
|
||||||
Passes through '-ex' commands to gdb
|
Passes through '-ex' commands to gdb
|
||||||
test: TARGET lagom: $ARG0 test lagom [TEST_NAME_PATTERN]
|
test: TARGET lagom: $ARG0 test lagom [TEST_NAME_PATTERN]
|
||||||
Runs the unit tests on the build host, or if TEST_NAME_PATTERN
|
Runs the unit tests on the build host, or if TEST_NAME_PATTERN
|
||||||
|
@ -162,6 +164,7 @@ run_gdb() {
|
||||||
local GDB_ARGS=()
|
local GDB_ARGS=()
|
||||||
local PASS_ARG_TO_GDB=""
|
local PASS_ARG_TO_GDB=""
|
||||||
local KERNEL_CMD_LINE=""
|
local KERNEL_CMD_LINE=""
|
||||||
|
local LAGOM_EXECUTABLE=""
|
||||||
for arg in "${CMD_ARGS[@]}"; do
|
for arg in "${CMD_ARGS[@]}"; do
|
||||||
if [ "$PASS_ARG_TO_GDB" != "" ]; then
|
if [ "$PASS_ARG_TO_GDB" != "" ]; then
|
||||||
GDB_ARGS+=( "$PASS_ARG_TO_GDB" "$arg" )
|
GDB_ARGS+=( "$PASS_ARG_TO_GDB" "$arg" )
|
||||||
|
@ -170,20 +173,31 @@ run_gdb() {
|
||||||
PASS_ARG_TO_GDB="$arg"
|
PASS_ARG_TO_GDB="$arg"
|
||||||
elif [[ "$arg" =~ ^-.*$ ]]; then
|
elif [[ "$arg" =~ ^-.*$ ]]; then
|
||||||
die "Don't know how to handle argument: $arg"
|
die "Don't know how to handle argument: $arg"
|
||||||
|
else
|
||||||
|
if [ "$TARGET" = "lagom" ]; then
|
||||||
|
if [ "$LAGOM_EXECUTABLE" != "" ]; then
|
||||||
|
die "Lagom executable can't be specified more than once"
|
||||||
|
fi
|
||||||
|
LAGOM_EXECUTABLE="$arg"
|
||||||
else
|
else
|
||||||
if [ "$KERNEL_CMD_LINE" != "" ]; then
|
if [ "$KERNEL_CMD_LINE" != "" ]; then
|
||||||
die "Kernel command line can't be specified more than once"
|
die "Kernel command line can't be specified more than once"
|
||||||
fi
|
fi
|
||||||
KERNEL_CMD_LINE="$arg"
|
KERNEL_CMD_LINE="$arg"
|
||||||
fi
|
fi
|
||||||
|
fi
|
||||||
done
|
done
|
||||||
if [ "$PASS_ARG_TO_GDB" != "" ]; then
|
if [ "$PASS_ARG_TO_GDB" != "" ]; then
|
||||||
GDB_ARGS+=( "$PASS_ARG_TO_GDB" )
|
GDB_ARGS+=( "$PASS_ARG_TO_GDB" )
|
||||||
fi
|
fi
|
||||||
|
if [ "$TARGET" = "lagom" ]; then
|
||||||
|
gdb "$BUILD_DIR/Meta/Lagom/$LAGOM_EXECUTABLE" "${GDB_ARGS[@]}"
|
||||||
|
else
|
||||||
if [ -n "$KERNEL_CMD_LINE" ]; then
|
if [ -n "$KERNEL_CMD_LINE" ]; then
|
||||||
export SERENITY_KERNEL_CMDLINE="$KERNEL_CMD_LINE"
|
export SERENITY_KERNEL_CMDLINE="$KERNEL_CMD_LINE"
|
||||||
fi
|
fi
|
||||||
gdb "$BUILD_DIR/Kernel/Kernel" -ex 'target remote :1234' "${GDB_ARGS[@]}" -ex cont
|
gdb "$BUILD_DIR/Kernel/Kernel" -ex 'target remote :1234' "${GDB_ARGS[@]}" -ex cont
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
if [[ "$CMD" =~ ^(build|install|image|run|gdb|test|rebuild|recreate|kaddr2line|addr2line|setup-and-run)$ ]]; then
|
if [[ "$CMD" =~ ^(build|install|image|run|gdb|test|rebuild|recreate|kaddr2line|addr2line|setup-and-run)$ ]]; then
|
||||||
|
@ -225,10 +239,12 @@ if [[ "$CMD" =~ ^(build|install|image|run|gdb|test|rebuild|recreate|kaddr2line|a
|
||||||
;;
|
;;
|
||||||
gdb)
|
gdb)
|
||||||
command -v tmux >/dev/null 2>&1 || die "Please install tmux!"
|
command -v tmux >/dev/null 2>&1 || die "Please install tmux!"
|
||||||
build_target
|
|
||||||
if [ "$TARGET" = "lagom" ]; then
|
if [ "$TARGET" = "lagom" ]; then
|
||||||
lagom_unsupported
|
[ $# -ge 1 ] || usage
|
||||||
|
build_target "$@"
|
||||||
|
run_gdb "${CMD_ARGS[@]}"
|
||||||
else
|
else
|
||||||
|
build_target
|
||||||
build_target install
|
build_target install
|
||||||
build_target image
|
build_target image
|
||||||
tmux new-session "$ARG0" __tmux_cmd "$TARGET" run "${CMD_ARGS[@]}" \; set-option -t 0 mouse on \; split-window "$ARG0" __tmux_cmd "$TARGET" gdb "${CMD_ARGS[@]}" \;
|
tmux new-session "$ARG0" __tmux_cmd "$TARGET" run "${CMD_ARGS[@]}" \; set-option -t 0 mouse on \; split-window "$ARG0" __tmux_cmd "$TARGET" gdb "${CMD_ARGS[@]}" \;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue