Archivieren

Posts Tagged 'WinDBG "

Silverlight Debugging mit WinDbg und SOS

19. Dezember 2008 Keine Kommentare

Einführung

In früheren Post Silverlight Debuggen mit Visual Studio , demonstrierte ich, dass Visual Studio eine leistungsstarke und die bequemste Tool zum Debuggen von verwalteten Anwendungen ist. Aber für einige erweiterte Debugging-Szenarien, wie Speicherlecks, Deadlock, runaway Prozess / Thread, Kernel-Debugging und erweiterte Remote / crash / UI-Debugging etc, WinDbg (oder cdb, ntsd, kd) ist in der Regel bevorzugt, wenn nicht die einzige Option.

Debugging Tools für Windows

Überblick

WinDbg ist Teil der Debugging Tools für Windows -Paket:

image_thumb5

Auch wenn WinDbg ist ein GUI-Programm, ist es meist als Befehlszeilen-Debugger wie (und oft mit) kd, cdb und ntsd verwendet, und teilen die gleichen Debug Engine und Befehle. Es ist super leistungsfähige und erweiterbare, besonders gut für System-/ Low-Level-Debugging, wie Treiber und andere Komponenten des Betriebssystems geeignet. Es erfordert gute Kenntnisse der Hardware, Betriebssystem und Compiler an, die meisten aus dem Toolset erhalten. Es ist eine große (oder perfekt, würde ich sagen :-) für native Debugging, mit seinem umfangreichen und erweiterbaren Befehle und grafische Benutzeroberfläche. Managed Debugging-Unterstützung erfolgt über SOS Debug-Erweiterung ist nicht annähernd so gut wie native Debugging, aber es gibt einen enormen Wert in der Lage, integrierte Debugging über verwaltete und systemeigene Grenze, und für Silverlight zu tun, ist es das einzige Tool, das ich bin mir bewusst, daß laden kann SOS und tun integrierte Debugging.

Befehle

WinDbg / cdb / ntsd / kd gibt es schon seit langem, sie sind also sehr gut dokumentiert. Es wird dringend empfohlen, dass Sie über Debugging Tools for Windows weiter lesen microsoft.com und MSDN . Hier habe ich nur einen kurzen Überblick über die Befehle, um Ihnen ein Gefühl und schnelle Hilfe. Alle Befehle mit Laufzeit Hilfe zu kommen (via |?. Hilfe | help [<cmd>] wie unten beschrieben), so eine Übersicht ist in der Regel genug, um Ihre gestartet.

WinDbg hat drei Gruppen von Befehlen:

Standard Commands

Vor allem:

  • B * Befehle setzen / löschen / list / Aktivieren / Deaktivieren von Haltepunkten auf Adresse oder den Zugang
  • D * Befehle an Speicher (Stack / Heap, lokal / global Variablen und Parameter) zu untersuchen, E * Befehl zu modifizieren Speicher und S *, um Speicher zu suchen
  • K * Befehle Aufrufliste untersuchen
  • P, T, G * Befehle für Ablaufsteuerung

unten? Befehlsausgabe ist eine tolle Übersicht und häufige Hinweis für Leute mit WinDbg / cdb / ntsd / kd:

0:006>?

Öffnen Debugger.chm für komplette Debugger Dokumentation

