Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
gdb を使用して int または 16 進数をメモリ アドレスに書き込むのは非常に簡単です。
(gdb) set {int}0x08040000 = 42 (gdb) set {int}0x08040000 = 0xffffffff
しかし、同様に単純な方法で文字または文字列全体をメモリに書き込むにはどうすればよいでしょうか? 現在、文字列を 16 進数に変換してから入力する必要がありますが、これには時間がかかります。
使用するstrcpy()
strcpy()
(gdb) p malloc(20) $3 = (void *) 0x6ce81808 (gdb) p strcpy($3, "my string") $4 = 1827149832 (gdb) x/s $3 0x6ce81808: "my string"