자격증과 세미나, 프로그램 이야기를 주저없이 써봅니다.

Since 2008. 10.

세미나 및 발표회/윈도우 프론티어 2기

전체 메모리 덤프 수집 3가지 방법

럭키맨 운수 2011. 4. 30. 12:13

이번 시간에는 BSOD(Blue Screen Of Death 블루스크린) 발생시 원인 파악을 위해 전체 메모리 덤프 수집하는 방법을 알아보겠습니다. 간단하게 시스템 속성에서 설정하는 방법과 LiveKd v5.0를 사용하여 전체 메모리 덤프 생성 방법, 레지스트리 편집기를 통한 메모리 덤프 생성 방법이 있습니다.

 

1. 시스템 속성 - 시작 및 복구에서 설정하기

 

윈도우 7에서는 바탕 화면에 있는 [컴퓨터] 오른쪽 버튼 클릭, 속성을 클릭하고 [고급 시스템]을 클릭합니다. 또는 윈도우 키 + Pause Break 단축키 사용하셔도 됩니다. 시스템 속성 대화상자가 보이면 시작 및 복구에 있는 설정을 클릭합니다.

 

 

시작 및 복구 창에서 디버깅 정보 쓰기가 커널 메모리 덤프로 되어 있는지 확인합니다. 기본적으로 덤프 파일은 %SystemRoot% 폴더(C:\Windows)에 MEMORY.DMP 파일로 저장됩니다. 이후 시스템 문제로 인해 블루스크린이 발생한 후 재부팅하면 위 폴더에 전체 메모리 덤프 파일이 생성되었음을 확인할 수 있습니다.

 

 

윈도우 XP을 사용하고 계시다면 마찬가지로 [시스템 등록 정보] - [시작 및 복구] 설정 - 디버깅 정보 쓰기 항목에서 전체 메모리 덤프로 설정한다음 확인 버튼을 클릭합니다.

 

 

2. LiveKd 프로그램을 사용한 전체 메모리 덤프 생성

 

시스템에 문제가 발생하여 원인 분석을 위해 전체 메모리 덤프를 수집해야 하는 상황입니다. 그런데 C 드라이브에 덤프를 받을 수 있는 여유공간이 충분하지 않으며 이미 커널 메모리 덤프로 설정되어 있다면 어떻게 해야할까요? LiveKD를 사용하면 원하는 드라이브에 전체 메모리 덤프를 내려받을 수 있습니다.

 

(1) 첨부파일에 있는 Debugging Tools for Windows 디버깅 툴 설치합니다.
(2) 첨부파일에 있는 LiveKD 다운로드 후 Debugging Tools for Windows 설치 폴더에 복사합니다. LiveKD v5.0은 2010년 10월 14일 릴리즈되었습니다.
(3) D 드라이브에 Symbols 폴더를 만듭니다. (Web에서 다운로드 받을 symbols이 저장될 폴더)
(4) LiveKD 프로그램 실행합니다.

 

C:\Program Files\Debugging Tools for Windows (x86)> livekd

LiveKd v5.0 - Execute kd/windbg on a live system
Sysinternals - www.sysinternals.com
Copyright (C) 2000-2010 Mark Russinovich


Symbols are not configured. Would you like LiveKd to set the _NT_SYMBOL_PATH
directory to reference the Microsoft symbol server so that symbols can be
obtained automatically? (y/n) y

Enter the folder to which symbols download (default is c:\symbols): d:\symbols
Launching C:\Program Files\Debugging Tools for Windows (x86)\kd.exe:

Microsoft (R) Windows Debugger Version 6.11.0001.404 X86
Copyright (c) Microsoft Corporation. All rights reserved.


Loading Dump File [C:\WINDOWS\livekd.dmp]
Kernel Complete Dump File: Full address space is available

Comment: 'LiveKD live system view'
Symbol search path is: srv*d:\symbols*http://msdl.microsoft.com/download/symbols

Executable search path is:

