gdb でブレークポイントをお手軽にセットする

ユーザコマンドを定義する。

$ cat > user_commands.txt
define setbreakpoints
b func1
b func2
end
^D

gdb の起動時に -x オプションで先ほど定義したファイルを読み込む。

$ gdb -x user_commands.txt

ユーザ定義コマンドを実行する。

(gdb) setbreakpoints

参考:
- http://sourceware.org/gdb/current/onlinedocs/gdb_21.html