Debugging with an Attach Launch
A Natural application that was not started from Visual Studio Code, is debugged by attaching to it. This can be, for example, an application that was started by another user, by a batch job, by a Natural application running in a workplace application, or from a different environment.
An attach launch requires a launch configuration of type
attach (see
NatAttachDefault in
NatAttachDefault Configuration) and a running Debug Attach Server (DAS), which is specified with the following preferences:
natural.das.host,
natural.das.port, and
natural.das.ssl; see
Debug Attach Preferences.
Attaching to a Running Application
1. Set breakpoints in the Natural sources that you want to debug before you start the session.
2. Select the attach configuration in the Run and Debug view and press F5 to start it.
3. Start the application in the Natural environment, for example, in a batch or workplace environment, with the debug attach option enabled and the same client ID as in the attach configuration.
The breakpoints register the attach session with the DAS. Each breakpoint creates a record in the DAS that identifies the object containing the breakpoint. Removing a breakpoint also removes the corresponding record. If you do not set any breakpoints, the DAS has no registration and cannot attach an application.
The clientID parameter of the attach configuration specifies the client ID. Its default value is VSCODE, which corresponds to the DBGAT parameter of the Natural session.
When an application starts with debug attach enabled and a matching client ID, the DAS searches for a matching record. When the application executes an object that contains a breakpoint, the DAS connects the application to the debugger. The debugger sends the breakpoints to the running application, and the application stops when it reaches the first breakpoint.
Important:
Set the breakpoints before you start the attach session. If you do not set any breakpoints, the DAS has no registration and cannot attach an application.