CDB Command-Line Options

First-time users of CDB or NTSD should begin with the Debugging Using CDB and NTSD section.

The CDB command line uses the following syntax:


cdb  [ -server ServerTransport | -remote ClientTransport ] 
[ -premote SmartClientTransport ] [-log{a|au|o|ou} LogFile]
[-2] [-d] [-ddefer] [-g] [-G] [-hd] [-lines] [-myob] [-bonc]
[-n] [-o] [-s] [-v] [-w] [-cf "filename"] [-cfr "filename"] [-c "command"] 
[-robp] [-r BreakErrorLevel]  [-t PrintErrorLevel] 
[ -x{e|d|n|i} Exception ] [-x] [-clines lines] 
[-i ImagePath]  [-y SymbolPath] [-srcpath SourcePath] 
[-aExtension] [-failinc] [-noio] [-noinh] [-noshell]
[-sdce] [-ses] [-sicv] [-sins] [-snc] [-snul] [-zp PageFile] 
[-sup] [-sflags 0xNumber] [-ee {masm|c++}]
[-e Event] [-pb] [-pd] [-pe] [-pr] [-pt Seconds] [-pv] 
[ -- | -p PID | -pn Name | -psn ServiceName | -z DumpFile | executable ] 
[-cimp] [-isd] [-kqm] [-pvr] [-version] 

cdb -iae 

cdb -iaec KeyString 

cdb -iu KeyString

cdb -QR Server 

cdb -wake pid 

cdb -?

The NTSD command-line syntax is identical to that of CDB:


ntsd  [ -server ServerTransport | -remote ClientTransport ] 
[ -premote SmartClientTransport ] [-log{a|au|o|ou} LogFile]
[-2] [-d] [-ddefer] [-g] [-G] [-hd] [-lines] [-myob] [-bonc]
[-n] [-o] [-s] [-v] [-w] [-cf "filename"] [-cfr "filename"] [-c "command"] 
[-robp] [-r BreakErrorLevel]  [-t PrintErrorLevel] 
[ -x{e|d|n|i} Exception ] [-x] [-clines lines] 
[-i ImagePath]  [-y SymbolPath] [-srcpath SourcePath] 
[-aExtension] [-failinc] [-noio] [-noinh] [-noshell]
[-sdce] [-ses] [-sicv] [-sins] [-snc] [-snul] [-zp PageFile] 
[-sup] [-sflags 0xNumber] [-ee {masm|c++}] 
[-e Event] [-pb] [-pd] [-pe] [-pr] [-pt Seconds] [-pv] 
[ -- | -p PID | -pn Name | -psn ServiceName | -z DumpFile | executable ] 
[-cimp] [-isd] [-kqm] [-pvr] [-version] 

ntsd -iae 

ntsd -iaec KeyString 

ntsd -iu KeyString

ntsd -QR Server 

ntsd -wake PID 

ntsd -?

The only difference between NTSD and CDB is that NTSD spawns a new console window while CDB inherits the window from which it was invoked. Since the start command can also be used to spawn a new console window, the following two constructions will give the same results:


start cdb [parameters]
ntsd [parameters]

Descriptions of the CDB and NTSD command-line options follow. Only the -remote, -server, -g and -G options are case-sensitive. The initial hyphen can be replaced with a forward-slash (/). Options that do not take any additional parameters can be concatenated -- so cdb -o -d -G -g winmine can be written as cdb -odGg winmine.

If the -remote or -server option is used, it must appear before any other options on the command line. If an executable is specified, it must appear last on the command line; any text after the executable name is passed to the executable program as its own command-line parameters.

Parameters

-server ServerTransport

Creates a debugging server that can be accessed by other debuggers. For an explanation of the possible ServerTransport values, see Activating a Debugging Server. When this parameter is used, it must be the first parameters on the command line.

-remote ClientTransport

Creates a debugging client, and connects to a debugging server that is already running. For an explanation of the possible ClientTransport values, see Activating a Debugging Client. When this parameter is used, it must be the first parameters on the command line.

-premote SmartClientTransport

Creates a smart client, and connects to a process server that is already running. For an explanation of the possible SmartClientTransport values, see Activating a Smart Client.

-2

If the target application is a console application, this option causes it to live in a new console window. (The default is for a target console application to share the window with CDB or NTSD.)

--

