Skip to content
Merged
Show file tree
Hide file tree
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
3 changes: 3 additions & 0 deletions boot-qemu-help.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ Optional parameters:
-d | --debug:
Invokes 'set -x' for debugging the script.

-g | --gdb:
Add '-s -S' to the QEMU invocation to allow debugging via GDB.

-h | --help:
Prints this message then exits.

Expand Down
19 changes: 19 additions & 0 deletions boot-qemu.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ function parse_parameters() {
-d|--debug)
set -x ;;

-g|--gdb)
GDB=true
INTERACTIVE=true ;;

-h|--help)
echo
cat "${BASE}"/boot-qemu-help.txt
Expand Down Expand Up @@ -177,6 +181,21 @@ function setup_qemu_args() {
# Invoke QEMU
function invoke_qemu() {
${INTERACTIVE} || QEMU=( timeout "${TIMEOUT:=3m}" unbuffer "${QEMU[@]}" )
if ${GDB:=false}; then
# Print message in bold green
printf '\033[01;32m'
echo
echo "Starting QEMU with GDB connection on port 1234..."
echo
echo "Use:"
echo
printf '\ttarget remote :1234\n'
echo
echo "to connect"
echo
printf '\033[0m'
QEMU=( "${QEMU[@]}" -s -S )

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm playing with this now; does this just fallthrough and execute qemu below?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah, I see, it sets the arg, then executes below. got it.

fi

set -x
"${QEMU[@]}" \
Expand Down