1. 準備 Host (Windbg 監控) 與 Device (Driver 運行)兩台電腦

    並用 RS232 / 1394 / USB 連接起來


2. 在Host 電腦上 安裝最新的Windbg 軟體  及 Symbols(有分OS版本)

    (可在Microsoft 網站上下載:http://www.microsoft.com/whdc/devtools/debugging   /default.mspx)


3. 設定 Device 端連線設定:

    I. XP

     修改 boot.ini(隱藏檔) 在  C:\

       Example:
multi(0)disk(0)rdisk(0)partition(1)\WINNT="Microsoft Windows XP" /fastdetect
multi(0)disk(0)rdisk(0)partition(1)\WINNT=Debug 1394" /fastdetect /debug /debugport=1394 /channel=44 
multi(0)disk(0)rdisk(0)partition(1)\WINNT=Debug COM1" /fastdetect /debug /debugport=COM1 /baudrate=57600   
    II. Vista
    在 "執行"->"cmd"  中, 使用bcdedit 去修改設定.
     可參考http://www.microsoft.com/taiwan/whdc/driver/tips/debug_vista.mspx
   
     Example:
     (1) 設置端口
     COM1
     bcdedit /dbgsettings serial  baudrate:115200  debugport:1
     or 1394
       bcdedit /dbgsettings 1394 channel:44
     or USB
      bcdedit /dbgsettings usb
    
     (2) 複製開機選項   

     bcdedit /copy {current} /d DebugEntry

     DebugEntry為選項名稱, 可以自行命名

     (3) 增加新的選項到引導菜單
     
      bcdedit /displayorder {current} {ID}
      {ID}的GUID值是(2)的GUID值.

     (4) 激活DEBUG

      bcdedit /debug {ID} ON

     {ID}的GUID值是(2)的GUID值.

     命令執行成功後,重新啟動.     選擇DebugEntry 登錄,開啟Windbg
     (5)Vista register setting
       在
   HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Debug Print Filter
    下增加DWORD类型的”DEFAULT”子键,值为0xf


     
4. 設定 Symbol File path 和 Source File path

   在 Windbg 軟體的  Tool bar->"File"->"Symbol File path" 填上     

n    SRV*C:\WINDOWS\Symbols*http://msdl.microsoft.com/download/symbols
 

   C:\WINDOWS\Symbols  是安裝Windows symbol的folder

   在 Tool bar->"File"->"Source File path" 填上欲debug的source code 路徑
5. 分析
     可利用 !analyze -v 指令來分析

     或是設置break point去trace code



  


arrow
arrow
    全站熱搜

    skyuxxx 發表在 痞客邦 留言(0) 人氣()