Microsoft MVP성태의 닷넷 이야기
글쓴 사람
홍길동
홈페이지
첨부 파일
 

안녕하세요.
저는 QA입니다.

다름이 아니라, 프로그램 테스트 도중 갑자기 비정상종료 되었길래..
Windbg로 attack process 걸어서 증상 재현 후, Dump 파일을 생성하였습니다.

그리고 나서 DebugDiag로 먼저 덤프자동분석을 돌렸는데...

Report파일을 쭈욱 보다보니...

Previous .NET Exceptions Report (Exceptions in all .NET Heaps)

위 부분에서...

Stack Trace가 아래와 같이 나오더군요.

(Exception Type은 System.IndexOutOfRangeException 이고요.)

   EMapControlLib.EMapEditorView.TypingOnlyNumber(System.Object, System.Windows.Input.TextCompositionEventArgs, Boolean, Boolean)
   System.Windows.RoutedEventArgs.InvokeHandler(System.Delegate, System.Object)
   System.Windows.RoutedEventHandlerInfo.InvokeHandler(System.Object, System.Windows.RoutedEventArgs)
   System.Windows.EventRoute.InvokeHandlersImpl(System.Object, System.Windows.RoutedEventArgs, Boolean)
   System.Windows.UIElement.RaiseEventImpl(System.Windows.DependencyObject, System.Windows.RoutedEventArgs)
   System.Windows.UIElement.RaiseTrustedEvent(System.Windows.RoutedEventArgs)
   System.Windows.Input.InputManager.ProcessStagingArea()
   System.Windows.Input.InputManager.ProcessInput(System.Windows.Input.InputEventArgs)
   System.Windows.Documents.TextStore.RaiseCompositionEvents(Int32 ByRef, Int32 ByRef)
   System.Windows.Documents.TextStore.HandleCompositionEvents(Int32)
   System.Windows.Documents.TextStore.GrantLockWorker(LockFlags)
   System.Windows.Documents.TextStore.RequestLock(LockFlags, Int32 ByRef)


그리고 Call Stack은... 아래와 같이 나오고요.

.NET Call Stack

[[GCFrame]]
[[HelperMethodFrame_1OBJ] (System.Environment.FailFast)] System.Environment.FailFast(System.String)
PresentationFramework_ni!System.Windows.Documents.TextStore.VerifyTextStoreConsistency()+52
PresentationFramework_ni!System.Windows.Documents.TextStore.GrantLock()+54
PresentationFramework_ni!System.Windows.Documents.TextStore.GrantLockWorker(LockFlags)+12a
PresentationFramework_ni!System.Windows.Documents.TextStore.RequestLock(LockFlags, Int32 ByRef)+68
WindowsBase_ni!DomainBoundILStubClass.IL_STUB_COMtoCLR(Int32, IntPtr)+18
[[ComMethodFrame]]
WindowsBase_ni!DomainBoundILStubClass.IL_STUB_CLRtoCOM(TsLayoutCode, Int32)+b9
[[InlinedCallFrame] (MS.Win32.UnsafeNativeMethods+ITextStoreACPSink.OnLayoutChange)] MS.Win32.UnsafeNativeMethods+ITextStoreACPSink.OnLayoutChange(TsLayoutCode, Int32)
PresentationFramework_ni!System.Windows.Documents.TextStore.OnLayoutUpdated()+28
PresentationFramework_ni!System.Windows.Documents.TextEditor.OnTextViewUpdatedWorker(System.Object)+f7c2a4
WindowsBase_ni!System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate, System.Object, Int32)+68
WindowsBase_ni!System.Windows.Threading.ExceptionWrapper.TryCatchWhen(System.Object, System.Delegate, System.Object, Int32, System.Delegate)+36
WindowsBase_ni!System.Windows.Threading.DispatcherOperation.InvokeImpl()+10c
mscorlib_ni!System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)+172
mscorlib_ni!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)+15
mscorlib_ni!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object)+55
WindowsBase_ni!MS.Internal.CulturePreservingExecutionContext.Run(MS.Internal.CulturePreservingExecutionContext, System.Threading.ContextCallback, System.Object)+d8
WindowsBase_ni!System.Windows.Threading.DispatcherOperation.Invoke()+62
WindowsBase_ni!System.Windows.Threading.Dispatcher.ProcessQueue()+1fd
WindowsBase_ni!System.Windows.Threading.Dispatcher.WndProcHook(IntPtr, Int32, IntPtr, IntPtr, Boolean ByRef)+6f
WindowsBase_ni!MS.Win32.HwndWrapper.WndProc(IntPtr, Int32, IntPtr, IntPtr, Boolean ByRef)+c4
WindowsBase_ni!MS.Win32.HwndSubclass.DispatcherCallbackOperation(System.Object)+84
WindowsBase_ni!System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate, System.Object, Int32)+68
WindowsBase_ni!System.Windows.Threading.ExceptionWrapper.TryCatchWhen(System.Object, System.Delegate, System.Object, Int32, System.Delegate)+36
WindowsBase_ni!System.Windows.Threading.Dispatcher.LegacyInvokeImpl(System.Windows.Threading.DispatcherPriority, System.TimeSpan, System.Delegate, System.Object, Int32)+172
WindowsBase_ni!MS.Win32.HwndSubclass.SubclassWndProc(IntPtr, Int32, IntPtr, IntPtr)+152
WindowsBase_ni!DomainBoundILStubClass.IL_STUB_ReversePInvoke(Int64, Int32, Int64, Int64)+52
WindowsBase_ni!DomainBoundILStubClass.IL_STUB_PInvoke(System.Windows.Interop.MSG ByRef)+79
[[InlinedCallFrame] (MS.Win32.UnsafeNativeMethods.DispatchMessage)] MS.Win32.UnsafeNativeMethods.DispatchMessage(System.Windows.Interop.MSGByRef)
WindowsBase_ni!System.Windows.Threading.Dispatcher.PushFrameImpl(System.Windows.Threading.DispatcherFrame)+f5
PresentationFramework_ni!System.Windows.Application.RunDispatcher(System.Object)+71
PresentationFramework_ni!System.Windows.Application.RunInternal(System.Windows.Window)+8c



