DNCDbg supports the multi-session persistent debug server mode. This means you can run several debug sessions one after another without restarting the debugger for each session.
- Start the debugger.
First debug session
- Start the initialization sequence with the Initialize Request.
- ... perform the initialization you need ...
- Finish the initialization sequence with the ConfigurationDone Request.
- Start the debug session with the Launch Request or the Attach Request.
- ... debug the application ...
- Restart the debug session with the Restart Request.
- ... debug the application ...
- Finish the debug session with the Terminate Request or the Detach Request. Note: the Detach Request is not part of the DAP specification.
Second debug session
- Start the initialization sequence with the Initialize Request.
- ...
- Finish the debug session with the Terminate Request or the Detach Request.
Last debug session
- Start the initialization sequence with the Initialize Request.
- ...
- Finish the debug session and close the debugger with the Disconnect Request.
OR
- Start the initialization sequence with the Initialize Request.
- ...
- Finish the debug session with the Terminate Request or the Detach Request.
- ...
- Close the debugger with the Disconnect Request.
By default, DNCDbg exchanges DAP messages with the client over the standard input and output streams. The --server command-line option changes this: the debugger listens on a loopback TCP port, and the DAP messages are exchanged with the client over the accepted TCP connection instead.
Usage:
--server- listen on the default TCP port4711.--server=port- listen on the specified TCP port (range 1 - 65535), for example--server=5000.
Example:
dncdbg --server=5000
Behavior:
- The debugger binds only to the loopback interface (
127.0.0.1), so the server is reachable only from the local machine. - The debugger accepts exactly one client connection. Other connection attempts are not served.
- The debugger starts listening as soon as it is launched, but the protocol messages are read only after the client connects.
- The messages use the same format as in stdin/stdout mode (
Content-Lengthheaders followed by the JSON payload), so the same DAP requests and responses apply. See the DAP status for the supported requests. - When the client disconnects, the debugger reports the end of the input stream, initiates a forced disconnect, and shuts down.
- If the port is invalid or cannot be used (for example, it is already in use), the debugger reports an error and exits without starting a debug session.
- The
--logProtocol=and--log=options can be used as usual to trace the protocol messages and the debugger activity.
Note: this mode replaces stdin/stdout for the protocol messages, so the process's standard output is not used for DAP messages in server mode.