0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

C言語のGDBデバッガを使用したがっつりとしたテスト時に重宝した設定やマクロ

0
Last updated at Posted at 2026-06-04

本ページではgdbをひっさびさに仕事で使用したときの備忘録等記載します。
(よかったら使ってね。)

独自マクロ

変数名の表示マクロ

define pv 
    if $argc == 2
        set var $arg0=$arg1
        printf "%s: ","$arg0"
        output $arg0
        echo \n
    else 
        printf "%s: ","$arg0"
        output $arg0
        echo \n
    end
end

breakとjumpを同時に実行するマクロ

  • jump単体ではうまくいかない時が大半なので、breakと併用することで行ける。
  • 注意:jumpでの動作保証は一切できないことを気に留めること、、、、必ずだぞ?
define bj
    break $arg0
    jump $arg0
end

よく使用した設定集

  • まだ到達していない部分のブレークポイントを設定しておける優れもの
set breakpoint pending on

よく使用した起動コマンド

これできちんと設定が読み込まれる

gdb -nx -x ./.gdbinit [program name]
0
0
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
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?