Skip to content

Instantly share code, notes, and snippets.

@icholy
Last active August 29, 2015 14:11
Show Gist options
  • Save icholy/51e9893d3fbb3db0a102 to your computer and use it in GitHub Desktop.
Save icholy/51e9893d3fbb3db0a102 to your computer and use it in GitHub Desktop.
#!/bin/bash
# Examples:
#
# //break
# //break if foo == 5
#
# Usage:
#
# $ ./gdb_break *.c > breakpoints.txt
# $ gdb -x breakpoints.txt --args main
#
grep //break $@ -RHn | while read line; do
local _bp_loc=$(echo $line | cut -d: -f-2)
local _bp_cond=$(echo $line | awk '{ split($0, a, "//break"); print a[2] }')
echo "break ${_bp_loc}${_bp_cond}"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment