From 8bf2425c4a71e51fb07eb2fbbba64c779a2be70d Mon Sep 17 00:00:00 2001 From: "Justin C. Miller" Date: Tue, 4 Jul 2023 16:23:47 -0700 Subject: [PATCH] [tools] Make qemu.sh debugcon output optional I got sick of closing the debugcon window all the time when I only need it sometimes, so it's now gated behind the '-x' option to qemu.sh. --- qemu.sh | 35 ++++++++++++++++++++++++----------- 1 file changed, 24 insertions(+), 11 deletions(-) diff --git a/qemu.sh b/qemu.sh index a2ebf88..8577447 100755 --- a/qemu.sh +++ b/qemu.sh @@ -9,6 +9,7 @@ gfx="-nographic" vga="-vga none" log="" kvm="" +debugcon_cmd="" cpu_features=",+pdpe1gb,+invtsc,+hypervisor,+x2apic,+xsavec,+xsaves,+xsaveopt" cpu="Broadwell" smp=4 @@ -36,8 +37,8 @@ while true; do ;; -r | --remote) shift - vnchost="${1:-${VNCHOST:-localhost}}" - gfx="-vnc ${vnchost}:5500,reverse" + vnchost="${1:-${VNCHOST:-"localhost:5500"}}" + gfx="-vnc ${vnchost},reverse" vga="" shift ;; @@ -54,6 +55,10 @@ while true; do log="-d mmu,int,guest_errors -D jsix.log" shift ;; + -x | --debugcon) + debugcon_cmd="less --follow-name -R +F debugcon.log" + shift + ;; *) if [ -d "$1" ]; then build="$1" @@ -74,29 +79,37 @@ fi if [[ -n $TMUX ]]; then cols=$(tput cols) + log_width=100 if [[ -n $debug ]]; then - log_width=100 - gdb_width=$(($cols - 2 * $log_width)) + log_cols=1 + if [[ $debugcon_cmd ]]; then + log_cols=2 + fi - debugcon_cmd="less --follow-name -r +F debugcon.log" + gdb_width=$(($cols - $log_cols * $log_width)) if (($gdb_width < 150)); then stack=1 gdb_width=$(($cols - $log_width)) tmux split-window -h -l $gdb_width "gdb ${debugtarget}" - tmux select-pane -t .left - tmux split-window -v "$debugcon_cmd" - tmux select-pane -t .right + if [[ $debugcon_cmd ]]; then + tmux select-pane -t .left + tmux split-window -v "$debugcon_cmd" + fi else - tmux split-window -h -l $(($log_width + $gdb_width)) "$debugcon_cmd" + if [[ $debugcon_cmd ]]; then + tmux split-window -h -l $(($log_width + $gdb_width)) "$debugcon_cmd" + fi tmux split-window -h -l $gdb_width "gdb ${debugtarget}" tmux select-pane -t .left tmux select-pane -t .right fi else - tmux split-window -h -l 100 "less --follow-name -r +F debugcon.log" - tmux last-pane + if [[ $debugcon_cmd ]]; then + tmux split-window -h -l $log_width "$debugcon_cmd" + tmux last-pane + fi tmux split-window -l 10 "sleep 1; telnet localhost 45454" fi elif [[ $DESKTOP_SESSION = "i3" ]]; then