Skip to content

Instantly share code, notes, and snippets.

View lamontnelson's full-sized avatar

Lamont Nelson lamontnelson

  • Brooklyn, New York
View GitHub Profile
@lamontnelson
lamontnelson / tgdb.sh
Created March 29, 2016 02:39
automatically open tmux panes containing gdb attached to processes with the given name
#!/bin/bash
PROC_NAME=${1-"myserver"}
SESSION_NAME=${2-"tmuxgdbsession"}
echo "create tmux session in $SESSION_NAME"
pids=`ps aux | grep "$PROC_NAME" | grep -v grep | awk '{print $2}'`
echo "Attach to pids $(echo $pids | tr -d '\r\n')"
attach_gdb() {
cmd="gdb -p $1"