B [C | D | E] [<bps>] - klar / deaktivieren / aktivieren Haltepunkt (s)
BL - Liste Haltepunkte
BA <access> <Größe> <addr> - set-Prozessor Haltepunkt
BP <Adresse> - set soft Haltepunkt
D [Typ] [<range>] - dump-Speicher
DT [-n | y] [[mod] name!] [[-N | y] Felder]
[Adresse] [-l list] [-a [] | c | i | o | r [#] | v] - dump mit Typinformationen
DV [<name>] - dump lokalen Variablen
E [type] <Adresse> [<values>] - geben Sie Speicher-Werte
G [H | N] [= <address> [<Adresse> ...]] - go
K <count> - Stacktrace
KP <count> - Stacktrace mit Quell-Argumente
LM [k | l | u | v] - list-Module
LN <expr> - list nächsten Symbole
P [= <addr>] [<Wert>] - Schritt über
Q - quit
R [[<reg> [= <expr>]]] - anzeigen oder festlegen Register
S [<opts>] <range> <values> - search-Speicher
SX [{e | d | i | n} [-c "CMD1"] [-c2 "cmd2"] [-h] {Exception | Event | *}] - Event-Filter
T [= <address>] [<expr>] - Spur in
U [<range>] - unassemble
Version - zeigen Debuggee und Debugger-Version
X [<* | Modul >!]<*| Symbol> - view Symbole
? <expr> - Anzeige Ausdruck
? <expr> - Anzeige C + +-Ausdruck
$ <<Dateiname> - Nehmen Sie Eingaben in einer Datei

Drücken Sie Enter ...

<expr> unäre ops: + - nicht von wo dwo qwo poi hallo niedrig
Binär-ops: + - * / mod (%) und (&) xor (^) oder (|)
Vergleiche: == (=) <> =
Operanden: Zahl in der aktuellen radix, öffentliches Symbol, <reg>
<type>: B (Byte), w (Wort), d [s] (Doppelwort [mit Symbolen]),
A (ASCII), c (dword und Char), u (Unicode), l (list)
f (float), D (double), s | S (ASCII / Unicode-String)
q (Quadword)
<pattern>: [(nt | <dll-name>)!] <var-name> (<var-name> gehören und *?)
<range>: <Adresse> <Adresse>
: <Adresse> L <count>

User-Modus-Optionen:
~ - Liste Themen-Status
~ # S - set Standard-Thread
| - Liste Prozesse Status
| # S - set default-Prozess

x86-Optionen:
DG <selector> - dump-Selektor
<reg>: [e] ax, [e] bx, [e] cx, [e] dx, [e] si, [e] di [e] bp, [e] sp, [e] ip [ e] fl,
al, ah, bl, bh, cl, ch, dl, dh, cs, ds, es, fs, gs, ss
dr0, DR1, DR2, DR3, DR6, DR7
fpcw, fpsw, fptw, st0-ST7, mm0-mm7
xmm0-xmm7
<flag>: iopl, der, df, wenn tf, sf, zf, af, pf, vgl.
<addr>: # <16-Bit-Protected-Modus [seg:] Adresse>,
& <V86-mode [seg:]address>

Öffnen Debugger.chm für komplette Debugger Dokumentation

Meta-Befehle

Diejenigen mit einem Punkt anfangen, vor allem für fortgeschrittene Debugging. Einige wichtige Befehle, die Sie kennen sollten:

  • . Symfix und. SYMPATH für die Verwendung von Symbol-Server
  • . Srcfix und. Srcpath für den Einsatz von Quellserver
  • . Last. Loadby,. Entladen. Kette. Setdll für die Verwaltung von Debug-Erweiterungen
  • . Server. Fernbedienung für Remote-Debugging

Es lohnt sich, Ihre Zeit, um sich mit Symbol-Server, Quellserver und Remote-Debugging: sie wird Ihr Leben viel einfacher. unten ist der Ausgang der Befehl help.:

0:006>. Hilfe
. Befehle:
. Aufzugeben - Aufgabe des aktuellen Prozesses
. Allow_exec_cmds [0 | 1] - Kontrolle Ausführungsbefehle
. Allow_image_mapping [0 | 1] - control on-demand-Image-Datei-Mapping
. Apply_dbp [<Optionen>] - add aktuellen Daten Haltepunkt Zustand zu einem
registrieren Kontext
. Asm [<Optionen>] - set Demontage Optionen
. Asm-[<Optionen>] - klare Demontage Optionen
. Anhängen <proc> - Wert auf <proc> bei der nächsten Ausführung
. Block {<commands>} - Klammern eine Reihe von Befehlen für verschachtelte Ausführung
. Bpsync [0 | 1] - spezielle Haltepunkt Verhalten für multithreaded debuggees
. Break - Ausbruch aus dem umgebenden Schleife
. Breakin - brechen in KD
. Cache [<Optionen>] - virtuellen Speicher-Cache-Steuerung
. Rufen <fn> (<arg1>, <arg2>, ...) - eine Funktion in der Debuggee
. Catch {} <commands> - catch Ausfälle in Befehle
. Kette - Liste aktuelle Erweiterungen
. Childdbg <0 | 1> - wiederum Kind-Prozess-Debugging ein-oder ausschalten
. Klienten - Liste aktuell aktiven Kunden
. CloseHandle [<Optionen>] [<handle>] - schließen Sie die angegebenen Handle
. Weiter - Fortsetzung der umgebenden Schleife
. Copysym [<Optionen>] <Pfad> - copy aktuelle Symbol Dateien in ein Verzeichnis
. Schaffen <command line> - erstellen Sie einen neuen Prozess
. Createdir [<Optionen>] [<Pfad>] - Regelvorgang Erstellungsoptionen
. Cxr <Adresse> - dump Kontext Datensatz angegebene Adresse
k * nach diesem gibt cxr Stack
. Dbgdbg - einen Debugger anhängen, um die aktuelle Debugger
. Debug_sw_wow [0 | 1] - ermöglichen die Interaktion mit Software-Emulation WOW
. Detach - detach aus dem aktuellen Prozess / dump
. Dml_file <file> - Ausgabe DML Inhalt aus der Datei
. Dml_flow <start> <addr> - zeigen Basisblock code flow
. Dml_start [<Optionen>] - schiffbaren Überblick über Debugger-Aktivitäten
. Do {} <commands> (<cond>) - execute <commands> bis <cond> Null
. Fahrer - Dieser Befehl wurde entfernt - use 'lm' oder reload-l).
. Dump [<options>] <Dateiname> - Erstellen Sie ein Dump-Datei auf dem Host-System
. Dvalloc [<Optionen>] <bytes> - VirtualAlloc Speicher im Debuggee
. Dvfree [<Optionen>] <offset> <bytes> - VirtualFree Speicher im Debuggee
. Echo ["<string>" | <string>] - string
. Echotime - Ausgabe Debugger Zeit
. Echotimestamps [0 | 1] - wechseln timestamp Ausgabe auf Veranstaltungen
. Ecxr - dump Kontext Rekord für aktuelle Ausnahme
. Effmach [<machine>] - change aktuellen Maschinentyp
. Else {} <commands> - if / then / else bedingte Ausführung
. Elsif (<cond>) {<commands>} [<else clauses>] - if / then / else Bedingung
Ausführung
. Enable_long_status [0 | 1] - dump LONG-Typen in Standard-Basis-
. Enable_unicode [0 | 1] - dump USHORT Array / Pointer und Unicode-Strings
. Endsrv <id> - disable den gegebenen Motor-Server
. Endpsrv - Ursache der aktuellen Sitzung der Remote-Server zu beenden
. Enumtag - aufzählen verfügbar getaggt Daten
. Event_code - Anzeige zwischengespeichert Veranstaltung Anweisungen
. Eventlog - Anzeige Protokoll der letzten Ereignisse
. Veranstaltungen - Anzeige und wählen verfügbaren Ereignisse
. Eventstr - Anzeige auf jeden Fall Strings Debuggee registriert
. Exepath [<dir> [;...]] - set ausführbare Suchpfad
. Exepath + [<dir> [;...]] - append ausführbare Suchpfad
. Expr - Kontrolle Ausdrucksauswertung
. Exptr <Adresse> -.. Do exr und cxr für EXCEPTION_POINTERS
. Exr <Adresse> - dump Ausnahme Datensatz angegebene Adresse
. Extmatch [<opts>] <pattern> - Anzeige alle Erweiterungen Mustervergleich
. ExtPath <opts> [<dir> [;...]] - set-Erweiterung Suchpfad
. ExtPath + <opts> [<dir> [;...]] - append Erweiterung Suchpfad
. F + - set aktuelle Stack-Frame an den Aufrufer der aktuellen Frame
. F-- set aktuelle Stack-Frame zu der aktuellen Frame callee
. Faser <Adresse> - Sets Rahmen der Faser unter der Adresse
setzt dabei, wenn keine Adresse angegeben
. Fiximports <pattern> - Versuche für die Einfuhren, Bilder zu verlinken
. Fnent <Adresse> - dump-Funktion Eintrag für den angegebenen Code-Adresse
. Fnret <fnaddr> [<retval>] - Anzeige formatiert Rückgabewert
. For (<init>; <cond>; <step>) {} <commands> - execute <commands> und
<step> bis <cond> ist
Null
. Force_radix_output [0 | 1] - dump Integer-Typen in Standard-Basis-
. Force_system_init [<Optionen>] - force angemeldete Systeme zu initialisieren, wenn möglich
. Force_tb - gewaltsam erlauben Filiale Tracing
. Foreach [setzt] (<alias> {<tcmds>}) {} <ecmds> - execute <ecmds> für
jedes Token in den
Ausgabe von <tcmds>
. Fpo <options> - Steuerelement überschrieben FPO Informationen
. Frame [<frame>] - set aktuelle Stack-Frame für Einheimische
. Formate <expr> - zeigt Ergebnis des Ausdrucks in vielen Formaten
. Help [<Optionen>] - diese Hilfe
. Holdmem <options> [Bereich] - halten und vergleichen Speicherdaten
. If (<cond>) {<commands>} [<else clauses>] - if / then / else Bedingung
Ausführung
. Ignore_missing_pages [0 | 1] - Kontrolle Kernel Zusammenfassung Dump fehlt
Seite Fehlermeldung
. Imgscan <options> - Scan-Speicher für PE-Abbilder
. Jdinfo <jdi_addr> - interpretieren AeDebug Informationen
. Kframes <count> - set Standard-Stack-Trace-Tiefe
. Töten - töten den aktuellen Prozess
. Lastevent - Anzeige der letzten Veranstaltung, die aufgetreten
. Verlassen - Beenden des umschließenden fangen.
. Linien - Toggle line Symbol loading
. Last <name> - stell 'das Erweiterungs-DLL, die Verlängerungskette
. Loadby <name> <mod> - fügen Sie die Erweiterungs-DLL in das Modul
Verzeichnis der Verlängerungskette
. Locale [<locale>] - setzt die aktuelle locale
. Logfile - Anzeige log Status
. Logopen [<Datei>] - eröffnen neue Log-Datei
. Logappend [<Datei>] - append Log-Datei
. Logclose - in der Nähe Protokolldatei
. Netsyms [0 | 1] - erlauben / verbieten net Symbol Wege
. NetUSE [<Optionen>] - verwalten Netzverbindungen
. Noshell - disable-Shell-Befehle
. Noversion - disable Erweiterung Versionsprüfung
. OFILTER <pattern> - Filter Debuggee Ausgang gegen die einem bestimmten Muster
. Ocommand <prefix> - behandeln Ausgang mit dem angegebenen Präfix als Befehl
. Opendump <file> - öffnet eine Dump-Datei
. Outmask <mask> - gesetzten Bits in der aktuellen Ausgabe Maske
. Outmask-<mask> - clear bits in der aktuellen Ausgabe Maske
. PCMD [<Optionen>] - Regler pro-prompt-Befehl
. Pop [<Optionen>] - Pop Zustand
. Prefer_dml [0 | 1] - Kontrolle DML-Modus standardmäßig
. Printf "<format>", <args…> - formatierte Ausgabe
. Verfahren [<Adresse>] - setzt implizite Verfahren
setzt Verzug, wenn keine Adresse angegeben
. Prompt_allow [<Optionen>] - steuern, welche Informationen angezeigt werden können
an der Eingabeaufforderung
. Push [<Optionen>] - push Zustand
. Quit_lock [<Optionen>] - Schlösser Sitzung vor unerwarteten beenden
. Readmem <file> <range> - read raw-Speicher aus einer Datei
. Record_branches [0 | 1] - steuert die Aufnahme von Prozessor-Verzweigung
. Reload [<image.ext> [= <Adresse>, <Größe>]] - reload Symbole
. Neustart - Anforderung einer Sitzung starten
. Remote <pipename> - start remote.exe Server
. Sichere [0 | 1] - verbieten Operationen gefährlich für die Gastgeber
. Send_file <options> - Senden von Dateien an Remote-Server
. Server <options> - Motor starten Server
. Server - Liste aktiver Remoting-Server
. Setdll <name> - Debugger für Erweiterungen in dieser DLL ersten Suche
. Shell [<command>] - execute Shell-Befehl
. Show_read_failures [<opts>] - Kontrolle gegen Lesefehler Ausgang
. Show_sym_failures [<opts>] - Kontrolle zusätzliches Symbol Störmeldeausgang
. Schlafen <milliseconds> - Debugger schläft gegebene Dauer
nützlich für den Zugriff auf eine Maschine, die
gebrochen auf einer ntsd-d
. Srcfix [<Pfad extra>] - fix Quelle Suchpfad
. Srcfix + [<Pfad extra>] - append festen Quelle Suchpfad
. Srcnoisy [0 | 1] - control verbose Quelle Ladeleistung
. Srcpath [<dir> [;...]] - set-Source-Suchpfad
. Srcpath + [<dir> [;...]] - append-Source-Suchpfad
. Step_filter [<opts>] ["<pattern> [; <pattern> ...]"] - Set Symbol Muster
zu überspringen, wenn Schrittmotoren
. Symfix [<localsym>] - fix Symbol Suchpfad
. Symfix + [<localsym>] - append festen Symbol Suchpfad
. Symopt <flags> - set symbol Optionen
. Symopt + <flags> - set symbol Optionen
. Symopt-<flags> - deutliches Zeichen Optionen
. SYMPATH [<dir> [;...]] - set symbol Suchpfad
. SYMPATH + [<dir> [;...]] - append Symbol Suchpfad
. Thread [<Adresse>] - setzt Kontext der Faden unter der Adresse
setzt standardmäßig dabei, wenn keine Adresse angegeben
. Zeit - zeigt session time Informationen
. TTime - zeigt thread Zeitinformation
. Tlist - Liste laufender Prozesse
. Typeopt <flags> - set / clear-Optionen
. Entladen <name> - entfernen Sie diese Erweiterungs-DLL aus der Liste der Erweiterungs-DLLs
. Unloadall - entfernen Sie alle Erweiterungs-DLLs aus der Liste der Erweiterungen DLLs
. Aufwachen - aufwachen ein sleep'ing Debugger.
. While (<cond>) {} <commands> - execute <commands> während <cond> nicht Null ist
. Writemem <file> <range> - write raw-Speicher in eine Datei

Verwenden Sie ". Hh <command>" oder öffnen Sie Debugger.chm in der Debugger-Verzeichnis zu bekommen
ausführliche Dokumentation auf einen Befehl.

Erweiterung Befehle

Diese beginnen mit!, In der Regel für einen bestimmten Bereich, wie SOS-Erweiterung Befehle für verwaltete Debuggen. Sie können! <ext>. Hilfe, um Befehle von einer Verlängerung Liste, wie! Exts.help. Für fortgeschrittene System-Debugging, wie die Erfassung von Speicherlecks, Deadlock etc, muss man sehr vertraut mit den Extension-Befehle.

SOS

Überblick

SOS ist die Abkürzung für Son of Strike (fragt mich nicht warum), eine Debug-Erweiterung für verwaltete Debuggen. Ich glaube, es von CLR-Team für die CLR-Debugging erfunden wurde, so hat es schon seit langem, und es gibt viele gute Informationen im Internet. Einige empfohlene Lektüre:

Jede Version der CLR verfügt über eine eigene SOS (NET Framework 3.5 noch verwendet CLR 2.0 und Silverlight verfügt über eine eigene CLR.)

Verzeichnis von C: \ Program Files \ Debugging Tools for Windows \ clr10
2007.09.19 07.01 Uhr 948.784 SOS.dll
1 Datei (en) 948.784 Bytes

Verzeichnis von C: \ Program Files \ Microsoft Silverlight \ 2.0.31005.0
2008.10.05 02.16 Uhr 495.424 SOS.dll
1 Datei (en) 495.424 Bytes

Verzeichnis von C: \ Windows \ Microsoft.NET \ Framework \ v1.1.4322
2004.07.15 00.35 Uhr 319.488 SOS.dll
1 Datei (en) 319.488 Bytes

Verzeichnis von C: \ Windows \ Microsoft.NET \ Framework \ v2.0.50727
2008.07.27 10.03 Uhr 392.184 SOS.dll
1 Datei (en) 392.184 Bytes


Befehle

SOS Laufzeit Hilfe ist so groß, dass man fast nicht brauchen andere doc außer ein paar try and error und einige Frustration :-)

