LoginSignup
31
25

More than 5 years have passed since last update.

Pythonのデバッガpdb コマンドまとめ

Posted at

pythonのデバッガpdbのコマンドを、自分の備忘録用も兼ねてまとめる。

コマンド

コマンド 何の略 処理
h help h コマンド名でコマンドのhelpを表示
w where スタックトレース(プログラムの実行過程の記録)を表示
s step 現在行を実行し、次の行に進む。
次の行が関数の場合、関数内で停止。
n next 現在行を実行し、次の行に進む。
次の行が関数であっても、関数内で停止しない。
r return 現在の関数から抜ける
l list 現在行周辺のソースを表示
(なお、llコマンドで、より広範囲のソースを表示できる)
a args 現在関数の引数一覧を表示
p print p 変数名で、その変数の値を表示
b break b 行数で、その指定行数にブレークポイントをつけることが出来る
cl clear cl 番号で、指定した番号のブレークポイントを削除
c continue ブレークポイント、あるいはpdb.set_trace()がある行まで実行を継続
q quit デバッガを終了する。
実行中のプログラムは中断される。

参考文献

31
25
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
31
25