Debugs the Client Server Run-Time Subsystem (CSRSS). For details, see Debugging CSRSS.

-a Extension

Sets the default extension DLL. The default is userexts. There must be no space after the "a", and the .dll extension must not be included. For details, and other methods of setting this default, see Loading Debugger Extension DLLs.

-bonc

If this option is specified, the debugger will break into the target as soon as the session begins. This is especially useful when connecting to a debugging server that might not be currently broken into the target.

-c " command "

Specifies the initial debugger command to run at start-up. This command must be surrounded with quotation marks. Multiple commands can be separated with semicolons. (If you have a long command list, it may be easier to put them in a script and then use the -c option with the $<, $><, $><, $$>< (Run Script File) command.)

If you are starting a debugging client, this command must be intended for the debugging server. Client-specific commands such as .lsrcpath are not allowed.

-cf " filename "

Specifies the path and name of a script file. This script file is executed as soon as the debugger is started. If filename contains spaces it must be enclosed in quotation marks. If the path is omitted, the current directory is assumed. If the -cf option is not used, the file ntsd.ini in the current directory is used as the script file. If the file does not exist, no error occurs. For details, see Using Script Files.

-cfr " filename "

Specifies the path and name of a script file. This script file is executed as soon as the debugger is started, and any time the target is restarted. If filename contains spaces it must be enclosed in quotation marks. If the path is omitted, the current directory is assumed. If the file does not exist, no error occurs. For details, see Using Script Files.

-cimp

Directs CDB/NTSD to start with a DbgSrv implicit command line instead of an explicit process to run. This option is the client side of dbgsrv -pc.

-clines lines

Sets the approximate number of commands in the command history which can be accessed during remote debugging. For details, and for other ways to change this number, see Using Debugger Commands.

-d

Passes control of this debugger to the kernel debugger. If you are debugging CSRSS, this control redirection always is active, even if -d is not specified. (This option cannot be used during remote debugging -- use -ddefer instead.) See Controlling the User-Mode Debugger from the Kernel Debugger for details. This option cannot be used in conjunction with either the -ddefer option or the -noio option.

Note  If you use WinDbg as the kernel debugger, many of the familiar features of WinDbg are not available in this scenario. For example, you cannot use the Locals window, the Disassembly window, or the Call Stack window, and you cannot step through source code. This is because WinDbg is only acting as a viewer for the debugger (NTSD or CDB) running on the target computer.

-ddefer

Passes control of this debugger to the kernel debugger, unless a debugging client is connected. (This is a variation of -d that can be used from a debugging server.) See Controlling the User-Mode Debugger from the Kernel Debugger for details. This option cannot be used in conjunction with either the -d option or the -noio option.

-e Event

Signals the debugger that the specified event has occurred. This option is only used when starting the debugger programmatically.

-ee {masm|c++}

Sets the default expression evaluator. If masm is specified, MASM expression syntax will be used. If c++ is specified, C++ expression syntax will be used. If the -ee option is omitted, MASM expression syntax is used as the default. See Evaluating Expressions for details.

-failinc

Causes the debugger to ignore any questionable symbols. When debugging a user-mode or kernel-mode minidump file, this option will also prevent the debugger from loading any modules whose images can't be mapped. For details and for other methods of controlling this, see SYMOPT_EXACT_SYMBOLS.

-g

Ignores the initial breakpoint in target application. This option will cause the target application to continue running after it is started or CDB attaches to it, unless another breakpoint has been set. See Initial Breakpoint for details.

-G

Ignores the final breakpoint at process termination. By default, CDB stops during the image run-down process. This option will cause CDB to exit immediately when the child terminates. This has the same effect as entering the command sxd epr. For more information, see Controlling Exceptions and Events.

-hd

(Microsoft Windows XP and later) Specifies that the debug heap should not be used. See Debugging a User-Mode Process Using CDB for details.

-i ImagePath

Specifies the location of the executables that generated the fault. If the path contains spaces, it should be enclosed in quotation marks.

-iae

Installs CDB as the postmortem debugger. For details, see Enabling Postmortem Debugging.

If this action succeeds, no message is displayed; if it fails, an error message is displayed.

The -iae parameter must not be used with any other parameters. This command will not actually start CDB.

-iaec KeyString

Installs CDB as the postmortem debugger. The contents of KeyString will be appended to the end of the AeDebug registry key. If KeyString contains spaces, it must be enclosed in quotation marks. For details, see Enabling Postmortem Debugging.

