Skip to content

Instantly share code, notes, and snippets.

@jamesdabbs
Created December 14, 2012 15:29
Show Gist options
  • Save jamesdabbs/4286267 to your computer and use it in GitHub Desktop.
Save jamesdabbs/4286267 to your computer and use it in GitHub Desktop.
From the root of the relevant engine project, `run path/to/engine_io/dir` will re-run the current binary with the stored flags and input file. `debug` works similarly, but starts gdb with the run command copied to the clipboard (so you can set breakpoints before running it). These are not intended to be comprehensive, but feel free to use them a…
function run {
local command=`cat "$1/command" | grep -o 'bin.*' | cut -d '<' -f 1 | sed "s/'//"`
$command < $1/in.*
}
function debug {
local command=`cat "$1/command" | grep -o 'bin.*' | cut -d '<' -f 1 | sed "s/'//"`
local bin=`echo $command | cut -d '-' -f 1`
local args=`echo $command | grep -o '\-.*'`
echo -n "cmd: $command\tbin: $bin\targs: $args"
echo -n "run $args < $1/in.*" > $1/run.txt
pbcopy < $1/run.txt
gdb $bin
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment