Debugging Applications for MicrosoftВ® .NET and Microsoft WindowsВ® (Pro-Developer)
|
C
C++
assertions in C++ applications, 113–142
types, 118–142
VERIFY macro, 116
debug symbols in projects, 43
decorated names, 498
exception handling, 514, 518–525
catch (...) construct, 520–524
_set_se_translator API, 524–525
tracing, 148
C#
compiler errors, 46–48
compiler options, 58
documentation comments, 415–423
turning on debug symbols, 42
C7 (CodeView) format, 201
CAB files, compressing WinDBG dumps into, 394, 396
call instruction (ILDASM), 265
CALL instruction (x86), 315–316
Call Stack window (Visual Basic .NET Debugger), 216
call stacks, 65
calling conventions (x86), 316–322
calling methods in Watch windows, 230–233
callvirt instruction (ILDASM), 265
catch blocks, 476
catch (...) construct, 520–524
catch keyword, 518
CBreakpoint class, 280
C-Cover utility, 768
CDB.EXE utility, 355
__cdecl call (x86), 317, 318
ceq instruction (ILDASM), 262
CFTL approach, 9–10
cgt instruction (ILDASM), 262
.CHAIN command (WinDBG), 387
character limit on debugging information, 291
Check For Arithmetic Overflow/Underflow property, 58
/checked switch (C# compiler), 58
checking (reviewing) code, 15, 36
assertions, 90. See also condition checking
heap checking, 697–699
integer underflow/overflow checking, 58
memory leak checking, 7
without utilities, 727
MemDumperValidator extension, 678–694
memory overruns, 701–707
multithreaded programming, 591. See also threading
operating system heap checking, 697–699
run-time checking, 61
CheckNotification method, 633
child breakpoints, 222
child processes, debugging (WinDBG), 366–367
Choose Breakpoints dialog box (Visual Studio .NET debugger), 220–221
CL.EXE switches, 59–62
Clark, Jason D., 767
class references (x86), 338
ClassDumper method, 686
Clear Screen command (WinDBG), 385
_CLIENT_BLOCK identifier, 679
Close Log File command (WinDBG), 375
CLR debugging, 160, 257
!clrstack extension command (WinDBG), 399
.CLS command (WinDBG), 385
clt instruction (ILDASM), 262
CMP instruction (x86), 329
CMPS instruction (x86), 333
code, profiling, 455–465
flow tracing, 479, 484–488
in-process debugging, 469–474
Profiling API, 455–465
code, tracing, 142–148
ASP.NET applications, 146–148
DCRT library assertion support, 668
Event Tracing system, 66
EventLogTraceListener class, 97
FastTrace utility, 717–722
implementation, 721–722
merging trace logs, 720–721
flow tracing (Profiler API), 479, 484–488
native C++ applications, 148
.NET applications, 144–146
performance of, 718–719
TraceListener class, 96–103, 144
web services, 146–148
WinDBG debugger, 373–378
code, tracking
bugs, 38–40
heap memory (DCRT library), 667–676
features of, 668–669
new operator, 671–674
release CRT library vs., 677–678
turning on, 670
useful functions, 675–676
object lifetime, 524
version control, 33–38, 40
labeling, 37
when to make changes, 36–37
code, writing
code coverage, 27, 152–153
code elements in macros, 413–415
"Code First, Think Later" approach, 9–10
code freeze, 36, 38
defensively (proactive coding), 83–154
assertions, 85–142
commenting, 85, 149–150
tracing, 142–148
unit testing, 35, 84, 151–153, 627–665
reviewing code, 15, 36
assertions, 85–142
heap checking, 697–699
integer underflow/overflow checking, 58
memory leak checking, 7, 727, 678–694
memory overruns, 701–707
multithreaded programming, 591. See also threading
operating system heap checking, 697–699
run-time checking, 61
stepping through
DebuggerStepThroughAttribute attribute, 245
SetSingleStep function, 198
WDBG debugger, 195–210
WinDBG debugger, 373–378
Code Model property, 412
CodeView (C7) format, 201
COFF (Common Object File Format), 201
Cogswell, Bryce, 168, 574, 769
Cohen, Danny, 350
COM+ services, debugging, 569
Command Help command (WinDBG), 361
Command Shell command (WinDBG), 385
Command window, WinDBG, 360
executing macros from, 410. See also entries at macros
processes, creating, 369
processes and threads, viewing, 367–369
CommandPreload registry key, 426
commands, WinDBG, 360–362
CommenTater macro, 415–423
commenting, 149–150
assertions as documentation, 85
CommenTater macro, 415–423
commitment to quality, 15–17
Common Object File Format (COFF), 201
comparison instructions
ILDASM, 262
x86, 329
compilers
compiler option (#pragma init_seg), 693
errors, 46–48
switches for debugging native code, 59–62
condition checking (assertions), 85–142
ASP.NET applications and services, 103–113
DCRT assertion support, 668
how to assert, 88–89
ignoring, 126–127
native C++ applications, 113–142
types of assertions, 118–142
VERIFY macro, 116
.NET applications, 95–103
what to assert, 86–95
conditional command execution, WinDBG, 381
conditional expressions. See also condition checking
assertion methods, 90
constants in conditional statements, 142
location breakpoints, 226–227, 236–240
native code, 274–275
WinDBG command execution, 381
conditionally compiled assertion methods, 90
console applications
assertions, 95–103
tracing, 144–146
constants, placement in conditional statements, 142
ContinueDebugEvent function, 172
conv instruction (ILDASM), 263
Copy to Clipboard button (SUPERASSERT), 123
CORDBG.EXE debugger, wt command, 244, 479
core code of services, debugging, 569
core dumps (dump files), 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
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
Cor_Enable_Profiling environment variable, 463
Cor_Profiler environment variable, 463
corrupt data, 7
CPU basics, 21, 303
crash address, using, 491–512
CrashFinder utility, 502–511
MAP files, 63
creating and reading, 493–501
extracting information from, 498–499
PDB2MAP utility, 499–501
understanding contents of, 495–498
crash dumps. See core dumps
crash handlers, 513–564
CrashFinder utility, 502–511
CrashHandler API, 527–551
EXCEPTION_POINTERS structures, translating, 551–553
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
SetUnhandledExceptionFilter function, 525–527
crashes, 7. See also crash handlers
DLL base addresses, knowing, 52–54
dumps. See core dumps
minidumps. See minidumps
starting debugger at, 166–168
using the crash address, 491–512
CrashFinder utility, 502–511
MAP files, 493–501
CrashFinder utility, 502–511
CrashHandler API, 527–551
.CREATE command (WinDBG), 369
Create Dump File CAB command (WinDBG), 396
Create Dump File command (WinDBG), 393–394
Create Mini Dump button (SUPERASSERT), 123, 299–301
Create Process command (WinDBG), 369
CreateProcess function, 171
CREATE_PROCESS_DEBUG_EVENT event, 173
CreateRemoveThread function, 199
CreateThread function, not using, 588–589
CREATE_THREAD_DEBUG_EVENT event, 174
creative bug hunting, 26–27
critical sections, spinning, 587–588
!critsecextension command (WinDBG), 388
CRT libraries, comparison of, 677–678
_CRT_BLOCK identifier, 679
_CrtCheckMemory function, 675
_CRTDBG flags, 670
_CrtIsMemoryBlock function, 675
_CrtIsValidHeapPointer function, 675
_CrtIsValidPointer function, 675
_CrtMemBlockHeader structure, 691
_CrtMemDifference function, 676
_CrtMemDumpStatistics function, 676
CSC.RSP file, ignoring, 58
CUseCriticalSection class, 583, 586
custom debuggers, writing, 210–211
|