0:016>! Hilfe
---------------------------
SOS ist ein Debugger-Erweiterungs-DLL für den Einsatz in das Debuggen von verwalteten Hilfe
Programme. Die Funktionen sind nach Kategorie sortiert aufgelistet, dann etwa in der Reihenfolge der
Bedeutung zu. Shortcut-Namen für beliebte Funktionen sind in Klammern aufgeführt.
Geben Sie "! Hilfe <Funktionsname>" für detaillierte Informationen über diese Funktion.

Object Inspection Untersuchen Code und Stapeln
---------- ----------
DumpObj (do) Themen
DumpArray (da) CLRStack
DumpStackObjects (DSO) IP2MD
DumpHeap U
DumpVC DumpStack
GCRoot EEStack
ObjSize GCInfo
FinalizeQueue EHInfo
PrintException (pe) COMState
TraverseHeap BPMD

Untersuchen CLR-Datenstrukturen Diagnostic Utilities
---------- ----------
DumpDomain VerifyHeap
Eeheap VerifyObj
Name2EE FindRoots
SyncBlk HeapStat
DumpMT GCWhere
DumpClass ListNearObj (LNO)
DumpMD GCHandles
Token2EE GCHandleLeaks
EEVersion FinalizeQueue (fq)
DumpModule FindAppDomain
ThreadPool SaveModule
DumpAssembly procinfo
DumpSigElem StopOnException (soe)
DumpRuntimeTypes DumpLog
DumpSig VMMap
RCWCleanupList vmstat
DumpIL MinidumpMode
AnalyzeOOM (ao)

Die Untersuchung der GC Geschichte Andere
---------- ----------
HistInit FAQ
HistStats
HistRoot
HistObj
HistObjFind
HistClear

Beispiel Debug Demonstration

Ich werde das gleiche einfachsten Silverlight-Anwendung in früheren Post verwenden ( Silverlight Debuggen mit Visual Studio ) zu demonstrieren WinDbg Debugging mit SOS:

image_thumb

Hier ist die Debug-log mit meinen Anmerkungen (beginnen mit / /):

/ / Set up Symbol Pfad zu Symbol-Server verwenden
0:013>. SYMPATH
Symbol Suchpfad ist: <leer>
0:013> symfix C:. \ Users \ ningz \ AppData \ Local \ Temp \ Symbols
0:013>. SYMPATH
Symbol Suchpfad ist: SRV * C: \ Users \ ningz \ AppData \ Local \ Temp \ Symbols \ * \ symbols \ symbols

/ / Add pdb Pfad für die Anwendung gedebuggt
0:013> SYMPATH +. "C: \ Users \ ningz \ Documents \ Visual Studio 2008 \ Projects \ SilverlightApplication1 \ SilverlightApplication1 \ Bin \ Debug"
Symbol Suchpfad ist: SRV * C: \ Users \ ningz \ AppData \ Local \ Temp \ Symbols *
http://msdl.microsoft.com/download/symbols;
C: \ Users \ ningz \ Documents \ Visual Studio 2008 \ Projects \ SilverlightApplication1 \ SilverlightApplication1 \ Bin \ Debug

/ / Reload alle Symbole
0:013>. Reload
Reloading aktuellen Module

/ / Set up Quellpfad Quellserver verwenden
0:013>. Srcpath
Source Suchpfad ist: <leer>
0:013>. Srcfix
Source Suchpfad ist: SRV *
0:013> srcpath +. "C: \ Users \ ningz \ Documents \ Visual Studio 2008 \ Projects \ SilverlightApplication1 \ SilverlightApplication1"
Source Suchpfad ist: SRV * C: \ Users \ ningz \ Documents \ Visual Studio 2008 \ Projects \ SilverlightApplication1 \ SilverlightApplication1

/ / Load SOS. Bitte beachten Sie:
/ / 1. es scheint mscorwks mit coreclr in Silverlight wird ersetzt
/ / 2. . statt loadby, können Sie auch load "C: \ Program Files \ Microsoft Silverlight \ 2.0.31005.0 \ SOS.dll".
0:013>. Loadby sos coreclr
Loaded c: \ Program Files \ Microsoft Silverlight \ 2.0.31005.0 \ sos-Erweiterungs-DLL

