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?

More than 1 year has passed since last update.

gdbに文字列をそのまま出力させる設定

Last updated at Posted at 2022-12-05

あるプログラムをgdbでデバッグしているときに,16進数の文字列表現が入っている文字列を確認したら以下のように表示されました.

(gdb) print some_string
$1 = 0x55eda9605f90 "55aa", '0' <repeats 29 times>, "46f", '0' <repeats 28 times>, "107c00000202", '0' <repeats 76 times>, "1", '0' <repeats 47 times>...

文字列全体を表示してくれてないし,なんやこの繰り返し表現は.
文字列全体を表示し,変な繰り返し表現をさせないように,.gdbinitに以下の設定を追加

set print elements 0
set print repeats 0

そんでさっきと同じことをやってみる.

(gdb) print some_string
$1 = 0x558eb89130a0 "55aa0000000000000000000000000000046f0000000000000000000000000000107c0000020200000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ac79cfd1f71772b1fe3f99f7cffb849a209afd3f35c26821a2da0fc90040bcf0175c293baab8ff3ffe8a1bcd4b789ad400400000000000000080ff3f7f030000000800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000801f0000"

これでいいのだ.

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?