Windows Server 2003 Kernel Version 3790 (Service Pack 2) UP Free x86 compatible
Product: Server, suite: Enterprise TerminalServer SingleUserTS
Built by: 3790.srv03_sp2_gdr.070304-2240
Machine Name:
Kernel base = 0x80800000 PsLoadedModuleList = 0x8089ffa8
Debug session time: Sun Feb 13 11:34:57.897 17420 (GMT+9)
System Uptime: 0 days 0:17:36.739
WARNING: Process directory table base 3BA5A520 doesn't match CR3 3BA5A3C0
WARNING: Process directory table base 3BA5A520 doesn't match CR3 3BA5A3C0
Loading Kernel Symbols
...............................................................
...................................
Loading User Symbols
...........
Loading unloaded module list
...
*** ERROR: Module load completed but symbols could not be loaded for LiveKdD.SYS

*******************************************************************************
* Bugcheck Analysis *
*******************************************************************************

Use !analyze -v to get detailed debugging information.

BugCheck 0, {0, 0, 0, 0}

*************************************************************************
*** ***
*** ***
*** 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: kernel32!pNlsUserInfo ***
*** ***
*************************************************************************
Probably caused by : LiveKdD.SYS ( LiveKdD+12f1 )

Followup: MachineOwner
---------

kd> .dump /f /o d:\dump\memory.dmp
Please consider including the "/b" option to compress the dump file in a CAB. Di
sk space required could be cut by around 75%.
Creating d:\dump\memory.dmp - Full kernel dump
Percent written 0
Percent written 1
Percent written 2
Percent written 3
Percent written 4
Percent written 5
Percent written 6
Percent written 7
Percent written 8
Percent written 9
Percent written 10
Percent written 11
..........
Percent written 97
Percent written 98
Percent written 99
Dump successfully written


작업이 완료되면 전체 메모리 덤프가 D 드라이브에 생성되었음을 확인할 수 있습니다. WinDbg 설정 후 symbols 을 설정하고 생성된 덤프를 확인합니다. 재부팅을 하지 않고 덤프를 내려받을 수 있는 방법으로 장애 현상을 유지한 채 원인을 분석할 수 있는 방법이기도 합니다.

 

3. 레지스트리 편집기

 

(1) PS/2 방식의 키보드를 사용하는 경우

 

1) [시작]-[실행] 창에서 regedit 입력하고 엔터쳐서 레지스트리 편집기를 실행합니다.

2) 다음 레지스트리 경로로 이동합니다.

 

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\i8042prt\Parameters

 

3) 편집 메뉴에서 값 추가를 누르고 아래와 같은 레지스트리 항목을 추가합니다.

 

이름: CrashOnCtrlScroll
데이터 형식: REG_DWORD
값: 1

 

4) 레지스트리 편집기를 종료한 다음 컴퓨터를 재부팅합니다.

 

(2) USB 방식의 키보드를 사용하는 경우

 

1) [시작]-[실행] 창에서 regedit 입력하고 엔터쳐서 레지스트리 편집기를 실행합니다.

2) 다음 레지스트리 경로로 이동합니다.

 

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\kbdhid\Parameters

 

3) 다음 레지스트리 항목이 사용할 수 있도록 설정되어 있는지 확인하고 없으면 아래와 같은 레지스트리 항목을 추가합니다.

 

이름: CrashOnCtrlScroll
데이터 형식: REG_DWORD
값: 1

 

4) 레지스트리 편집기를 종료하고 USB 키보드를 사용하는 컴퓨터에서는 컴퓨터를 다시 시작할 필요가 없으며 키보드를 분리하고 다시 연결하면 됩니다.

 

 

사용방법은 장애가 발생한 시점에서, 오른쪽 Ctrl키를 누른 상태에서 Scroll Lock키를 차례로 두 번 눌러 MEMORY.DMP 파일을 생성할 수 있습니다. (스페이스바 키 오른쪽에 있는 Ctrl키를 사용해야 합니다.)

 

winsdk_web.exe
0.49MB
LiveKd.zip
0.22MB