VMware+Windgb+Win7核心驅動調試

來源:互聯網
上載者:User

本文主要記錄個人安裝VMware+Windgb+Win7核心驅動調試的筆記。

一、安裝環境

  1. 主機:Windows Vista Bussiness
  2. 虛擬機器:VMware 7
  3. GUestOS: Win7
  4. Windbg: 6.11

二、虛擬機器設定

  1. 開啟相應 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.可以看到類似如下的資訊:Xml代碼  
    1. Microsoft (R) Windows Debugger Version 6.11.0001.404 X86  
    2. Copyright (c) Microsoft Corporation. All rights reserved.  
    3.   
    4. Opened \\.\pipe\com_1  
    5. Waiting to reconnect...  
    6. Connected to Windows 7 7600 x86 compatible target at (Thu Dec 10 17:46:36.928 2009 (GMT+8)), ptr64 FALSE  
    7. Kernel Debugger connection established.  (Initial Breakpoint requested)  
    8. Symbol search path is: *** Invalid ***  
    9. ****************************************************************************  
    10. * Symbol loading may be unreliable without a symbol search path.           *  
    11. * Use .symfix to have the debugger choose a symbol path.                   *  
    12. * After setting your symbol path, use .reload to refresh symbol locations. *  
    13. ****************************************************************************  
    14. Executable search path is:   
    15. *********************************************************************  
    16. * Symbols can not be loaded because symbol path is not initialized. *  
    17. *                                                                   *  
    18. * The Symbol Path can be set by:                                    *  
    19. *   using the _NT_SYMBOL_PATH environment variable.                 *  
    20. *   using the -y <symbol_path> argument when starting the debugger. *  
    21. *   using .sympath and .sympath+                                    *  
    22. *********************************************************************  
    23. *** ERROR: Symbol file could not be found.  Defaulted to export symbols for ntkrpamp.exe -   
    24. Windows 7 Kernel Version 7600 MP (1 procs) Free x86 compatible  
    25. Product: WinNt, suite: TerminalServer SingleUserTS  
    26. Built by: 7600.16385.x86fre.win7_rtm.090713-1255  
    27. Machine Name:  
    28. Kernel base = 0x83e0f000 PsLoadedModuleList = 0x83f57810  
    29. Debug session time: Thu Dec 10 17:46:32.658 2009 (GMT+8)  
    30. System Uptime: 0 days 0:06:18.429  
    31. Break instruction exception - code 80000003 (first chance)  
    32. *******************************************************************************  
    33. *                                                                             *  
    34. *   You are seeing this message because you pressed either                    *  
    35. *       CTRL+C (if you run kd.exe) or,                                        *  
    36. *       CTRL+BREAK (if you run WinDBG),                                       *  
    37. *   on your debugger machine's keyboard.                                      *  
    38. *                                                                             *  
    39. *                   THIS IS NOT A BUG OR A SYSTEM CRASH                       *  
    40. *                                                                             *  
    41. * If you did not intend to break into the debugger, press the "g" key, then   *  
    42. * press the "Enter" key now.  This message might immediately reappear.  If it *  
    43. * does, press "g" and "Enter" again.                                          *  
    44. *                                                                             *  
    45. *******************************************************************************  
    46. nt!DbgBreakPointWithStatus+0x4:  
    47. 83e7a394 cc              int     3  

     

 

五、操作方式提示

我發現,如果在GuestOs -win7啟動過程中,如果開啟了windbg之後,整個系統就像死機,不動了。估計是windbg啟動後設定了斷點做調試,試試按F5,或者go這樣就可以恢複原來的狀態。

原文地址:http://yexin218.iteye.com/blog/545187

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.