하지만 Stack Trace로는 소스라인이 나오지 않아...

Windbg로 .load sos clr 을 이용해서...

봤는데... kb 커맨드를 이용해서 스택을 봤는데..

Debug Diag의 call stack와 같이 나올뿐..

stack trace는 어떻게 보는지 알 수가 없더라고요.

만약 windbg에서 DebugDiag와 같이 Stack Trace를 볼 수 있다면...

EMapControlLib.EMapEditorView.TypingOnlyNumber(System.Object, System.Windows.Input.TextCompositionEventArgs, Boolean, Boolean)

위 부분에 대한 소스라인까지 볼 수 있는 방법이 따로 있는지요?








[최초 등록일: ]
[최종 수정일: 8/19/2019]


비밀번호

댓글 작성자
 



2019-08-19 10시09분
소스 코드 라인 정보까지 보려면 PDB 심볼 파일이 있어야 합니다. 있는데도 그렇게 나온다면, lm 명령어로 해당 심볼이 정상적으로 로딩되었는지 확인해 보세요.

그런데, 해당 콜스택 정보라면 현재 실행 중인 메서드의 기계어 코드를 대략 유추해 보면 소스 코드와 비교했을 때 어느 라인에서 발생했는지 (상황에 따라 매우 쉽게) 알 수 있습니다.
정성태
2019-08-20 08시43분
[홍길동] 아, 제가 궁금했던건..

DebugDiag에서 Previous .NET Exceptions Report (Exceptions in all .NET Heaps) 이 부분에 대한 Stack Trace가 나오는데..
Windbg에서는 콜스택만 나와서 드렸던거였습니다.
그래서 Windbg에서는 DebugDiag의 Previous .NET Exceptions Report (Exceptions in all .NET Heaps) Stack Trace를 어떻게 보는지를 여쭤본거였습니다.
(심볼은 정상적으로 로딩된 상태입니다)
[guest]
2019-08-20 10시11분
debugdiag의 기능이 꼭 windbg의 기능과, 정확히는 sos 확장 dll의 기능과 정확히 일치하지는 않습니다. 사실 구현해주기 나름인 차이가 있는 건데요. 만약 windbg에서 debugdiag의 그런 기능을 구현하고 싶다면 현재 sos.dll에서 제공하는 명령어들의,