If this action succeeds, no message is displayed; if it fails, an error message is displayed.

The -iaec parameter must not be used with any other parameters. This command will not actually start CDB.

-isd

Turns on the CREATE_IGNORE_SYSTEM_DEFAULT flag for any process creations.

-iu KeyString

Registers debugger remoting as an URL type so that users can auto-launch a debugger remote client with an URL. KeyString has the format remdbgeng://RemotingOption. RemotingOption is a string that defines the transport protocol as defined in the topic Activating a Debugging Client. If this action succeeds, no message is displayed; if it fails, an error message is displayed.

The -iu parameter must not be used with any other parameters. This command will not actually start CDB.

-kqm

Starts CDB/NTSD in quiet mode.

-lines

Enables source line debugging. If this option is omitted, the .lines (Toggle Source Line Support) command will have to be used before source debugging will be allowed. For other methods of controlling this, see SYMOPT_LOAD_LINES.

-log{a|au|o|ou} LogFile

Begins logging information to a log file. If the specified file already exists, it will be overwritten if -logo is used, or output will be appended to the file if -loga is used. The -logau and -logou options operate similar to -loga and -logo respectively, except that the log file is a Unicode file. For more details, see Keeping a Log File in CDB.

-myob

If there is a version mismatch with dbghelp.dll, the debugger will continue to run. (Without the -myob switch, this is considered a fatal error.)

-n

Noisy symbol load: Enables verbose output from the symbol handler. For details and for other methods of controlling this, see SYMOPT_DEBUG.

-noinh

Prevents processes created by the debugger from inheriting handles from the debugger. For other methods of controlling this, see Debugging a User-Mode Process Using CDB.

-noio

Prevents the debugging server from being used for input or output. Input will only be accepted from the debugging client (plus any initial command or command script specified by the -c command-line option).

All output will be directed to the debugging client. If NTSD is used for the server, no console window will be created at all. For more details, see Activating a Debugging Server. This option cannot be used in conjunction with either the -d option or the -ddefer option.

-noshell

Prohibits all .shell commands. This prohibition will last as long as the debugger is running, even if a new debugging session is begun. For details, and for other ways to disable .shell commands, see Using Shell Commands.

-o

Debugs all processes launched by the target application (child processes). By default, processes created by the one you are debugging will run as they normally do. For other methods of controlling this, see Debugging a User-Mode Process Using CDB.

-p PID

Specifies the decimal process ID to be debugged. This is used to debug a process that is already running. For details, see Debugging a User-Mode Process Using CDB.

-pb

(Windows XP and later) Prevents the debugger from requesting an initial break-in when attaching to a target process. This can be useful if the application is already suspended, or if you wish to avoid creating a break-in thread in the target.

-pd

(Windows XP and later) Causes the target application not to be terminated at the end of the debugging session. See Ending a Debugging Session in CDB for details.

-pe

(Windows XP and later) Indicates that the target application is already being debugged. See Re-attaching to the Target Application for details.

-pn Name

Specifies the name of the process to be debugged. (This name must be unique.) This is used to debug a process that is already running.

-pr

(Windows XP and later) Causes the debugger to start the target process running when it attaches to it. This can be useful if the application is already suspended and you wish it to resume execution.

-psn ServiceName

Specifies the name of a service contained in the process to be debugged. This is used to debug a process that is already running.

-pt Seconds

Specifies the break time-out, in seconds. The default is 30. See Controlling the Target for details.

-pv

Specifies that the debugger should attach to the target process noninvasively. For details, see Noninvasive Debugging (User Mode).

-pvr

Works like -pv except that the target process is not suspended.

-QR Server

Lists all debugging servers running on the specified network server. The double backslash (\\) preceding Server is optional. See Searching for Debugging Servers for details.

The -QR parameter cannot be used with any other parameters. This command will not actually start CDB.

-r BreakErrorLevel

Specifies the error level that will cause the target to break into the debugger. This is a decimal number equal to 0, 1, 2, or 3. Possible values are as follows:

ValueConstantMeaning

0

NONE

Do not break on any errors.

1

ERROR

Break on ERROR level debugging events.

2

MINORERROR

Break on MINORERROR and ERROR level debugging events.

3

WARNING

Break on WARNING, MINORERROR, and ERROR level debugging events.

 

