fish: functions/gdbt: Spawning GDB with tmux panes

Adapted from https://github.com/cyrus-and/gdb-dashboard/issues/63.
This commit is contained in:
Sanchayan Maity 2022-03-29 13:20:56 +05:30
parent 16448b27a5
commit 8d44f5ced6

View file

@ -0,0 +1,24 @@
function gdbt -d "GDB with tmux panes"
if set -q TMUX
set proc (ps -ef | fzf | awk '{print $2}')
if test -n "$proc"
set -l tty1_id (tmux split-pane -hPF "#D" "tail -f /dev/null")
tmux last-pane
set -l tty1 (tmux display-message -p -t "$tty1_id" '#{pane_tty}')
set -l tty2_id (tmux split-pane -hPF "#D" "tail -f /dev/null")
tmux last-pane
set -l tty2 (tmux display-message -p -t "$tty2_id" '#{pane_tty}')
tmux select-layout even-horizontal
gdb -q -ex "dashboard breakpoints -output $tty1" -ex "dashboard variables -output $tty1" -ex "dashboard threads -output $tty2" -ex "attach $proc"
tmux kill-pane -t $tty1_id
tmux kill-pane -t $tty2_id
end
else
echo "Not inside TMUX"
end
end