2015年2月2日 星期一

WinDbg 使用及設定.

Server host setting:

1.  啟動 Debug 模式

Win XP OS
    更改 boot 選項,增加debug item.
    [boot loader] timeout=30
    default=multi(0)disk(0)rdisk(0)partition(1)\WINDOWS
    [operating systems]
    multi(0)disk(0)rdisk(0)partition(1)\WINDOWS="Microsoft Windows XP Professional" 
    /fastdetect /debugport=COM1 /baudrate=115200

Win7 OS
    command line -> " msconfig " -> 開機 -> 進階選項 -> 設定 debug port and rate



2. 安裝debug tools -> (dbg_x86_6.9.3.113.msi or new)



Target host setting.

win7 之後會將kernel message mask,需要手動將 message 打開,XP 則不用。

1.到control panel -> Administrative Tools -> System Configuration -> Boot -> Advanced
   options勾選  Debug,設定debug port. (可以直接打 cmd-> msconfig 呼叫)

2.command line -> "regedit"

3.在 regedit 下面的path Create "Debug Print Filter"
    path = [HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Control/Session  
    Manager/Debug Print Filter]
4.在 Debug Print Filter 新建一個 DWORD(32 bit) 名稱 為 Default
5.將新建的default reg 設定值為0x0F,重開機就可以顯示message.

WinDBG 使用
將 WinDbg開啟後,點選 tool 設定路徑
a.file->symble file path -> 指向source code 中 complier 後的object中的XXX.pdb檔.
    針對Windows 本身的driver 可以增加下面的PATH對應相對的symbols.
    SRV*c:\websymbols*http://msdl.microsoft.com/download/symbols
b.file->source file path ->指向driver source code
c.file->image  file path ->指向source code中 complier 後的object.

Run:
1.執行 kernel debug
2.在command line 確定link 後,執行 ".reload XXX.sys" 重新load driver。
  等待load driver 完畢,使用stop ,然後自行在需要中斷點,
  增加stop break(小手圖案),設定好斷點在按F5繼續run。
3.完成WinDbg設定並啟用。
 
*******************************************************************************
 Debug in network

in cmd line: (run admin)
  1. bcdedit /debug on
  2. bcdedit /dbgsettings net hostip:10.10.8.80 port:50000
 --> 會得到一組特定KEY , 建架Debug mode host server使用這組KEY連結
 --> 其中HostIP 只的就是SERVER 段IP.
  3. bcdedit /dbgsettings 可以看到相關設定

EX.
Microsoft Windows [Version 10.0.17763.379]
(c) 2018 Microsoft Corporation. All rights reserved.

C:\WINDOWS\system32>bcdedit /debug on
The operation completed successfully.

C:\WINDOWS\system32>bcdedit /dbgsettings net hostip:10.10.8.80 port:50000
Key=2uoaqjd75xbz1.e073obw4lg7z.4loqp4ddcxjr.14a6f1b12xzmb

C:\WINDOWS\system32>bcdedit /dbgsettings
key                     2uoaqjd75xbz1.e073obw4lg7z.4loqp4ddcxjr.14a6f1b12xzmb
debugtype               NET
hostip                  10.10.8.80
port                    50000
dhcp                    Yes
The operation completed successfully.

C:\WINDOWS\system32>


 
 

沒有留言:

張貼留言