/ / Einen Haltepunkt für Button Click-Ereignishandler
0:013>! BPMD SilverlightApplication1 SilverlightApplication1.Page.Button_Click
Gefunden 1 Methoden ...
MethodDesc = 03983a30
Hinzufügen angemeldete Haltepunkte ...
0:013> bl
0 e 0428215b 0001 (0001) 0 :****
0:013> g
MODLOAD: 70800000 7080c000 C: Windowssystem32dwmapi.dll

/ / Auf die Schaltfläche und brechen in windbg
Breakpoint 0 Treffer
*** WARNUNG: Kann Prüfsumme für SilverlightApplication1.dll überprüfen
! SilverlightApplication1 Button_Click:
04850398 55 push ebp
Integrierte verwaltete Debuggen nicht unterstützt Aufzählung von lokalen Variablen.
Siehe http://dbg/managed.htm für weitere Details.
Managed Rahmen fehlgeschlagen, HRESULT 0x80004005

/ / Vergleichen! Themen und ~ * Ausgang
0:005>! Fäden / / list verwalteten Threads nur
ThreadCount: 3
UnstartedThread: 0
BackgroundThread: 3
PendingThread: 0
DeadThread: 0
Hosted Laufzeit: yes
PreEmptive GC Alloc sperren
ID OSID ThreadOBJ Staat GC Context Domain Graf APT Exception
5 1 1b08 043576e0 220 Behinderte 04f9f214: 04f9ffe8 06f529d8 0 STA
9 2 928 043689c8 B220 Aktiviert 00000000:00000000 0433c738 0 MTA (Finalizer)
10 3 1e8c 06f509d0 1220 Aktiviert 00000000:00000000 0433c738 0 UKn
0:005> ~ * / / Liste alle Themen
0 id: 162c.1a28 Suspend: 1 Teb: 7ffde000 aufgetaut
Start: iexplore wWinMainCRTStartup (00a52d79)
Priorität: 0 Priority-Klasse: 32 Affinity: 3
2 ID: 162c.1020 Suspend: 1 Teb: 7ffdc000 aufgetaut
Start: ole32 CRpcThreadCache:: RpcWorkerThreadEntry (76dfe0cc)
Priorität: 0 Priority-Klasse: 32 Affinity: 3
3 ID: 162c.1e00 Suspend: 1 Teb: 7ffda000 aufgetaut
Start: ntdll TppWaiterpThread (778ab61b)
Priorität: 0 Priority-Klasse: 32 Affinity: 3
4 ID: 162c.1f00 Suspend: 1 Teb: 7ffd9000 aufgetaut
Start: msvcrt _endthreadex 0 x6f (76162da8)
Priorität: 0 Priority-Klasse: 32 Affinity: 3
. 5 ID: 162c.1b08 Suspend: 1 Teb: 7ffd8000 aufgetaut
Start: IEFrame CTabWindow: _TabWindowThreadProc (6c163fdb)
Priorität: 0 Priority-Klasse: 32 Affinity: 3
7 ID: 162c.170 Suspend: 1 Teb: 7ffd6000 aufgetaut
Start: npctrl CXcpDispatcher: DispatcherTimerCallback (6a6d16f4)
Priorität: 0 Priority-Klasse: 32 Affinity: 3
8 ID: 162c.1cd0 Suspend: 1 Teb: 7ffd5000 aufgetaut
Start: coreclr DebuggerRCThread: ThreadProcStatic (640eb5cd)
Priorität: 0 Priority-Klasse: 32 Affinity: 3
9 ID: 162c.928 Suspend: 1 Teb: 7ffd4000 aufgetaut
Start: coreclr Thema:: intermediateThreadProc (63fb8e4f)
Priorität: 0 Priority-Klasse: 32 Affinity: 3
10 ID: 162c.1e8c Suspend: 1 Teb: 7ffd3000 aufgetaut
Start: coreclr Thema:: intermediateThreadProc (63fb8e4f)
Priorität: 0 Priority-Klasse: 32 Affinity: 3
11 ID: 162c.1fac Suspend: 1 Teb: 7ffaf000 aufgetaut
Start: agcore CMulticoreTaskScheduler: WorkerThread (660547de)
Priorität: 0 Priority-Klasse: 32 Affinity: 3
12 ID: 162c.1b78 Suspend: 1 Teb: 7ffae000 aufgetaut
Start: agcore CMulticoreTaskScheduler: WorkerThread (660547de)
Priorität: 0 Priority-Klasse: 32 Affinity: 3
13 ID: 162c.1d18 Suspend: 1 Teb: 7ffdb000 aufgetaut
Start: ntdll RtlUserThreadStart (778c9a78)
Priorität: 0 Priority-Klasse: 32 Affinity: 3
Managed Rahmen fehlgeschlagen, HRESULT 0x80004005
Integrierte verwaltete Debuggen nicht unterstützt Aufzählung von lokalen Variablen.
Siehe http://dbg/managed.htm für weitere Details.

/ / Vergleichen! Clrstack & k-Ausgang
0:005>! Clrstack-p / / Liste verwaltet Stack-Frames nur
OS Thread-ID: 0x1b08 (5)
ESP EIP
0450f850 04800398 SilverlightApplication1.Page.Button_Click (System.Object, System.Windows.RoutedEventArgs)
PARAMETER:
Diese (<CLR reg>) = 0x04f59c78
Absender (<CLR reg>) = 0x04f5b948
e (0x0450f854) = 0x04f9f1f0

0450f858 048cde0d System.Windows.Controls.Primitives.ButtonBase.OnClick ()
PARAMETER:
Diese (0x0450f864) = 0x04f5b948

0450f870 048cdd10 System.Windows.Controls.Button.OnClick ()
PARAMETER:
this = <no data>

0450f880 048cdc3d
PARAMETER:
Diese (0x0450f884) = 0x04f5b948
e (0x0450f880) = 0x04f9f188

0450f890 048cdba1 System.Windows.Controls.Control.OnMouseLeftButtonUp (System.Windows.Controls.Control, System.EventArgs)
PARAMETER:
ctrl = <no data>
e = <no data>

0450f8a0 0483a0e7 MS.Internal.JoltHelper.FireEvent (IntPtr, IntPtr, Int32, System.String)
PARAMETER:
unmanagedObj (0x0450f8f8) = 0x04355c48
unmanagedObjArgs (0x0450f8f4) = 0x0707be00
argsTypeIndex (0x0450f928) = 0x000000a9
eventName (0x0450f924) = 0x04f9f16c

0450fa74 63ef17b0 [GCFrame: 0450fa74]
0450fb30 63ef17b0 [ContextTransitionFrame: 0450fb30]
0450fc28 63ef17b0 [UMThkCallFrame: 0450fc28]
0:005> kP / / Liste aller Stack-Frames
ChildEBP RetAddr
0450f868 048cde0d SilverlightApplication1! Button_Click (<HRESULT 0x80004001>)
0450f868 048cdd10 System_Windows! System.Windows.Controls.Primitives.ButtonBase.OnClick (<HRESULT 0x80004001>) +0 X5D
0450f878 048cdc3d System_Windows! System.Windows.Controls.Button.OnClick (<HRESULT 0x80004001>) +0 x48
0450f888 048cdba1 System_Windows! System.Windows.Controls.Primitives.ButtonBase.OnMouseLeftButtonUp (<HRESULT 0x80004001>) +0 x85
0450f898 0483a0e7 System_Windows! System.Windows.Controls.Control.OnMouseLeftButtonUp (<HRESULT 0x80004001>) +0 x41
0450f91c 63ef17b0 System_Windows! MS.Internal.JoltHelper.FireEvent (<HRESULT 0x80004001>) +0 x1b7
0450f934 63ef5f98 coreclr! CallDescrWorker 0 x33
0450f9b0 63f032bc coreclr! CallDescrWorkerWithHandler 0 X8E
0450f9d0 63f0345c coreclr! ForwardCallToManagedMethod 0 x55
0450faf4 63fc4abf coreclr! DoUMThunkCallWorker 0 x199
0450fbe0 04c513d2 coreclr! DoUMThunkCall 0 x1b4
WARNUNG: Frame IP nicht in allen bekannten Modul. Folgende Frames sind möglicherweise falsch.
0450fc10 6607e0db 0x4c513d2
0450fc70 6a6dc1fc agcore CCoreServices:: CLR_FireEvent 0 X183
Managed Rahmen fehlgeschlagen, HRESULT 0x80004005
0450fc84 6a6dc187 npctrl CommonBrowserHost:: CLR_FireEvent 0 X2A
0450fcc8 6a6dc048 npctrl CControlBase:: ScriptCallback 0 x366
0450fd08 6a6dc013 npctrl CXcpDispatcher:: OnScriptCallback 0 xee
! 0450fd14 6a6dbfef npctrl CXcpDispatcher: OnWindowMessage 0 X3A
0450fd2c 7731f8d2 npctrl CXcpDispatcher:: WindowProc 0 x7f
0450fd58 7731f794 USER32! InternalCallWinProc 0 x23
0450fdd0 77320008 USER32! UserCallWinProcCheckWow 0 X14B

