bochs-2.4.5 using notes

一、Ubuntu12.04下bochs安裝過程:
sudo apt-get install vgabios bochs-x bximage bochs

或者是下載bochs-xxx.tar.gz包
tar -xzf bochs-xxx.tar.gz
cd bochs-xxx
./cofigure –enable-debugger –enable-disasm
make
sudo make install

注意"./configure"之後的參數便是打開調試功能的開關。在安裝過程中,如果遇到任何困難,不要驚慌,其官方網站上有詳細的安裝說明。
出現的常見問題以及解決辦法:
(1) 出現
1 “ERROR: X windows gui was selected, but X windows libraries were not found.
解決辦法:
 sudo apt-get install libx11-dev xserver-xorg-dev xorg-dev
(2) 出現
1 “ERROR: pkg-config was not found, or unable to access the gtk+-2.0 package. Install pkg-config and the gtk+ development package, or disable the gui debugger, or the wxWidgets display library (whichever is being used).”
2 ERROR: pkg-config was not found, or unable to access the gtk+-2.0 package.Install pkg-config and the gtk+ development package,or disable the gui debugger, or the wxWidgets display library (whichever is being used)
解決辦法:
sudo apt-get install libgtk2.0-dev
(3)
1 checking for C compiler default output file name… configure: error: C compiler cannot create executables
解決方法:
1 apt-get install libc6-dev
(4)
1 configure: error: C++ preprocessor "/lib/cpp" fails sanity check
解決方法:
1 apt-get install build-essential
(5)
1 X windows gui was selected, but X windows libraries were not found.
解決方法:配置的時候加上–with-nogui(不過後來試了,改成apt-get install xorg-dev也行 )

二、bochs 的調試命令

c|cont|continue - continue executing

s|step [count] - execute #count instructions on current processor (default is one instruction)
s|step [cpu] <count> - execute #count instructions on processor #cpu
s|step all <count> - execute #count instructions on all the processors

n|next|p - execute instruction stepping over subroutines

modebp - toggles mode switch breakpoint

vmexitbp - toggles VMEXIT switch breakpoint

u|disasm [/count] <start> <end> - disassemble instructions for given linear address
    Optional 'count' is the number of disassembled instructions
u|disasm switch-mode - switch between Intel and AT&T disassembler syntax
u|disasm hex on/off - control disasm offsets and displacements format
u|disasm size = n - tell debugger what segment size [16|32|64] to use
       when "disassemble" command is used.

x  /nuf <addr> - examine memory at linear address
xp /nuf <addr> - examine memory at physical address
    nuf is a sequence of numbers (how much values to display)
    and one or more of the [mxduotcsibhwg] format specificators:
    x,d,u,o,t,c,s,i select the format of the output (they stand for
        hex, decimal, unsigned, octal, binary, char, asciiz, instr)
    b,h,w,g select the size of a data element (for byte, half-word,
        word and giant word)
    m selects an alternative output format (memory dump)

三、bochs使用心得

當在工程目錄中打開bochs後,如一下畫面

然後輸入命令

show int

然後接着輸入命令

c

你將會看見仿真系統在中斷觸發時,會顯示在當前終端中,方便trace中斷的執行情況


發佈了59 篇原創文章 · 獲贊 8 · 訪問量 5萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章