本文主要記錄個人安裝VMware+Windgb+Win7內核驅動調試的筆記。
一、安裝環境
- 主機:Windows Vista Bussiness
- 虛擬機:VMware 7
- GUestOS: Win7
- Windbg: 6.11
二、虛擬機配置
打開相應 vmware 虛擬機上的 “Virtaul Machine Settings“
2.“Hardware ”選項中 —-> 點擊“Add” 添加一個串口設備 SeriallPort .
3.”Next”,在 “Serial Port” 裏選中 “Output to named pipe”
4.”next”,然後如下設置:
5.確定之後,回到如下界面,在右腳”Virtual Machine Settings” 頁面時,在“I/O Mode” 裏選中“Yield CPU on poll“
6. 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設置
Vista和XP不同, 沒有boot.ini文件, 需要用bcdedit進行啓動設置。
1. 在administrator權限下, 進入command line模式, 鍵入bcdedit命令, 會出現以下界面:
2. 然後, 設置端口COM1, baudrate爲115200 (除COM1外, 也可以用1394或USB.
1394用起來比COM口快多了, 當然前提是你需要有1394卡及其驅動. 很噁心的是Vista不再支持1394的文件傳輸協議,
但是用windbg雙機調試還是可以的)
命令爲:
bcdedit /dbgsettings {serial [baudrate:value][debugport:value] |
1394 [channel:value] | usb }
3.接着, 我們需要複製一個開機選項, 以進入OS的debug模式
命令爲:
bcdedit /copy {current} /d DebugEnty
DebugPoint 爲選項名稱, 名字可以自己定義. 然後複製得到的ID號.
4. 接着增加一個新的選項到引導菜單
bcdedit /displayorder {current} {ID}
這裏的{ID}的ID值是剛 生成的ID值.
5. 激活DEBUG :
bcdedit /debug {ID} ON
這裏的{ID} 的ID值還是剛纔的ID值.
6. 命令執行成功後, 重新啓動機器.或者更簡單的圖形界面設置:在msconfig界面中,選Boot,再選Advanced options,在選擇Debug、Debug port、Baud rate都打上鉤。如果所示:
7. 選擇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)
*******************************************************************************
*