Using NTSD

Before using NTSD, follow these steps:

  1. Compile your program using the /Zi option. This generates debugger symbol information for your .EXE file.
  2. Link your program using the /debug:full and /debugtype:coff options.

To start debugging your program with NTSD, type:

ntsd yourexename.exe

This starts NTSD in the current console window and loads the application specified by yourexename.exe. From the NTSD prompt, set any initial breakpoints with the bp command, and use the g command to start the application. Program execution begins at the current code address. You can use the s+ command to change to source mode or the s& command to change to mixed mode.

If the application hits a breakpoint or has an access violation, you will be returned to the NTSD prompt. It is often handy to run NTSD on the kernel debugging computer. This allows you to continue to watch the NTSD screen while the application is running; you can break into NTSD with CTRL+C. To start NTSD with its display redirected to KD, enter

ntsd -d appname
 

To break into NTSD, use the minus key (below PRINT SCREEN) on an 84-key keyboard; on a 101/102-key keyboard, use f12.

On invocation of NTSD, you can use the g command to go past the first breakpoint automatically. For example, the command line

ntsd -g ls
 

causes NTSD to pass control to ls, which executes until it terminates or until an exception causes NTSD to take control.