Microsoft MVP성태의 닷넷 이야기
디버깅 기술: 86. windbg의 mscordacwks DLL 로드 문제 - 세 번째 이야기 [링크 복사], [링크+제목 복사]
조회: 12380
글쓴 사람
정성태 (techsharer at outlook.com)
홈페이지
첨부 파일
 
(연관된 글이 7개 있습니다.)

windbg의 mscordacwks DLL 로드 문제 - 세 번째 이야기

어쩌다 보니 시리즈 글로 쓰게 되었군요. ^^

Windbg - ERROR: Unable to load DLL mscordacwks_x86_x86_2.0.50727.4200.dll, Win32 error 0n2
; https://www.sysnet.pe.kr/2/0/994

windbg의 mscordacwks DLL 로드 문제
; https://www.sysnet.pe.kr/2/0/1181

windbg의 mscordacwks DLL 로드 문제 - 두 번째 이야기
; https://www.sysnet.pe.kr/2/0/1375

정리해 볼까요? ^^

.NET Framework을 대상으로 하는 응용 프로그램의 덤프 파일을 '다른 PC에 복사해서' 분석하려는 경우 반드시 그 응용 프로그램이 설치된 환경으로부터 다음의 2가지 파일도 함께 가져와야 합니다.

  • sos.dll
  • mscordacwks.dll

또한, 덤프 파일의 대상이었던 프로세스가 64비트/32비트, CLR 2/4인지에 따라 각각 다음의 폴더에 있는 것으로 가져와야만 합니다.

.NET 응용 프로그램이 CLR2 + x86인 경우 - C:\Windows\Microsoft.NET\Framework\v2.0.50727
.NET 응용 프로그램이 CLR2 + x64인 경우 - C:\Windows\Microsoft.NET\Framework64\v2.0.50727

.NET 응용 프로그램이 CLR4 + x86인 경우 - C:\Windows\Microsoft.NET\Framework\v4.0.30319
.NET 응용 프로그램이 CLR4 + x64인 경우 - C:\Windows\Microsoft.NET\Framework64\v4.0.30319

자, 그럼 대상이 되는 sos.dll과 mscordacwks.dll 파일을 "C:\temp" 폴더에 복사해 두었고 windbg에서 덤프 파일을 열었다고 가정해 보겠습니다. 그럼 sos.dll을 다음과 같이 로드할 수 있고,

0:000> .load c:\temp\sos.dll

(대개의 경우) 이 단계에서 sos 관련 명령을 내리면 이렇게 오류가 발생하게 됩니다.

0:000> !clrstack
CLRDLL: Consider using ".cordll -lp <path>" command to specify .NET runtime directory.
Failed to load data access DLL, 0x80004005
Verify that 1) you have a recent build of the debugger (6.2.14 or newer)
            2) the file mscordacwks.dll that matches your version of clr.dll is 
                in the version directory or on the symbol path
            3) or, if you are debugging a dump file, verify that the file 
                mscordacwks_<arch>_<arch>_<version>.dll is on your symbol path.
            4) you are debugging on supported cross platform architecture as 
                the dump file. For example, an ARM dump file must be debugged
                on an X86 or an ARM machine; an AMD64 dump file must be
                debugged on an AMD64 machine.

You can also run the debugger command .cordll to control the debugger's load of mscordacwks.dll.  .cordll -ve -u -l will do a verbose reload.
If that succeeds, the SOS command should work on retry.

If you are debugging a minidump, you need to make sure that your executable path is pointing to clr.dll as well.

오호~~~ 그런데 최근 sos.dll에서는 지난번의 경우와는 다른 메시지가 보입니다.

CLRDLL: Consider using ".cordll -lp " command to specify .NET runtime directory.

예전에는 mscordacwks.dll 로드 문제를 해결하기 위해 해당 sos.dll이 요구하는 버전을 알아내려고 "cordll -ve -u -l" 명령어를 수행, 그에 맞게 "mscordacwks_x86_x86_2.0.50727.4005.dll"과 같은 식으로 파일명을 변경한 후 PATH 환경 변수에 지정된 경로에 복사해야 하는 복잡함이 있었는데요.

이제는 그냥 다음과 같이 "-lp" 스위치와 함께 mscordacwks.dll 파일이 있는 경로를 알려주기만 하면 됩니다.

0:000> .cordll -lp c:\temp
CLR DLL status: Loaded DLL c:\temp\mscordacwks.dll

세상 참 좋아졌군요. ^^




[이 글에 대해서 여러분들과 의견을 공유하고 싶습니다. 틀리거나 미흡한 부분 또는 의문 사항이 있으시면 언제든 댓글 남겨주십시오.]

[연관 글]






[최초 등록일: ]
[최종 수정일: 6/1/2021]

Creative Commons License
이 저작물은 크리에이티브 커먼즈 코리아 저작자표시-비영리-변경금지 2.0 대한민국 라이센스에 따라 이용하실 수 있습니다.
by SeongTae Jeong, mailto:techsharer at outlook.com

비밀번호

댓글 작성자
 