/ / Prüfen, Haufen, beachten Sie die Bequemlichkeit des starken typisierte Objekt Haufen,
/ / Anstelle von un-typed Bytes als in systemeigenen Heap
0:005>! Dumpheap-Typ SilverlightApplication1
Adresse MT Größe
04f4f31c 046336b0 36
04f59c78 04633a6c 68
insgesamt 2 Objekten
Statistik:
MT Graf TotalSize Class Name
046336b0 1 36 SilverlightApplication1.App
04633a6c 1 68 SilverlightApplication1.Page
Insgesamt 2 Objekte
0:005>! Tun 04f59c78
Name: SilverlightApplication1.Page
MethodTable: 04633a6c
EEClass: 0463196c
Größe: 68 (0x44) Bytes
Datei: SilverlightApplication1, Version = 1.0.0.0, Culture = neutral, PublicKeyToken = null
Felder:
MT Feld Offset Typ VT Attr Value Name
047d97a0 40000dc 4 ... al.NativeResource Instanz 0. 04f5a5c0 m_nativePtr
04853ab8 40000df 8 ... System.Windows]] 0 Beispiel 00000000 _valueTable
047d9874 40000e0 c ... reTypeEventHelper Instanz 0. 04f5a600 _coreTypeEventHelper
04856388 40000e3 10 ... hnische, mscorlib]] 0 Beispiel 04f79a58 _treeChildren
047ae03c 40000e4 14 ... rnal.IManagedPeer Instanz 0. 00000000 _treeParent
03d50a90 40000dd 2B0 System.IntPtr 1 gemeinsames statische StaticNativePointer
>> Domain: Wert 0433c738: NotInit 06f529d8: 00000000 <<
03d50f28 40000de 2b4 System.Boolean 1 gemeinsames statische _isCoreCreate
>> Domain: Wert 0433c738: NotInit 06f529d8: 0 <<
047ae384 40000e1 8 .... DependencyObject 0 Gemeinsam statisch PropertyReferencesHolder
>> Domain: Wert 0433c738: NotInit 06f529d8: 04f489b8 <<
04661618 40000e2 c ... flection.Assembly 0 Gemeinsam statisch _executingAssembly
>> Domain: Wert 0433c738: NotInit 06f529d8: 00000000 <<
047d0b90 40000f1 18 ... rs.AutomationPeer Instanz 0. 00000000 m_pAP
047d7404 40000e8 10 ... ependencyProperty 0 Gemeinsam statisch OpacityProperty
>> Domain: Wert 0433c738: NotInit 06f529d8: 04f5a4a8 <<
047d7404 40000e9 14 ... ependencyProperty 0 Gemeinsam statisch ClipProperty
>> Domain: Wert 0433c738: NotInit 06f529d8: 04f5a4d0 <<
047d7404 40000ea 18 ... ependencyProperty 0 Gemeinsam statisch RenderTransformProperty
>> Domain: Wert 0433c738: NotInit 06f529d8: 04f5a4f8 <<
047d7404 40000eb 1c ... ependencyProperty 0 Gemeinsam statisch OpacityMaskProperty
>> Domain: Wert 0433c738: NotInit 06f529d8: 04f5a50c <<
047d7404 40000ec 20 ... ependencyProperty 0 Gemeinsam statisch RenderTransformOriginProperty
>> Domain: Wert 0433c738: NotInit 06f529d8: 04f5a534 <<
047d7404 40000ed 24 ... ependencyProperty 0 Gemeinsam statisch IsHitTestVisibleProperty
>> Domain: Wert 0433c738: NotInit 06f529d8: 04f5a548 <<
047d7404 40000ee 28 ... ependencyProperty 0 Gemeinsam statisch VisibilityProperty
>> Domain: Wert 0433c738: NotInit 06f529d8: 04f5a570 <<
047d7404 40000ef 2c ... ependencyProperty 0 Gemeinsam statisch RenderSizeProperty
>> Domain: Wert 0433c738: NotInit 06f529d8: 04f5a598 <<
047d7404 40000f0 30 ... ependencyProperty 0 Gemeinsam statisch UseLayoutRoundingProperty
>> Domain: Wert 0433c738: NotInit 06f529d8: 04f5a5ac <<
00000000 4000108 1c Instanz 0. 00000000 BindingValidationError
04856ae4 400010a 20 ... angedEventHandler Instanz 0. 00000000 DPChanged
048bc8a4 400010b 24 ... angedEventHandler Instanz 0. 00000000 DataContextChanged
03d50f28 400010c 2c System.Boolean 1 Instanz 0 _isDataContextBound
0481f43c 400010d 28 ... angedEventHandler Instanz 0. 00000000 _sizeChanged
047d7404 40000f2 34 ... ependencyProperty 0 Gemeinsam statisch TriggersProperty
>> Domain: Wert 0433c738: NotInit 06f529d8: 04f5a144 <<
047d7404 40000f3 38 ... ependencyProperty 0 Gemeinsam statisch ResourcesProperty
>> Domain: Wert 0433c738: NotInit 06f529d8: 04f5a158 <<
047d7404 40000f4 3c ... ependencyProperty 0 Gemeinsam statisch LanguageProperty
>> Domain: Wert 0433c738: NotInit 06f529d8: 04f5a180 <<
047d7404 40000f5 40 ... ependencyProperty 0 Gemeinsam statisch ActualWidthProperty
>> Domain: Wert 0433c738: NotInit 06f529d8: 04f5a194 <<
047d7404 40000f6 44 ... ependencyProperty 0 Gemeinsam statisch ActualHeightProperty
>> Domain: Wert 0433c738: NotInit 06f529d8: 04f5a1a8 <<
047d7404 40000f7 48 ... ependencyProperty 0 Gemeinsam statisch WidthProperty
>> Domain: Wert 0433c738: NotInit 06f529d8: 04f5a1bc <<
047d7404 40000f8 4c ... ependencyProperty 0 Gemeinsam statisch HeightProperty
>> Domain: Wert 0433c738: NotInit 06f529d8: 04f5a1d0 <<
047d7404 40000f9 50 ... ependencyProperty 0 Gemeinsam statisch MinWidthProperty
>> Domain: Wert 0433c738: NotInit 06f529d8: 04f5a1e4 <<
047d7404 40000fa 54 ... ependencyProperty 0 Gemeinsam statisch MaxWidthProperty
>> Domain: Wert 0433c738: NotInit 06f529d8: 04f5a1f8 <<
047d7404 40000fb 58 ... ependencyProperty 0 Gemeinsam statisch MinHeightProperty
>> Domain: Wert 0433c738: NotInit 06f529d8: 04f5a20c <<
047d7404 40000fc 5c ... ependencyProperty 0 Gemeinsam statisch MaxHeightProperty
>> Domain: Wert 0433c738: NotInit 06f529d8: 04f5a220 <<
047d7404 40000fd 60 ... ependencyProperty 0 Gemeinsam statisch HorizontalAlignmentProperty
>> Domain: Wert 0433c738: NotInit 06f529d8: 04f5a234 <<
047d7404 40000fe 64 ...ependencyProperty 0 shared static VerticalAlignmentProperty
>> Domain:Value 0433c738:NotInit 06f529d8:04f5a248 <<
047d7404 40000ff 68 ...ependencyProperty 0 shared static MarginProperty
>> Domain:Value 0433c738:NotInit 06f529d8:04f5a25c <<
047d7404 4000100 6c ...ependencyProperty 0 shared static StyleProperty
>> Domain:Value 0433c738:NotInit 06f529d8:04f5a284 <<
047d7404 4000101 70 ...ependencyProperty 0 shared static ParentProperty
>> Domain:Value 0433c738:NotInit 06f529d8:04f5a2ac <<
047d7404 4000102 74 ...ependencyProperty 0 shared static NameProperty
>> Domain:Value 0433c738:NotInit 06f529d8:04f5a2c0 <<
047d7404 4000103 78 ...ependencyProperty 0 shared static TagProperty
>> Domain:Value 0433c738:NotInit 06f529d8:04f5a2d4 <<
047d7404 4000104 7c ...ependencyProperty 0 shared static TagInternalProperty
>> Domain:Value 0433c738:NotInit 06f529d8:04f5a2fc <<
04851464 4000105 80 ...ndows.RoutedEvent 0 shared static LoadedEvent
>> Domain:Value 0433c738:NotInit 06f529d8:04f5a420 <<
047d7404 4000106 84 ...ependencyProperty 0 shared static CursorProperty
>> Domain:Value 0433c738:NotInit 06f529d8:04f5a440 <<
047d7404 4000107 88 ...ependencyProperty 0 shared static InstanceDelegateStoreProperty
>> Domain:Value 0433c738:NotInit 06f529d8:04f5a468 <<
047d7404 4000109 8c ...ependencyProperty 0 shared static DataContextProperty
>> Domain:Value 0433c738:NotInit 06f529d8:04f5a494 <<
047a1e2c 400010e 90 ...rence, mscorlib]] 0 shared static _staticDelegateList
>> Domain:Value 0433c738:NotInit 06f529d8:00000000 <<
00000000 4000264 30 ...angedEventHandler 0 instance 00000000 IsEnabledChanged
047d7404 4000252 430 ...ependencyProperty 0 shared static IsTabStopProperty
>> Domain:Value 0433c738:NotInit 06f529d8:04f59ce4 <<
047d7404 4000253 434 ...ependencyProperty 0 shared static TabIndexProperty
>> Domain:Value 0433c738:NotInit 06f529d8:04f59cf8 <<
047d7404 4000254 438 ...ependencyProperty 0 shared static TemplateProperty
>> Domain:Value 0433c738:NotInit 06f529d8:04f59d20 <<
047d7404 4000255 43c ...ependencyProperty 0 shared static TabNavigationProperty
>> Domain:Value 0433c738:NotInit 06f529d8:04f59d48 <<
047d7404 4000256 440 ...ependencyProperty 0 shared static PaddingProperty
>> Domain:Value 0433c738:NotInit 06f529d8:04f59d70 <<
047d7404 4000257 444 ...ependencyProperty 0 shared static HorizontalContentAlignmentProperty
>> Domain:Value 0433c738:NotInit 06f529d8:04f59d98 <<
047d7404 4000258 448 ...ependencyProperty 0 shared static VerticalContentAlignmentProperty
>> Domain:Value 0433c738:NotInit 06f529d8:04f59dc0 <<
047d7404 4000259 44c ...ependencyProperty 0 shared static BackgroundProperty
>> Domain:Value 0433c738:NotInit 06f529d8:04f59de8 <<
047d7404 400025a 450 ...ependencyProperty 0 shared static BorderBrushProperty
>> Domain:Value 0433c738:NotInit 06f529d8:04f59dfc <<
047d7404 400025b 454 ...ependencyProperty 0 shared static BorderThicknessProperty
>> Domain:Value 0433c738:NotInit 06f529d8:04f59e10 <<
047d7404 400025c 458 ...ependencyProperty 0 shared static FontSizeProperty
>> Domain:Value 0433c738:NotInit 06f529d8:04f59e24 <<
047d7404 400025d 45c ...ependencyProperty 0 shared static FontFamilyProperty
>> Domain:Value 0433c738:NotInit 06f529d8:04f59e4c <<
047d7404 400025e 460 ...ependencyProperty 0 shared static ForegroundProperty
>> Domain:Value 0433c738:NotInit 06f529d8:04f59e60 <<
047d7404 400025f 464 ...ependencyProperty 0 shared static FontWeightProperty
>> Domain:Value 0433c738:NotInit 06f529d8:04f59e88 <<
047d7404 4000260 468 ...ependencyProperty 0 shared static FontStyleProperty
>> Domain:Value 0433c738:NotInit 06f529d8:04f59eb0 <<
047d7404 4000261 46c ...ependencyProperty 0 shared static FontStretchProperty
>> Domain:Value 0433c738:NotInit 06f529d8:04f59ed8 <<
047d7404 4000262 470 ...ependencyProperty 0 shared static DefaultStyleKeyProperty
>> Domain:Value 0433c738:NotInit 06f529d8:04f59eec <<
047d7404 4000263 474 ...ependencyProperty 0 shared static IsEnabledProperty
>> Domain:Value 0433c738:NotInit 06f529d8:04f59f00 <<
04857f14 4000265 478 ... System.Windows]] 0 shared static _resourceDictionaryCache
>> Domain:Value 0433c738:NotInit 06f529d8:04f5cae4 <<
03cf5668 4000266 47c System.Object[] 0 shared static _controlDelgates
>> Domain:Value 0433c738:NotInit 06f529d8:04f59f14 <<
047d7404 4000501 77c ...ependencyProperty 0 shared static ContentProperty
>> Domain:Value 0433c738:NotInit 06f529d8:04f59cd0 <<
04852580 4000002 34 ...ows.Controls.Grid 0 instance 04f79770 LayoutRoot
04852a10 4000003 38 ...s.Controls.Button 0 instance 04f5b948 button
03d50f28 4000004 3c System.Boolean 1 instance 1 _contentLoaded