https://docs.microsoft.com/en-us/dotnet/framework/tools/sos-dll-sos-debugging-extension

출력을 스크립트로 잘 조합해,

windbg에서 python 스크립트 실행하는 방법 - pykd
https://www.sysnet.pe.kr/2/0/11227

얻는 방법이 있습니다. 아니면, 누군가 해당 스크립트를 만들었을 수도 있으니 그걸 검색하거나... 아니면 어차피 dmp 파일을 분석하는 것이므로 다음의 라이브러리를 이용해,

ClrMD를 이용해 메모리 덤프 파일로부터 특정 인스턴스를 참조하고 있는 소유자 확인
; http://www.sysnet.pe.kr/2/0/11809

직접 C# 코드를 이용해 구할 수도 있습니다.
정성태

... 16  17  18  19  20  21  22  23  [24]  25  26  27  28  29  30  ...
NoWriterDateCnt.TitleFile(s)
53154/6/20206720dll파일 로드 원리? 부분에서 도움받고싶습니다. [3]
5314강성욱3/31/20208655메서드 내에서 await 2번 등장할 때의 이해 [11]파일 다운로드1
5313강성욱3/27/20206466await 2번 [1]
53121a2a...3/20/20206221Re raw data write 질문 관련 [1]파일 다운로드1
53111a2a...3/20/20207046Raw data write 관련 질문 [1]파일 다운로드1
5310아스파넬3/15/202071311초에 5회 함수호출 제한 관련 질문입니다. [1]
5309하태3/11/20208980안녕하십니까. c# Winform UI 질문드리겠습니다! [3]파일 다운로드1
5308질문3/9/20207813Window XP SP3 32bit 환경(Window Update 모두 완료)에서 .Net Framework 4.0.3 으로 빌드된 .dll 파일 gacutil.exe 등록 관련 문의 [5]
5306개발자3/9/20206641C#을 통해 인터넷 접속 가능한 이더넷을 선택할 수 있는지요? [1]
5305JaeS...3/9/20206348RAW파일 생성 질문드립니다 [8]파일 다운로드1
5303궁금하당2/27/20208654C#에서 C++ DLL읽기 (아래 글쓴이) [1]
5302궁금하당2/27/202010755C#에서 C++ DLL호출 ('PInvokeStackImbalance') [4]파일 다운로드1
5301질문합니...2/27/20206189소켓 대량 데이터 디자인 문의 [1]
5300nals...2/27/20206849vs2013에서 BinaryFormatter Serialize 후 vs2015에서 Deserialize시 예외 발생 [3]파일 다운로드1
5298질문2/26/20208215.lic 파일에 대해 질문 있습니다. [9]
5297임한승2/26/20205777vs2013에서 BinaryFormatter Serialize 후 vs2015에서 Deserialize시 예외 발생 건 [1]파일 다운로드1
5295나그네2/25/20207152클라이언트 PC 정보 조회관련.. [2]
5294닷넷초보ㅠ2/25/20207075윈폼으로 socket통신프로그램 만든후 release로 디버깅한 실행파일을 다른컴퓨터에서 실행할때 반응이없어요 [1]
5293탱코2/21/20207006검색을 하고 싶은데 어떻게 검색을 해야 할 지 모르겠습니다. [1]
5292아부리2/19/20206936XingApiNet 관련 질문 [3]
5291지현명2/15/20207641JsonConvert.Serialize 하고 Deserialize 할때 간헐적으로 한글 깨짐 현상 문의 합니다. [3]
5290베도빈2/15/20206999직접 제작한 사용자 정의 콘트롤 DLL, 실행파일에 포함시켜 배포할 수 있을까요? [1]
5288김성배2/14/20207387c# 참조추가 기능에서 DirectX 참조가 보이지 않아요.. DircetX 11 은 설치 되어 있습니다. [1]
5287C# 초...2/14/20206374프로그램 실행 질문 드립니다. [4]파일 다운로드1
5286gongs2/3/202013697윈도우 배율 및 레이아웃에 대한 질문입니다. [3]
5285강성욱1/27/20207491작업관리자에 표시되는 스레드 개수와 프로그램 내 스레드 개수 일치 [1]
... 16  17  18  19  20  21  22  23  [24]  25  26  27  28  29  30  ...