2019-03-07 01시18분
.NET Core의 경우 self-contained 형식으로 배포되었다면 그 폴더에 함께 있는 sos.dll과 dac 구성요소(mscordaccore.dll)를 지정하면 됩니다. 예를 들어 c:\tempweb에 배포되었다면 이렇게!

.load c:\tempweb\sos.dll
.cordll -lp c:\tempweb
정성태

... 31  32  33  34  35  36  37  38  39  [40]  41  42  43  44  45  ...
NoWriterDateCnt.TitleFile(s)
12625정성태5/3/20219221오류 유형: 714. error CS5001: Program does not contain a static 'Main' method suitable for an entry point
12624정성태5/2/202112984.NET Framework: 1055. C# - struct/class가 스택/힙에 할당되는 사례 정리 [10]파일 다운로드1
12623정성태5/2/20219621.NET Framework: 1054. C# 9 최상위 문에 STAThread 사용 [1]파일 다운로드1
12622정성태5/2/20216417오류 유형: 713. XSD 파일을 포함한 프로젝트 - The type or namespace name 'TypedTableBase<>' does not exist in the namespace 'System.Data'
12621정성태5/1/202110028.NET Framework: 1053. C# - 특정 레지스트리 변경 시 알림을 받는 방법 [1]파일 다운로드1
12620정성태4/29/202111984.NET Framework: 1052. C# - 왜 구조체는 16 바이트의 크기가 적합한가? [1]파일 다운로드1
12619정성태4/28/202112482.NET Framework: 1051. C# - 구조체의 크기가 16바이트가 넘어가면 힙에 할당된다? [2]파일 다운로드1
12618정성태4/27/202111038사물인터넷: 58. NodeMCU v1 ESP8266 CP2102 Module을 이용한 WiFi UDP 통신 [1]파일 다운로드1
12617정성태4/26/20218724.NET Framework: 1050. C# - ETW EventListener의 Keywords별 EventId에 따른 필터링 방법파일 다운로드1
12616정성태4/26/20218707.NET Framework: 1049. C# - ETW EventListener를 상속받았을 때 초기화 순서파일 다운로드1
12615정성태4/26/20216883오류 유형: 712. Microsoft Live 로그인 - 계정을 선택하는(Pick an account) 화면에서 진행이 안 되는 문제
12614정성태4/24/20219549개발 환경 구성: 570. C# - Azure AD 인증을 지원하는 ASP.NET Core/5+ 웹 애플리케이션 예제 구성 [4]파일 다운로드1
12613정성태4/23/20218591.NET Framework: 1048. C# - ETW 이벤트의 Keywords에 속한 EventId 구하는 방법 (2) 관리 코드파일 다운로드1
12612정성태4/23/20218724.NET Framework: 1047. C# - ETW 이벤트의 Keywords에 속한 EventId 구하는 방법 (1) PInvoke파일 다운로드1
12611정성태4/22/20217989오류 유형: 711. 닷넷 EXE 실행 오류 - Mixed mode assembly is build against version 'v2.0.50727' of the runtime
12610정성태4/22/20217801.NET Framework: 1046. C# - 컴파일 시점에 참조할 수 없는 타입을 포함한 이벤트 핸들러를 Reflection을 이용해 구독하는 방법파일 다운로드1
12609정성태4/22/20219093.NET Framework: 1045. C# - 런타임 시점에 이벤트 핸들러를 만들어 Reflection을 이용해 구독하는 방법파일 다운로드1
12608정성태4/21/202110124.NET Framework: 1044. C# - Generic Host를 이용해 .NET 5로 리눅스 daemon 프로그램 만드는 방법 [9]파일 다운로드1
12607정성태4/21/20218643.NET Framework: 1043. C# - 실행 시점에 동적으로 Delegate 타입을 만드는 방법파일 다운로드1
12606정성태4/21/202112598.NET Framework: 1042. C# - enum 값을 int로 암시적(implicit) 형변환하는 방법? [2]파일 다운로드1
12605정성태4/18/20218616.NET Framework: 1041. C# - AssemblyID, ModuleID를 관리 코드에서 구하는 방법파일 다운로드1
12604정성태4/18/20217351VS.NET IDE: 163. 비주얼 스튜디오 속성 창의 "Build(빌드)" / "Configuration(구성)"에서의 "활성" 의미
12603정성태4/16/20218240VS.NET IDE: 162. 비주얼 스튜디오 - 상속받은 컨트롤이 디자인 창에서 지원되지 않는 문제
12602정성태4/16/20219436VS.NET IDE: 161. x64 DLL 프로젝트의 컨트롤이 Visual Studio의 Designer에서 보이지 않는 문제 [1]
12601정성태4/15/20218521.NET Framework: 1040. C# - REST API 대신 github 클라이언트 라이브러리를 통해 프로그래밍으로 접근
12600정성태4/15/20218725.NET Framework: 1039. C# - Kubeconfig의 token 설정 및 인증서 구성을 자동화하는 프로그램
... 31  32  33  34  35  36  37  38  39  [40]  41  42  43  44  45  ...