Debugging Applications for MicrosoftВ® .NET and Microsoft WindowsВ® (Pro-Developer)
|
D
daily builds, 67–68
data breakpoints, 277–280
data corruption, 7
data manipulation instructions (x86), 327–329
data truncation assignment checking (/RTCc switch), 708
DBG files, 201
DBGCHOOSER (Debugger Chooser), 166–168
CrashFinder with, 505
MiniDumpWriteDump function, 554–563
DBGPROXY service, 159, 299
DCOM project, uncommitted transactions with, 624
DCRT (debug C run-time) library, 667–676
features of, 668–669
new operator with, 671–674
release CRT library vs., 677–678
turning on, 670
useful functions, 675–676
DeadDetExt (DeadlockDetection extension), 598, 610
deadlines responsible for bugs, 8
DeadlockDetection utility, 595–624
DeadDetExt extension, 598, 610
future of, 624
high-level issues, 596–598
how to use, 598–601
implementing, 601–624
highlights of, 610–624
hooking imported functions, 601–610
requirements for, 595–596
deadlocks and multithreaded programming, 581–626
CreateThread and ExitThread functions, 588–589
DeadlockDetection utility, 595–624
DeadDetExt extension, 598, 610
future of, 624
high-level issues, 596–598
how to use, 598–601
implementing, 601–624
requirements for, 595–596
local storage, accessing, 337, 485
low-level multithreading, 583–587
multiprocessor machines, 592
names of threads, setting in native code, 276
obtaining thread identifiers, 240
TEB (thread environment block), 368
TIB (thread information block), 304, 336, 368
tips and tricks, 581–592
code reviews, 591
deadlock dumps in the field, 590
default memory manager, 589–590
discrete pieces, using, 583
minimizing amount of multithreading, 582
spinning critical sections, 587–588
testing on multiprocessor machines, 592
tracing performance, 718–719
debug builds, 67
installation programs for, 70
testing with, 70
debug C run-time (DCRT) library, 667–676
features of, 668–669
new operator with, 671–674
release CRT library vs., 677–678
turning on, 670
useful functions, 675–676
Debug class (System.Diagnostic), 95–97, 103–104
Debug Interface Access (DIA) SDK, 202
debug registers, 277
debug symbols, 42–46
native debugging, 298. See also native code
SWS utility, enumerating, 738–744
symbol servers, building, 71–81
symbol tables and engines (WDBG), 200–208
SymbolEngine project, 203
Watch window formatting, 280–283
WinDBG debugger, 357, 362–366
debug think, 603–604
DebugBreak function, 168, 573
debuggee, defined, 158
Debugger Chooser (DGBCHOOSER), 166–168
debugger proxy service, 299
Debugger value (AeDebug key), 164, 165
DEBUGGER.CHM help files, 356, 362
DebuggerHiddenAttribute attribute, 245
Debugger.Launch( ), 107–108
debuggers
automatically starting in, 168–170
debug registers, 277
debug symbols, 42–46
native debugging, 298. See also native code
SWS utility, enumerating, 738–744
symbol servers, building, 71–81
symbol tables and engines (WDBG), 200–208
SymbolEngine project, 203
Watch window formatting, 280–283
WinDBG debugger, 357, 362–366
debuggee, defined, 158
Dr. Watson, 493, 751–760
JIT (just-in-time) debugging, 164–168
crashing into debugger, 166–168
quick break keys, 165
.NET debuggers, 158
NTSD debugger, 354
proxy service for, 299
Visual Studio .NET debugger, 213–234
advanced breakpoints, 214–228
for ASP Web applications, 233
Disassembly window, 341–345
expanding types automatically, 241–243, 283–291
Memory window, 295, 346
native code, 269–291, 350
setting breakpoints in dynamically loaded DLLs, 301
Watch windows, 228–233, 280–283
WDBG debugger, 190–210
breakpoints and single stepping, 195–200
debug symbols, 357, 362–366
future of, 211–212
reading and writing memory, 192–195
stepping functionality, 209–210
symbols and stack walking, 200–208
WinDBG (Windows Debugger), 162, 353–404, 556
basic issues, 356–359
breakpoints, 379–382
command parameters, 362
command-line arguments, changing, 360
commands, types of, 361
control commands, 385–386
dump files, handling, 393–396
evaluating variables, 372–373
exceptions and events, 382–384
executing, stepping, tracing, 373–378
extension commands, 386–393
getting help, 361–362
processes and threads, 366–371
SOS extension support, 396–403
symbol handling, 357, 362–366
Windows debuggers, 159–164
kernel-mode, 161–164
user-mode, 159–160
writing your own, 210–211
DebuggerStepThroughAttribute attribute, 245
debugging. See also debuggers
during coding (proactive programming), 83–154
assertions, 85–142
commenting, 149–150
tracing, 142–148
unit testing, 35, 84, 151–153, 627–665
memory, with DCRT library, 667–676. See also memory
features of, 668–669
new operator with, 671–674
release CRT library vs., 677–678
turning on, 670
useful functions, 675–676
memory, with MemDumperValidator extension, 678–694. See also memory
C classes, 686–687
C++ classes, 685–686
deep validations, 687–688
implementing, 691–694
memory, with MemStress extension, 694–697. See also memory
mixed-mode, 246–247
plans for, 18
policies, 41
requirements for, 19–22
server applications with FastTrace, 148, 717–722
implementation, 721–722
merging trace logs, 720–721
step-by-step process of, 22–30
string processing, 713
tools for, 20, 27, 33–40, 354–355
windows services, 568–575
Allow Service To Interact With Desktop, 570
attaching to processes, 571–575
core code, 569
service identity, setting, 571
startup code, 575
Debugging Tools for Windows package, 354–355
DebugView utility, 143, 575
DEC instruction (x86), 328
DECLARE_MEMDEBUG macro, 685
decorated names, 498
deep validations, MemDumperValidator extension, 687–688
default memory manager, 589–590
default workspace, WinDBG, 358
DefaultTraceListener class, 96–100
defensive (proactive) programming, 83–154
assertions, 85–142
ASP.NET applications and web services, 103–113
how to assert, 88–89
ignoring, 126–127
native C++ applications, 113–142
.NET applications, 95–103
what to assert, 86–87, 89–95
commenting, 149–150
assertions as documentation, 85
tracing, 142–148
ASP.NET applications and web services, 146–148
DCRT library assertion support, 668
Event Tracing system, 66
EventLogTraceListener class, 97
FastTrace utility, 717–722
flow tracing (Profiler API), 479, 484–488
native C++ applications, 148
.NET applications, 144–146
performance of, 718–719
TraceListener class, 96–103, 144
WinDBG debugger, 373–378
unit testing, 35, 84, 151–153, 627–665
implementing, 638–665
manual, 627–628
scripts for, 630–635
scheduling, 634
Delete Alias command (WinDBG), 379
Demeanor for .NET utility, 251, 768
descriptions, bug, 25
.DETACH command (WinDBG), 370
Detach from Process command (WinDBG), 370
detaching from processes
WinDBG, 370
Windows 2000, 299
Detect 64-Bit Portability Issues setting, 60
developers
resources for, 761–769
role of, 84
DevPartner utility, 768
DIA (Debug Interface Access) SDK, 202
Dilascia, Paul, 766
disassembler, writing, 210
Disassembly window (Visual Studio .NET debugger), 341–345
garbage code, 350
walking the stack manually, 346–347
Display Local Variables command (WinDBG), 372–373
Display Stack Backtrace command (WinDBG), 372
Display Type command (WinDBG), 373
Display Variables command (WinDBG), 366
DIV instruction (x86), 328
divide-and-conquer approach, 25
DllMain function, 594
DLLs
CRT libraries, DLL versions of, 677–678
determining which come into address space, 576
knowing where they load, 52–57
rebasing, 52, 54–57
Do Child Focus Attempt In Scripts option (Tester), 636
DocComment property (code elements), 417
docking tool windows (add-ins), 430
documentation
assertions as, 85
commenting code, 149–150
comments, macro for, 415–423
dot (meta) commands, WinDBG, 361, 385–386. See also specific commands by name
Dotfuscator utility, 250
Douglas, Frank, 763
Dr. Watson, 493, 751–760
!dreg extension command (WinDBG), 392
DT command (WinDBG), 373
.DUMP command (WinDBG), 393–394
dump files (core dumps), 71
compressing WinDBG dumps into CAB files, 394, 396
full dumps, 393
MemDumperValidator extension (BUGSLAYERUTIL.DLL), 678–694
C classes, 686–687
C++ classes, 685–686
deep validations, 687–688
dump files (core dumps), MemDumperValidator
implementing, 691–694
initialization and termination in C++, 692–693
minidumps, 71, 300
Create Mini Dump button (SUPERASSERT), 123, 299–301
deadlock dumps in the field, 590
garbage code (disassembled code), 350
MiniDumpFilterMemory function, 555
MiniDumpFilterMemoryPaths function, 555
MiniDumpWithHandleData function, 555
MiniDumpWriteDump function, 554–563
SnapCurrentProcessMiniDump function, 556, 590
WinDBG debugger, 358, 394
writing, 394, 553–563
native code, 299–301
SOS (Son of Strike), 235, 396–403
WinDBG debugger, handling with, 393–396
creating dump files, 393–394
debugging dump files, 396
extension commands, 400–402
opening dump files, 395–396
.DUMPCAB command (WinDBG), 396
!dumpclass extension command (WinDBG), 401
!dumpmodule extension command (WinDBG), 401
!dumpmt extension command (WinDBG), 400
!dumpobj extension command (WinDBG), 401
!dumpstack extension command (WinDBG), 400
!dumpstackobjects extension command (WinDBG), 402
Duncan, Christopher, 762
duplicating bugs, 24
DV command (WinDBG), 366, 372–373
dynamically loaded DLLs, breakpoints in, 301
|