fish: functions/gdbt: Spawning GDB with tmux panes
Adapted from https://github.com/cyrus-and/gdb-dashboard/issues/63.
This commit is contained in:
parent
16448b27a5
commit
8d44f5ced6
1 changed files with 24 additions and 0 deletions
24
fish/.config/fish/functions/gdbt.fish
Normal file
24
fish/.config/fish/functions/gdbt.fish
Normal 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
|
Loading…
Reference in a new issue