// two lines above is the button object of the page object
// remember its address 04f5b948 , since we will refer to it later
// we can get the same address for the button object via dumpheap command:
0:005> !dumpheap -mt 04852a10
Address MT Size
04f5b948 04852a10 92
total 1 objects
Statistics:
MT Count TotalSize Class Name
04852a10 1 92 System.Windows.Controls.Button
Total 1 objects
0:005> !gcwhere 04f5b948 // button is in gen0, since there is no GC yet
Address Gen Heap segment begin allocated size
04f5b948 0 0 04f40000 04f41000 04f9fff4 0x5c(92)
0:005> !gcroot 04f5b948 // see who's holding reference to the button object
Note: Roots found on stacks may be false positives. Run "!help gcroot" for
more info.
// registry references
ecx:Root: 04f59c78(SilverlightApplication1.Page)->
04f5b948(System.Windows.Controls.Button)->
edx:Root: 04f5b948(System.Windows.Controls.Button)->
// stack references
Scan Thread 5 OSTHread 1b08
ESP:450f860:Root: 04f5ca18(System.Windows.RoutedEventHandler)->
04f59c78(SilverlightApplication1.Page)->
04f5b948(System.Windows.Controls.Button)->
ESP:450f864:Root: 04f5b948(System.Windows.Controls.Button)->
ESP:450f874:Root: 04f5b948(System.Windows.Controls.Button)->
ESP:450f884:Root: 04f5b948(System.Windows.Controls.Button)->
ESP:450f894:Root: 04f5b948(System.Windows.Controls.Button)->
ESP:450f8d4:Root: 04f5b948(System.Windows.Controls.Button)->
ESP:450f8e4:Root: 04f5b948(System.Windows.Controls.Button)->
Scan Thread 9 OSTHread 928
Scan Thread 10 OSTHread 1e8c
// domain references
DOMAIN(06F529D8):HANDLE(Pinned):46412f8:Root: 05f44260(System.Object[])->
04f45234(System.Collections.Generic.List`1[[System.Object, mscorlib]])->
04f59980(System.Object[])->
04f59c78(SilverlightApplication1.Page)->
04f5b948(System.Windows.Controls.Button)->
Managed frame processing failed, HRESULT 0x80004005
Integrated managed debugging does not support enumeration of local variables.
See http://dbg/managed.htm for more details.

// examine the button object itself
0:005> !do 04f5b948
Name: System.Windows.Controls.Button
MethodTable: 04852a10
EEClass: 0482e5f0
Size: 92(0x5c) bytes
File: c:\Program Files\Microsoft Silverlight\2.0.31005.0\System.Windows.dll
Fields:
MT Field Offset Type VT Attr Value Name
047d97a0 40000dc 4 ...al.NativeResource 0 instance 04f5bd58 m_nativePtr
04853ab8 40000df 8 ... System.Windows]] 0 instance 04f5c0bc _valueTable
047d9874 40000e0 c ...reTypeEventHelper 0 instance 04f5bd88 _coreTypeEventHelper
04856388 40000e3 10 ...bject, mscorlib]] 0 instance 04f5bee8 _treeChildren
047ae03c 40000e4 14 ...rnal.IManagedPeer 0 instance 04f79770 _treeParent
03d50a90 40000dd 2b0 System.IntPtr 1 shared static StaticNativePointer
>> Domain:Value 0433c738:NotInit 06f529d8:00000000 <<
03d50f28 40000de 2b4 System.Boolean 1 shared static _isCoreCreate
>> Domain:Value 0433c738:NotInit 06f529d8:0 <<
047ae384 40000e1 8 ....DependencyObject 0 shared static PropertyReferencesHolder
>> Domain:Value 0433c738:NotInit 06f529d8:04f489b8 <<
04661618 40000e2 c ...flection.Assembly 0 shared static _executingAssembly
>> Domain:Value 0433c738:NotInit 06f529d8:00000000 <<
047d0b90 40000f1 18 ...rs.AutomationPeer 0 instance 00000000 m_pAP
047d7404 40000e8 10 ...ependencyProperty 0 shared static OpacityProperty
>> Domain:Value 0433c738:NotInit 06f529d8:04f5a4a8 <<
047d7404 40000e9 14 ...ependencyProperty 0 shared static ClipProperty
>> Domain:Value 0433c738:NotInit 06f529d8:04f5a4d0 <<
047d7404 40000ea 18 ...ependencyProperty 0 shared static RenderTransformProperty
>> Domain:Value 0433c738:NotInit 06f529d8:04f5a4f8 <<
047d7404 40000eb 1c ...ependencyProperty 0 shared static OpacityMaskProperty
>> Domain:Value 0433c738:NotInit 06f529d8:04f5a50c <<
047d7404 40000ec 20 ...ependencyProperty 0 shared static RenderTransformOriginProperty
>> Domain:Value 0433c738:NotInit 06f529d8:04f5a534 <<
047d7404 40000ed 24 ...ependencyProperty 0 shared static IsHitTestVisibleProperty
>> Domain:Value 0433c738:NotInit 06f529d8:04f5a548 <<
047d7404 40000ee 28 ...ependencyProperty 0 shared static VisibilityProperty
>> Domain:Value 0433c738:NotInit 06f529d8:04f5a570 <<
047d7404 40000ef 2c ...ependencyProperty 0 shared static RenderSizeProperty
>> Domain:Value 0433c738:NotInit 06f529d8:04f5a598 <<
047d7404 40000f0 30 ...ependencyProperty 0 shared static UseLayoutRoundingProperty
>> Domain:Value 0433c738:NotInit 06f529d8:04f5a5ac <<
00000000 4000108 1c 0 instance 00000000 BindingValidationError
04856ae4 400010a 20 ...angedEventHandler 0 instance 00000000 DPChanged
048bc8a4 400010b 24 ...angedEventHandler 0 instance 00000000 DataContextChanged
03d50f28 400010c 2c System.Boolean 1 instance 0 _isDataContextBound
0481f43c 400010d 28 ...angedEventHandler 0 instance 00000000 _sizeChanged
047d7404 40000f2 34 ...ependencyProperty 0 shared static TriggersProperty
>> Domain:Value 0433c738:NotInit 06f529d8:04f5a144 <<
047d7404 40000f3 38 ...ependencyProperty 0 shared static ResourcesProperty
>> Domain:Value 0433c738:NotInit 06f529d8:04f5a158 <<
047d7404 40000f4 3c ...ependencyProperty 0 shared static LanguageProperty
>> Domain:Value 0433c738:NotInit 06f529d8:04f5a180 <<
047d7404 40000f5 40 ...ependencyProperty 0 shared static ActualWidthProperty
>> Domain:Value 0433c738:NotInit 06f529d8:04f5a194 <<
047d7404 40000f6 44 ...ependencyProperty 0 shared static ActualHeightProperty
>> Domain:Value 0433c738:NotInit 06f529d8:04f5a1a8 <<
047d7404 40000f7 48 ...ependencyProperty 0 shared static WidthProperty
>> Domain:Value 0433c738:NotInit 06f529d8:04f5a1bc <<
047d7404 40000f8 4c ...ependencyProperty 0 shared static HeightProperty
>> Domain:Value 0433c738:NotInit 06f529d8:04f5a1d0 <<
047d7404 40000f9 50 ...ependencyProperty 0 shared static MinWidthProperty
>> Domain:Value 0433c738:NotInit 06f529d8:04f5a1e4 <<
047d7404 40000fa 54 ...ependencyProperty 0 shared static MaxWidthProperty
>> Domain:Value 0433c738:NotInit 06f529d8:04f5a1f8 <<
047d7404 40000fb 58 ...ependencyProperty 0 shared static MinHeightProperty
>> Domain:Value 0433c738:NotInit 06f529d8:04f5a20c <<
047d7404 40000fc 5c ...ependencyProperty 0 shared static MaxHeightProperty
>> Domain:Value 0433c738:NotInit 06f529d8:04f5a220 <<
047d7404 40000fd 60 ...ependencyProperty 0 shared static HorizontalAlignmentProperty
>> Domain:Value 0433c738:NotInit 06f529d8:04f5a234 <<
047d7404 40000fe 64 ...ependencyProperty 0 shared static VerticalAlignmentProperty
>> Domain:Value 0433c738:NotInit 06f529d8:04f5a248 <<
047d7404 40000ff 68 ...ependencyProperty 0 shared static MarginProperty
>> Domain:Value 0433c738:NotInit 06f529d8:04f5a25c <<
047d7404 4000100 6c ...ependencyProperty 0 shared static StyleProperty
>> Domain:Value 0433c738:NotInit 06f529d8:04f5a284 <<
047d7404 4000101 70 ...ependencyProperty 0 shared static ParentProperty
>> Domain:Value 0433c738:NotInit 06f529d8:04f5a2ac <<
047d7404 4000102 74 ...ependencyProperty 0 shared static NameProperty
>> Domain:Value 0433c738:NotInit 06f529d8:04f5a2c0 <<
047d7404 4000103 78 ...ependencyProperty 0 shared static TagProperty
>> Domain:Value 0433c738:NotInit 06f529d8:04f5a2d4 <<
047d7404 4000104 7c ...ependencyProperty 0 shared static TagInternalProperty
>> Domain:Value 0433c738:NotInit 06f529d8:04f5a2fc <<
04851464 4000105 80 ...ndows.RoutedEvent 0 shared static LoadedEvent
>> Domain:Value 0433c738:NotInit 06f529d8:04f5a420 <<
047d7404 4000106 84 ...ependencyProperty 0 shared static CursorProperty
>> Domain:Value 0433c738:NotInit 06f529d8:04f5a440 <<
047d7404 4000107 88 ...ependencyProperty 0 shared static InstanceDelegateStoreProperty
>> Domain:Value 0433c738:NotInit 06f529d8:04f5a468 <<
047d7404 4000109 8c ...ependencyProperty 0 shared static DataContextProperty
>> Domain:Value 0433c738:NotInit 06f529d8:04f5a494 <<
047a1e2c 400010e 90 ...rence, mscorlib]] 0 shared static _staticDelegateList
>> Domain:Value 0433c738:NotInit 06f529d8:00000000 <<
00000000 4000264 30 ...angedEventHandler 0 instance 00000000 IsEnabledChanged
047d7404 4000252 430 ...ependencyProperty 0 shared static IsTabStopProperty
>> Domain:Value 0433c738:NotInit 06f529d8:04f59ce4 <<
047d7404 4000253 434 ...ependencyProperty 0 shared static TabIndexProperty
>> Domain:Value 0433c738:NotInit 06f529d8:04f59cf8 <<
047d7404 4000254 438 ...ependencyProperty 0 shared static TemplateProperty
>> Domain:Value 0433c738:NotInit 06f529d8:04f59d20 <<
047d7404 4000255 43c ...ependencyProperty 0 shared static TabNavigationProperty
>> Domain:Value 0433c738:NotInit 06f529d8:04f59d48 <<
047d7404 4000256 440 ...ependencyProperty 0 shared static PaddingProperty
>> Domain:Value 0433c738:NotInit 06f529d8:04f59d70 <<
047d7404 4000257 444 ...ependencyProperty 0 shared static HorizontalContentAlignmentProperty
>> Domain:Value 0433c738:NotInit 06f529d8:04f59d98 <<
047d7404 4000258 448 ...ependencyProperty 0 shared static VerticalContentAlignmentProperty
>> Domain:Value 0433c738:NotInit 06f529d8:04f59dc0 <<
047d7404 4000259 44c ...ependencyProperty 0 shared static BackgroundProperty
>> Domain:Value 0433c738:NotInit 06f529d8:04f59de8 <<
047d7404 400025a 450 ...ependencyProperty 0 shared static BorderBrushProperty
>> Domain:Value 0433c738:NotInit 06f529d8:04f59dfc <<
047d7404 400025b 454 ...ependencyProperty 0 shared static BorderThicknessProperty
>> Domain:Value 0433c738:NotInit 06f529d8:04f59e10 <<
047d7404 400025c 458 ...ependencyProperty 0 shared static FontSizeProperty
>> Domain:Value 0433c738:NotInit 06f529d8:04f59e24 <<
047d7404 400025d 45c ...ependencyProperty 0 shared static FontFamilyProperty
>> Domain:Value 0433c738:NotInit 06f529d8:04f59e4c <<
047d7404 400025e 460 ...ependencyProperty 0 shared static ForegroundProperty
>> Domain:Value 0433c738:NotInit 06f529d8:04f59e60 <<
047d7404 400025f 464 ...ependencyProperty 0 shared static FontWeightProperty
>> Domain:Value 0433c738:NotInit 06f529d8:04f59e88 <<
047d7404 4000260 468 ...ependencyProperty 0 shared static FontStyleProperty
>> Domain:Value 0433c738:NotInit 06f529d8:04f59eb0 <<
047d7404 4000261 46c ...ependencyProperty 0 shared static FontStretchProperty
>> Domain:Value 0433c738:NotInit 06f529d8:04f59ed8 <<
047d7404 4000262 470 ...ependencyProperty 0 shared static DefaultStyleKeyProperty
>> Domain:Value 0433c738:NotInit 06f529d8:04f59eec <<
047d7404 4000263 474 ...ependencyProperty 0 shared static IsEnabledProperty
>> Domain:Value 0433c738:NotInit 06f529d8:04f59f00 <<
04857f14 4000265 478 ... System.Windows]] 0 shared static _resourceDictionaryCache
>> Domain:Value 0433c738:NotInit 06f529d8:04f5cae4 <<
03cf5668 4000266 47c System.Object[] 0 shared static _controlDelgates
>> Domain:Value 0433c738:NotInit 06f529d8:04f59f14 <<
03cf44e8 40002b4 34 System.Object 0 instance 00000000 _treeContent
047d7404 40002b3 530 ...ependencyProperty 0 shared static ContentTemplateProperty
>> Domain:Value 0433c738:NotInit 06f529d8:04f5bd30 <<
047d7404 40002b5 534 ...ependencyProperty 0 shared static ContentProperty
>> Domain:Value 0433c738:NotInit 06f529d8:04f5bd44 <<
03d50f28 40005aa 40 System.Boolean 1 instance 1 _isLoaded
03d50f28 40005ab 41 System.Boolean 1 instance 1 _isMouseCaptured
03d50f28 40005ac 42 System.Boolean 1 instance 0 _isSpaceKeyDown
03d50f28 40005ad 43 System.Boolean 1 instance 0 _isMouseLeftButtonDown
04852208 40005ae 48 System.Windows.Point 1 instance 04f5b990 _mousePosition
048b5f98 40005af 38 ...mation.Storyboard 0 instance 00000000 _currentState
03d50f28 40005b0 44 System.Boolean 1 instance 0 _suspendStateChanges
0481fae0 40005b1 3c ...outedEventHandler 0 instance 04f5ca18 Click
047d7404 40005a6 7e0 ...ependencyProperty 0 shared static ClickModeProperty
>> Domain:Value 0433c738:NotInit 06f529d8:04f5ba7c <<
047d7404 40005a7 7e4 ...ependencyProperty 0 shared static IsFocusedProperty
>> Domain:Value 0433c738:NotInit 06f529d8:04f5bb38 <<
047d7404 40005a8 7e8 ...ependencyProperty 0 shared static IsMouseOverProperty
>> Domain:Value 0433c738:NotInit 06f529d8:04f5bbd8 <<
047d7404 40005a9 7ec ...ependencyProperty 0 shared static IsPressedProperty
>> Domain:Value 0433c738:NotInit 06f529d8:04f5bc40 <<

// dump button.Click field (9 lines above)
0:005> !do 04f5ca18
Name: System.Windows.RoutedEventHandler
MethodTable: 0481fae0
EEClass: 0482c99c
Size: 32(0x20) bytes
File: c:\Program Files\Microsoft Silverlight\2.0.31005.0\System.Windows.dll
Fields:
MT Field Offset Type VT Attr Value Name
03cf44e8 40001e0 4 System.Object 0 instance 04f59c78 _target
04663c58 40001e1 8 ...ection.MethodBase 0 instance 00000000 _methodBase
03d50a90 40001e2 c System.IntPtr 1 instance 463c08c _methodPtr
03d50a90 40001e3 10 System.IntPtr 1 instance 0 _methodPtrAux
03cf44e8 40001e4 14 System.Object 0 instance 00000000 _invocationList
03d50a90 40001e5 18 System.IntPtr 1 instance 0 _invocationCount

0:005> !do -nofields 04f59c78 // verify _target is page
Name: SilverlightApplication1.Page
MethodTable: 04633a6c
EEClass: 0463196c
Size: 68(0x44) bytes
File: SilverlightApplication1, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null

// verify _methodPtr points to Button_Click
// see how they are all linked together
0:005> ln 463c08c
(0463c08c) SilverlightApplication1.Page.Button_Click(System.Object, System.Windows.RoutedEventArgs)
0:005> u 463c08c // jit-ed method stub
SilverlightApplication1.Page.Button_Click(System.Object, System.Windows.RoutedEventArgs):
0463c08c b8303a6304 mov eax,4633A30h
0463c091 89ed mov ebp,ebp
0463c093 e900431c00 jmp SilverlightApplication1!Button_Click ( 04800398 )
0463c098 0000 add byte ptr [eax],al
0463c09a 0000 add byte ptr [eax],al
0463c09c 0000 add byte ptr [eax],al
0463c09e 0000 add byte ptr [eax],al
0463c0a0 0000 add byte ptr [eax],al
0:005> u eip // jit-ed native code
SilverlightApplication1!Button_Click:
04800398 55 push ebp
04800399 8bec mov ebp,esp
0480039b 83ec08 sub esp,8
0480039e 894dfc mov dword ptr [ebp-4],ecx
048003a1 8955f8 mov dword ptr [ebp-8],edx
048003a4 833d7435630400 cmp dword ptr ds:[4633574h],0
048003ab 7405 je SilverlightApplication1!Button_Click+0x1a (048003b2)
048003ad e8862a895f call coreclr!JIT_DbgIsJustMyCode (64092e38)
0:005> !ip2md 04800398
MethodDesc: 04633a30
Method Name: SilverlightApplication1.Page.Button_Click(System.Object, System.Windows.RoutedEventArgs)
Class: 0463196c
MethodTable: 04633a6c
mdToken: 06000008
Module: 046333b4
IsJitted: yes
CodeAddr: 04800398
0:005> !dumpil 04633a30
ilAddr = 047e03fe
IL_0000: nop
IL_0001: ret

When I have time, I may write a blog post on CLR internals, to demonstrate how objects are laid out in memory, how method calls are dispatched etc.

Abschluss

Das ist ein langer Beitrag, aber es kaum bilden einen Überblick über WinDbg und SOS. Gutes Verständnis der CLR ist für Programmierung und Fehlersuche wichtig, WinDbg mit SOS ist das beste Werkzeug, um CLR zu erforschen und zu tun erweiterte Debugging. Hope this kurzen noch lange post hilft Ihnen bei der Erforschung CLR und Silverlight loslegen. Vielen Dank!

Technorati Tags: , , , ,