--------------------------------------------------------------
轉自http://yexin218.iteye.com/blog/545187
VMware+Windgb+Win7內核驅動調試
本人在此基礎之上根據具體情況有所改動
--------------------------------------------------------------
本文主要記錄個人安裝VMware+Windgb+Win7內核驅動調試的筆記。
一、安裝環境
主機:Windows 7 x64 En U 版
虛擬機:VMware 7.1.4 VM8.0.2 (親測)
GUestOS(虛擬機): Win7 x64 chs U 版
Windbg: 最新
二、虛擬機配置
- 打開相應 vmware 虛擬機上的 “Virtaul Machine Settings“
- “Hardware ”選項中 ----> 點擊“Add" 添加一個串口設備 SeriallPort .
- "Next",在 "Serial Port" 里選中 “Output to named pipe"
- "next",然后如下設置:
- 確定之后,回到如下界面,在右腳"Virtual Machine Settings" 頁面時,在“I/O Mode” 里選中“Yield CPU on poll“
- Ok之后就設定完畢了。
三、Windbg設置
下載地址: Windbg
安裝之后,設置一個桌面快捷方式,然后,右鍵->屬性,在Target中的引號后面添加如下:-b -k com:pipe,port=\\.\pipe\com_1,resets=0
或者是: -b -k com:port=\\.\pipe\com_1,baud=115200,pipe 【二者似乎皆可】
四、GuestOS設置 (就是虛擬機里的系統配置)
適用於win7 vistar 如果感覺黑窗口玩不了 請看 7. 這種方法更直觀
- 在administrator權限下, 進入command line模式, 鍵入bcdedit命令, 會出現以下界面:
- 然后, 設置端口COM1, baudrate為115200 (除COM1外, 也可以用1394或USB. 1394用起來比COM口快多了, 當然前提是你需要有1394卡及其驅動. 很惡心的是Vista不再支持1394的文件傳輸協議, 但是用windbg雙機調試還是可以的)
命令為:
bcdedit /dbgsettings {serial [baudrate:value][debugport:value] | 1394 [channel:value] | usb }
- 接着, 我們需要復制一個開機選項, 以進入OS的debug模式
命令為:
bcdedit /copy {current} /d DebugEnty
DebugPoint為選項名稱, 名字可以自己定義. 然后復制得到的ID號.
- 接着增加一個新的選項到引導菜單
bcdedit /displayorder {current} {ID}
這里的{ID}的ID值是剛生成的ID值.
- 激活DEBUG : bcdedit /debug {ID} ON
這里的{ID} 的ID值還是剛才的ID值.
- 命令執行成功后, 重新啟動機器.
- 7.或者更簡單的圖形界面設置:在msconfig界面中,選Boot,再選Advanced options,在選擇Debug、Debug port、Baud rate都打上鈎。如果所示:
- 選擇DebugEntry[debug]作為等入口。啟動后,打開windbg.可以看到類似如下的信息:
- Microsoft (R) Windows Debugger Version 6.11.0001.404 X86
- Copyright (c) Microsoft Corporation. All rights reserved.
- Opened \\.\pipe\com_1
- Waiting to reconnect...
- Connected to Windows 7 7600 x86 compatible target at (Thu Dec 10 17:46:36.928 2009 (GMT+8)), ptr64 FALSE
- Kernel Debugger connection established. (Initial Breakpoint requested)
- Symbol search path is: *** Invalid ***
- ****************************************************************************
- * Symbol loading may be unreliable without a symbol search path. *
- * Use .symfix to have the debugger choose a symbol path. *
- * After setting your symbol path, use .reload to refresh symbol locations. *
- ****************************************************************************
- Executable search path is:
- *********************************************************************
- * Symbols can not be loaded because symbol path is not initialized. *
- * *
- * The Symbol Path can be set by: *
- * using the _NT_SYMBOL_PATH environment variable. *
- * using the -y <symbol_path> argument when starting the debugger. *
- * using .sympath and .sympath+ *
- *********************************************************************
- *** ERROR: Symbol file could not be found. Defaulted to export symbols for ntkrpamp.exe -
- Windows 7 Kernel Version 7600 MP (1 procs) Free x86 compatible
- Product: WinNt, suite: TerminalServer SingleUserTS
- Built by: 7600.16385.x86fre.win7_rtm.090713-1255
- Machine Name:
- Kernel base = 0x83e0f000 PsLoadedModuleList = 0x83f57810
- Debug session time: Thu Dec 10 17:46:32.658 2009 (GMT+8)
- System Uptime: 0 days 0:06:18.429
- Break instruction exception - code 80000003 (first chance)
- *******************************************************************************
- * *
- * You are seeing this message because you pressed either *
- * CTRL+C (if you run kd.exe) or, *
- * CTRL+BREAK (if you run WinDBG), *
- * on your debugger machine's keyboard. *
- * *
- * THIS IS NOT A BUG OR A SYSTEM CRASH *
- * *
- * If you did not intend to break into the debugger, press the "g" key, then *
- * press the "Enter" key now. This message might immediately reappear. If it *
- * does, press "g" and "Enter" again. *
- * *
- *******************************************************************************
- nt!DbgBreakPointWithStatus+0x4:
- 83e7a394 cc int 3
五、操作方式提示
我發現,如果在GuestOs -win7啟動過程中,如果打開了windbg之后,整個系統就像死機,不動了。估計是windbg啟動后設定了斷點做調試,試試按F5,或者go這樣就可以恢復原來的狀態
----------------------------------問題及解決辦法-----------------------------------------------------------------------------------
Windows7 x64 + VMware + WinDbg 雙機調試故障解決
源於: http://blog.tianya.cn/blogger/post_read.asp?BlogID=1439846&PostID=38575768
最近對虛擬機及里面的OS都進行了升級,在配置Windbg雙機調試時,出現兩個問題。
在網上搜了搜,第二個問題幾乎沒有參考資料,就在國外看到過一例出同樣問題的,現把解決方法放出來,供有同樣麻煩的朋友們參考:
第一個問題:
現像:打開虛擬機后無法連接,提試無法打開連接端口。
故障原因:WMWare7.x及以后的版本在添加Serial Port時默認為Serial Port2,即COM2端口,而習慣了用WMWare6.x的朋友們升級7.x時習慣了按舊有設置(COM1)來進行雙機調試,就會連接不上了。
解決方案:
1、在添加Serial Port時將虛擬機硬件配置中的打印機刪除,再創建SerialPort時就是SerialPort1了,其它不用改變,直接可以按原有方式進行雙調試的設置。
2、虛擬的硬件設置不變,在虛擬OS中添加調試引導項時(bcdedit里),把端口設為COM2,也是可行的。
以上兩個方案任選其一可解決。
第二個問題:
現像:在虛擬OS開機引導,加載完ClassPnp驅動后,實機中的WinDbg強制關閉(就是窗口突然沒了,進程也結束了)
故障原因:調試WinDbg時顯示故障是“調試目標初始化時出現問題,錯誤碼:0x8000FFFF”。(現在我也沒搞明白這是啥子故障)
解決方案:
這個故障是在引導過程中發生的,通過排除發現不加載網絡驅動則不會出現故障,所以解決方案也就很簡單了,在虛擬硬件設置中把網絡連接中的“開機連接”去掉,讓開機時不連接網絡。
進入虛擬OS后,如果需要使用網絡,再手動連接網絡,經測試開機后手動連接不會觸發故障出現。
第二個問題用笨方法解決了,但原理沒有搞清楚,應該是跟虛擬網絡有關,有明白原因的朋友還請告訴一下子,謝謝了。
(后注:用了幾天后發現第二個問題的解決方案並不穩定,時好時壞,最后不得不換裝Windows7家庭版解決,經測試VMWare里面裝Windows7 64位旗艦版時會出這個問題,裝家庭版未發現有同樣的問題。)
友情提示:
在設置雙機調試時,總是記不住bcdedit的命令,后來才知道用msconfig就可以直接在圖形界面設置了,同樣記憶力差的朋友可以嘗試一下子。