2010-07-12 53 views

回答

25

當你沒有調試任何特定的代碼時,gdb似乎會選擇一些令人驚訝的默認值。如果您加載了一個64位可執行文件,如:gdb /bin/sh你得到一個,令人驚訝的少的結果:

(gdb) p sizeof(void *) 
$1 = 8 

你也可以明確告訴gdb來做些什麼:

(gdb) show architecture 
The target architecture is set automatically (currently i386) 
(gdb) p sizeof(void *) 
$1 = 4 
(gdb) set architecture 
Requires an argument. Valid arguments are i386, i386:x86-64, i8086, i386:intel, i386:x86-64:intel, auto. 
(gdb) set architecture i386:x86-64 
The target architecture is assumed to be i386:x86-64 
(gdb) p sizeof(void *) 
$2 = 8 
+3

驚人。架構默認爲i386。 我會報告這個錯誤... – 2010-07-12 21:26:29

相關問題