清華大學 ucore lab0 MacOS

2021-10-13 03:10:31 字數 1800 閱讀 4410

因為在虛擬機器上進行開發過於卡頓,所以選擇在 macos 上搭建實驗環境。

homebrew

macports

step2: 使用homebrew安裝qemu

brew update

brew install qemu

sudo port -v selfupdate

sudo port install i386-elf-gcc

然後在 ~/.bash_profile 中新增下面兩行

export prefix=/opt/local

export path="$prefix/bin:$path"

brew install i386-elf-gdb
ifndef qemu

qemu := $(shell if which qemu-system-i386 > /dev/null; \

then echo 'qemu-system-i386'; exit; \

elif which i386-elf-qemu > /dev/null; \

then echo 'i386-elf-qemu'; exit; \

else \

echo "***" 1>&2; \

echo "*** error: couldn't find a working qemu executable." 1>&2; \

echo "*** is the directory containing the qemu binary in your path" 1>&2; \

echo "***" 1>&2; exit 1; fi)

endif

ucoreimg := $(call totarget,ucore.img)

gdb: $(ucoreimg)

$(v)$(qemu) -s -s -parallel stdio -hda $< -serial null

file obj/bootblock.o

target remote :1234

break bootmain

continue

break filename:num	在特定原始檔特定行上設定斷點

clear filename:num 刪除設定在特定原始檔特定行上的斷點

run 執行除錯程式

step 單步執行除錯程式,不會直接執行函式

next 單步執行除錯程式,會直接執行函式

backtrace 顯示所有的呼叫棧幀。該命令可用來顯示函式的呼叫順序

where continue 繼續執行正在除錯的程式

display expr 每次程式停止後顯示表示式的值,表示式由程式定義的變數組成

file filename 裝載指定的可執行檔案進行除錯

help cmdname 顯示指定除錯命令的幫助資訊

info break 顯示當前斷點列表,包括到達斷點處的次數等

info files 顯示被除錯檔案的詳細資訊

info func 顯示被除錯程式的所有函式名稱

info prog 顯示被除錯程式的執行狀態

info local 顯示被除錯程式當前函式中的區域性變數資訊

info var 顯示被除錯程式的所有全域性和靜態變數名稱

kill 終止正在被除錯的程式

list 顯示被除錯程式的源**

quit 退出 gdb

參考文件

蓋茨清華大學演講

尊敬的顧校長,清華大學的老師 同學們 獲得清華大學這所世界一流大學的榮譽博士學位,讓我感到非常榮幸。清華是所有著百年歷史的名校,這裡誕生了很多傑出的科學家 商業和政治領袖。我上一次造訪貴校是在1997年。當時,貴校學生的才華 熱情和創造性給我留下了很深的印象。之後,我決定在中國設立微軟研究院。在沈向...

清華大學 自學能力

一 永遠不要說你已經盡力了 我在高中時體育特別差,跑1000公尺都很要命,從來都是不及格。到了清華之後,第一節體育課,老師告訴我們每年要測3000公尺長跑,跑不過不許畢業,取消推研資格。怎麼辦?於是每天晚上10 30,我們的自習教室關門,操場上的人就多起來了。跑半個小時再回寢室繼續學習,練了乙個學期...

查詢學生資訊 清華大學

牛客網題目鏈結 排序題。先儲存再查詢 include include include include include include include include include include using namespace std const int n 1005 typedef pair i...