This error level only has meaning in checked builds of Microsoft Windows. The default value is 1.

-robp

This allows CDB to set a breakpoint on a read-only memory page. (The default is for such an operation to fail.)

-s

Disables lazy symbol loading. This will slow down process startup. For details and for other methods of controlling this, see SYMOPT_DEFERRED_LOADS.

-sdce

Causes the debugger to display File access error dialog boxes during symbol load. For details and for other methods of controlling this, see SYMOPT_FAIL_CRITICAL_ERRORS.

-ses

Causes the debugger to perform a strict evaluation of all symbol files and ignore any questionable symbols. For details and for other methods of controlling this, see SYMOPT_EXACT_SYMBOLS.

-sflags 0x Number

Sets all the symbol handler options at once. Number should be a hexadecimal number prefixed with 0x -- a decimal without the 0x is permitted, but the symbol options are binary flags and therefore hexadecimal is recommended. This option should be used with care, since it will override all the symbol handler defaults. For details, see Setting Symbol Options.

-sicv

Causes the symbol handler to ignore the CV record. For details and for other methods of controlling this, see SYMOPT_IGNORE_CVREC.

-sins

Causes the debugger to ignore the symbol path and executable image path environment variables. For details, see SYMOPT_IGNORE_NT_SYMPATH.

-snc

Causes the debugger to turn off C++ translation. For details and for other methods of controlling this, see SYMOPT_NO_CPP.

-snul

Disables automatic symbol loading for unqualified names. For details and for other methods of controlling this, see SYMOPT_NO_UNQUALIFIED_LOADS.

-srcpath SourcePath

Specifies the source file search path. Separate multiple paths with a semicolon (;). If the path contains spaces, it should be enclosed in quotation marks. For details, and for other ways to change this path, see Source Path.

-sup

Causes the symbol handler to search the public symbol table during every symbol search. For details and for other methods of controlling this, see SYMOPT_AUTO_PUBLICS.

-t PrintErrorLevel

Specifies the error level that will cause the debugger to display an error message. This is a decimal number equal to 0, 1, 2, or 3. Possible values are as follows:

ValueConstantMeaning

0

NONE

Do not display any errors.

1

ERROR

Display ERROR level debugging events.

2

MINORERROR

Display MINORERROR and ERROR level debugging events.

3

WARNING

Display WARNING, MINORERROR, and ERROR level debugging events.

 

This error level only has meaning in checked builds of Microsoft Windows. The default value is 1.

-v

Enables verbose output from the debugger.

-version

Prints the debugger version string.

-w

Specifies to debug 16-bit applications in a separate VDM.

-wake PID

Causes sleep mode to end for the user-mode debugger whose process ID is specified by PID. This command must be issued on the target machine during sleep mode. See Controlling the User-Mode Debugger from the Kernel Debugger for details.

The -wake parameter should not be used with any other parameters. This command will not actually start CDB.

-x{e|d|n|i} Exception

Controls the debugger's behavior when the specified event occurs. The Exception can be either an exception number or an event code. You can specify this option multiple times to control different events. See Controlling Exceptions and Events for details and for other methods of controlling these settings.

-x

Disables first-chance break on access violation exceptions. The second occurrence of an access violation will break into the debugger. This is the same as -xd av.

-y SymbolPath

Specifies the symbol search path. Separate multiple paths with a semicolon (;). If the path contains spaces, it should be enclosed in quotation marks. For details, and for other ways to change this path, see Symbol Path.

-z DumpFile

Specifies the name of a crash dump file to debug. If the path and file name contain spaces, this must be surrounded by quotation marks. It is possible to open several dump files at once by including multiple -z options, each followed by a different DumpFile value. For details, see Analyzing a User-Mode Dump File with CDB.

-zp PageFile

Specifies the name of a modified page file. This is useful if you are debugging a dump file and want to use the .pagein (Page In Memory) command. You cannot use -zp with a standard Windows page file -- only specially-modified page files can be used.

executable

Specifies the command line of an executable process. This is used to launch a new process and debug it. This has to be the final item on the command line. All text after the executable name is passed to the executable as its argument string.

-?

Displays command-line help text.

When you are starting the debugger from Start | Run or from a Command Prompt window, specify arguments for the target application after the application's file name. For instance:

cdb myexe arg1arg2

 

 

Send comments about this topic to Microsoft

Show:
© 2014 Microsoft