2012-11-26 19 views
0

我正在使用類似x 450bc的東西檢查gdb中的一些二進制數據以查看它的450個連續字節。是否有一種簡單的方法將原始二進制形式的輸出轉儲到文件中,以便通過電子郵件向發件人詢問它?如何將gdb中的x命令的輸出轉儲到文件中?

我嘗試了類似dump binary filename x/450bc但沒有按預期工作。

回答

1

也許你的意思是這樣......

(gdb) p $pc 
$1 = (void (*)()) 0x4004a7 <main+11> 
(gdb) p $pc + 450 
$2 = (void (*)()) 0x400669 
(gdb) dump binary memory ./file $1 $2 

取決於起始地址。

0

這是你要找的命令的幫助:

(gdb) help dump binary memory 
Write contents of memory to a raw binary file. 
Arguments are FILE START STOP. Writes the contents of memory 
within the range [START .. STOP) to the specified FILE in binary format. 

,這是一個例子,如何使用這個命令:

(gdb) dump binary memory my_binary_file.bin 0x22fd8a 0x22fd8a+450 
相關問題