平々毎々(アーカイブ)

はてなダイアリーのアーカイブです。

System.Diagnostics.Debuggerがよくわからない

というより、Windowsのデバッガに関する知識がないのだけど。

これ、どう違うの?

こんなコードを書いて、cordbgを動かしてみた。面倒だから色分けしないけど。

C:\Test>cordbg
Microsoft (R) Common Language Runtime Test Debugger Shell Version 3.5.21022.8 (RTM.021022-0800)
Copyright (C) Microsoft Corporation. All rights reserved.

(cordbg) m LoggingMessage 0
  AppDomainLoads=0          AppDomain and Assembly load events are not displayed
  ClassLoads=0              Class load events are not displayed
  EnhancedDiag=0            Suppress display of diagnostic information
  ISAll=0                   All interceptors are skipped
  ISClinit=0                Class initializers are skipped
  ISExceptF=0               Exception filters are skipped
  ISInt=0                   User interceptors are skipped
  ISPolicy=0                Context policies are skipped
  ISSec=0                   Security interceptors are skipped
  JitOptimizations=0        JIT's will produce debuggable (non-optimized) code
  LoggingMessages=0         Managed log messages are suppressed
  ModuleLoads=0             Module load events are not displayed
  SeparateConsole=0         Debuggees share cordbg's console
  ShowArgs=0                Arguments will not be shown in stack trace
  ShowTypeArgs=0            Type arguments to generic methods will not be shown in stack trace
  ShowModules=0             Module names will not be shown in stack trace
  ShowStaticsOnPrint=0      Static fields are not included when displaying objects
  USAll=0                   Unmapped stop locations are skipped
  USEpi=0                   Epilogs are skipped, returning to calling method
  USPro=0                   Prologs are skipped

(cordbg) r Debuggee.exe
Process 1896/0x768 created.
Warning: couldn't load symbols for C:\Windows\assembly\GAC_32\mscorlib\2.0.0.0__b77a5c561934e089\mscorlib.dll
[thread 0x1364] Thread created.
Warning: couldn't load symbols for C:\Windows\assembly\GAC_MSIL\mscorlib.resources\2.0.0.0_ja_b77a5c561934e089\mscorlib.resources.dll
[001e] nop
(cordbg) g
Debugger.IsAttached
Debugger.IsLogging()
[0091] nop
(cordbg) g
program end.
[thread 0x6f0] Thread created.
Process exited.
(cordbg) ex

LoggingMessagesを0に設定したのでDebugger.Log()のメッセージは出力されていないのだけど、Debugger.IsLogging()はtrueを返しているようだ。わからん。

この本を読み返してみるか。

.NET&Windowsプログラマのためのデバッグテクニック徹底解説 (マイクロソフト公式解説書)

.NET&Windowsプログラマのためのデバッグテクニック徹底解説 (マイクロソフト公式解説書)

それとも、こっち?

Windowsデバッグの極意 ツールを使いこなして、バグハント!

Windowsデバッグの極意 ツールを使いこなして、バグハント!