[Windbg 第6回] 取得したダンプをWindbgで開く
今回は取得したダンプを調査する前段階について書こうと思います。
取得したダンプを開く方法としてはWindbgで開く方法とkanalyzeで開く方法が
あります。今回は、Windbgで開く方法について書きます。
ダンプを開く手順とは?
ダンプを開くストーリーとしては、1.システム環境変数の設定 2.Windbgの起動
3.ダンプを選択して開く 4.コマンド実行 5.プログラムの終了といったながれです。
それでは、順番通り進んでみましょう。
1.システム環境変数の設定
環境変数は、 _NT_SYMBOL_PATH という変数名に対して
変数値 SRV*C:\WINDOWS\Symbols(2003sp2x86)*http://msdl.microsoft.com/download/symbols
を設定します。C:\WINDOWS\Symbols(2003sp2x86)というのは
先ほどインストールしたシンボルファイルのパスです。このパスには
シンボルファイルのキャッシュも保存されます。
ダンプを取得したOSの種類、サービスパックや32bit 64bitの違いがあるので
シンボルの指定には注意をしてください。
シンボルファイルの指定を失敗してしまうと以下のエラーが出てしまいダンプファイルをうまく読むことができません。
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+ * ********************************************************************* ----------------------------------一部省略--------------------------------- ************************************************************************* *** *** *** *** *** Your debugger is not using the correct symbols *** *** *** *** In order for this command to work properly, your symbol path *** *** must point to .pdb files that have full type information. *** *** *** *** Certain .pdb files (such as the public OS symbols) do not *** *** contain the required information. Contact the group that *** *** provided you with these symbols if you need this command to *** *** work. *** *** *** *** Type referenced: nt!PVOID *** *** *** *************************************************************************
http://msdl.microsoft.com/download/symbols という部分はマイクロソフトさんのシンボルサーバのパスです。
設定方法は以下通りです。
1.マイコンピュータのプロパティへ
2.システムのプロパティで詳細設定タブの環境変数(N)へ
3.システム環境変数中の新規ボタン(W)をクリック
4.システム変数を以下のように設定する
設定例)変数名
_NT_SYMBOL_PATH
設定例)変数値
SRV*C:\WINDOWS\Symbols(2003sp2x86)*http://msdl.microsoft.com/download/symbols
5.値を入力したらOKボタンをクリックして設定を完了します
設定後は、ログアウト・ログイン又は、OS再起動をお忘れなく。
2.Windbgの起動
Windbgは以下の通り起動させます。
1.スタートメニュから、すべてのプログラム、Debugging Tools for Windows、Windbgを選択します
2.Windbgが起動します
3.ダンプを選択して開く
1.FileメニューからOpen Crash Dumpを選択します
2.ダンプファイルが入っているディレクトリに移動してファイルを開きます
3.ダンプファイルを開くとファイルの読み込みが開始します
4.ファイルを読み込んでいる最中にワークスペースの作成の可否を質問されるのでNOを選択します
ワークスペースを作成してしまうと、ワークスペースファイルからダンプを開く必要が出てくるので、私はNOを選択して利用しています。
5.ファイルの読み込みが完了すると1: kd>と表示されますのでしばらくお待ちを
4.コマンド実行
ダンプの読み込みを終えるとコマンドを実行して障害発生時の状態を解析していきます。
まずは、プロンプトに !analyze -v と入力してみましょう。
するとこんな感じで実行結果が返ってきます。
1: kd> !analyze -v ******************************************************************************* * * * Bugcheck Analysis * * * ******************************************************************************* IRQL_NOT_LESS_OR_EQUAL (a) ←←この部分にバグのケースが表示されています(WebでこのケースIDを調べると情報が出てきます) An attempt was made to access a pageable (or completely invalid) address at an interrupt request level (IRQL) that is too high. This is usually caused by drivers using improper addresses. If a kernel debugger is available get the stack backtrace. Arguments: Arg1: 00000066, memory referenced Arg2: d000001b, IRQL Arg3: 00000000, bitfield : bit 0 : value 0 = read operation, 1 = write operation bit 3 : value 0 = not an execute operation, 1 = execute operation (only on chips which support this level of status) Arg4: 8083d52a, address which referenced memory Debugging Details: ------------------ Page cb1c1 not present in the dump file. Type ".hh dbgerr004" for details Page c689f not present in the dump file. Type ".hh dbgerr004" for details WARNING: Process directory table base 00C8F000 doesn't match CR3 5216F000 Unable to get PEB pointer WARNING: Process directory table base 00C8F000 doesn't match CR3 5216F000 Unable to get PEB pointer READ_ADDRESS: 00000066 CURRENT_IRQL: 1b FAULTING_IP: nt!KiReadyThread+3 8083d52a 80786600 cmp byte ptr [eax+66h],0 DEFAULT_BUCKET_ID: CODE_CORRUPTION ←←DEFAULT_BUCKET_IDに表示される内容で何に問題が発生しているかヒントを得ます。DRIVER_FAULTはドライバの不具合等… BUGCHECK_STR: 0xA TRAP_FRAME: ba3a1984 -- (.trap 0xffffffffba3a1984) ErrCode = 00000000 eax=00000000 ebx=88dc5dd8 ecx=88dcf1e0 edx=885c5c48 esi=88dcf200 edi=88dcf1c0 eip=8083d52a esp=ba3a19f8 ebp=ba3a1a08 iopl=0 nv up ei pl nz na po nc cs=0008 ss=0010 ds=0023 es=0023 fs=0030 gs=0000 efl=00010202 nt!KiReadyThread+0x3: 8083d52a 80786600 cmp byte ptr [eax+66h],0 ds:0023:00000066=?? Resetting default scope LAST_CONTROL_TRANSFER: from 8083d52a to 80836de5 STACK_TEXT: ←←STACK_TEXTはOSがSTOPエラーを起こす直前のスタックを16進で表記しています。 ba3a1984 8083d52a badb0d00 885c5c48 00000000 nt!KiTrap0E+0x2a7 ba3a19f4 8085adf8 88dcf1c0 88dc5db0 00000000 nt!KiReadyThread+0x3 ba3a1a08 8084db2a 88dc5db0 88dcf1c0 ba3a1a28 nt!KiAttachProcess+0x7b ba3a1a34 b9a43b4c 88dcf1c0 ba3a1a60 ba3a1a98 nt!KeStackAttachProcess+0x97 WARNING: Stack unwind information not available. Following frames may be wrong. ba3a1bfc baed000e 00000d28 000006bc 00000000 SysPlant+0x4b4c ba3a1c40 809676e8 00000d28 000006bc 00000000 ggse+0x2200e ba3a1c64 8090e4d5 00000001 00000008 888427d8 nt!PspExitProcess+0x5e ba3a1cf0 8090e6ff 00000080 ba3a1d4c 80840b81 nt!PspExitThread+0x528 ba3a1cfc 80840b81 888427d8 ba3a1d48 ba3a1d3c nt!PsExitSpecialApc+0x1d ba3a1d4c 80833e1a 00000001 00000000 ba3a1d64 nt!KiDeliverApc+0x1ae ba3a1d4c 7c998768 00000001 00000000 ba3a1d64 nt!KiServiceExit2+0x37 0007fd14 00000000 00000000 00000000 00000000 0x7c998768 STACK_COMMAND: kb CHKIMG_EXTENSION: !chkimg -lo 50 -d !nt 808192e2-808192e5 4 bytes - nt!MiCleanSection+90f [ dd d6 00 00:0a d2 6a 3a ] 80826b06-80826b09 4 bytes - nt!MiCheckControlArea+13a (+0xd824) [ b9 fe ff ff:e6 f9 69 3a ] ----------------------------------一部省略--------------------------------- [ f9 44 fa ff:26 40 64 3a ] 8090e508-8090e50b 4 bytes - nt!PspExitThread+55f [ 4d 05 00 00:a4 e4 5a 3a ] 809677f0-809677f3 4 bytes - nt!PspProcessDelete+147 (+0x592e8) [ 65 72 fa ff:bc 51 55 3a ] 809a3c79-809a3c7d 5 bytes - nt!PsSetCreateProcessNotifyRoutine (+0x3c489) [ 8b ff 55 8b ec:e9 e2 c3 52 3a ] 152 errors : !nt (808192e2-809a3c7d) MODULE_NAME: memory_corruption IMAGE_NAME: memory_corruption FOLLOWUP_NAME: memory_corruption DEBUG_FLR_IMAGE_TIMESTAMP: 0 MEMORY_CORRUPTOR: LARGE FAILURE_BUCKET_ID: MEMORY_CORRUPTION_LARGE BUCKET_ID: MEMORY_CORRUPTION_LARGE Followup: memory_corruption</pre> ---------
☆ほかのコマンドや調査については次回以降でお話します。
5.プログラムの終了
コマンドを実行したり、調査を終えたら×ボタンを押してプログラムを
終了します。ワークスペースの作成についても再度聞かれるのでNOを
選択して終了します。













