2
1

More than 5 years have passed since last update.

GDBでブレークポイントの名前解決を遅延させる

Last updated at Posted at 2014-03-20

Pythonの拡張ライブラリをgdbでデバッグするのにいちいちrun test.pyとか打ち込みたくなかった。

gdbは-xオプションでコマンドの書かれたファイルを読み込むことができる。だからここにブレークポイントの設定とかrun test.pyとかを書いたらいいや、と思ったのだが、python起動時にはまだ拡張ライブラリが読まれていないので名前の解決を遅延させる必要がある。対話的に使う場合には遅延させるかどうか聞いてくるから悩むこともないのだけど今回はファイルで指定したい。どうやるか?

debug.gdbの中身(fooがブレークポイントを仕掛けたい関数の名前)

set breakpoint pending on
break foo
run test.py

これを以下のようにして使えばOK

$ gdb python -x debug.gdb
2
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
1