CSCI E-143 CertPrep: Debugging (Kalani, chapter 12)
Saturday, Oct. 2, 2004
This Saturday we go through Kalani's chapter 12, Debugging. The important pages are 783-802. You have to know all about Debug and Trace settings and output, and how to control it all. Every test I've seensample and realjust loves this stuff. I don't know why.
To demonstrate the various debugging windows and features, we will use the following breathtaking example of the programmer's art:
private void crash()
{
int j = 0;
for (int i=1; i<=100; i++)
{
j = 100/(90-i);
}
}
Now, don't write in and tell me there's a bug in this. I
know there's a bug in it. That's the point. See you Saturday.
Here are some of the things from this chapter that you must know:
- Debug vs. Release
- How to control Debug: #define DEBUG, the compiler settings,
etc., etc., etc.
- No Debug output in Release mode
- No breakpoints active in Release mode
- The requirements for getting a breakpoint to break execution
there are at least four:
- Compile under Debug
- Set a breakpoint
- Make sure the breakpoint is enabled
- Start the debugger
- In general, when do you get Debug and Trace output?
- The three (or maybe four) kinds of Listeners
- How to attach Listeners and when they get output
- Conditional compilation with
#if and its relatives
- The seven debugging windows (remember?) and what each one displays
- How do you go about debugging things other than your own program?
(We didn't demonstrate this; but you only have to know in general terms)
- How to go about debugging an SQL stored procedure
- How to go about debugging a running procedure
- How to go about debugging a remote routine, and the requirements for
doing so
- what security / trust must exist between the machines
- you must be in the remote's "DebuggersUsersGroup"
- "mdm.exe" (debug manager) must be present on remote machine
- Trace switches
- How do you create a .config file?
- Exactly what kind of Trace switches are there?
- How do you set Trace switches in the
.config file?
- How are Trace switches interpreted in your program?
Here are the relevant questions from the two tests at the end
of the "short Kalani" book:
Test 1: questions
42 (page 376; answer: page 396),
43, 44, 45, 48, 58, 59, 60.
Test 2: questions
1 (page 402; answer: page 438),
2, 5, 9, 18, 19, 21.
(Some of these questions may duplicate those in long Kalani.
Both texts are listed
here.)
Last revised Oct. 14, 2004