Debugger

General
Use of Debugger
Debugging

The debugger is a supporting tool, helpful in developing and debugging 1C:Enterprise modules. The debugger allows you to:

  • debug client and server applications, external connections both in the file mode and in the client/server mode, web-services and background jobs;
  • execute the module on a step-by-step basis;
  • arrange breakpoints;
  • interrupt and continue the module execution;
  • debug several modules at a time;
  • calculate expressions for variable status analysis;
  • view the stack of procedure/function calls;
  • stop the execution in case of an error;
  • edit modules while debugging.

The concept of the debug item is used to describe the debugger. The debug item is a 1C:Enterprise script context based on the following set of parameters:

  • name of the user who is to execute the 1C:Enterprise script code;
  • debug item type;
  • network name of the computer on which the 1C:Enterprise script code is to be executed;
  • infobase connection number;
  • number of the IP-port used by the Debugger to manage the debug item operation.

Debug item types include:

  • Client-the 1C:Enterprise script code executed in the client application;
  • Server-the 1C:Enterprise script code executed on the server;
  • External connection-the 1C:Enterprise script code executed through COM-connector;
  • Web-service-the 1C:Enterprise script code used to process the calls of web-service methods;
  • Background job-the 1C:Enterprise script code used to process background jobs.
Use of Debugger

To debug the 1C:Enterprise script code, the application in which the code is executed should be started in the debugging mode.

If the 1C:Enterprise mode is not launched, select Debugging- Start Debugging to start the debugging process. The Designer starts the 1C:Enterprise in debug mode.

Where the Enable Debugging Mode option is set or the Begin Debugging on Startup option is specified in the Designer settings (open by selecting Service-Options..., the1C:Enterprise Startup tab), then debugging can be launched using the run mode invoked by the Service-1C:Enterprise command. If you want to debug a code executed by a certain user, then the user on whose behalf the debugging mode is launched can be specified in the settings form.

How to Set up the Application to Run in the Debugging Mode

Client Application Debugging

To set up the debugging mode, you can use the following startup options:

  • In the Designer mode, check Set the Enable Debugging Mode on Startup in the settings form (open by selecting Service-Options..., the 1C:Enterprise Startup tab), then connect the debug item; you can also check the Begin Debugging on Startup option, which enables automatic connection on 1C:Enterprise startup;
  • Open the infobase in the 1C:Enterprise mode using the /Debug command line option (in the debugging mode);
  • If the client application is run, then set the debug mode (check the Debugging Allowed option) in the settings form (open by selecting Service-Options..., the System tab). Note that once the settings have been applied, you will not be able to clear the checkbox.
  • If the 1C:Enterprise mode has been started and you need to enable debugging for each subsequent startup, then set the debugging mode (check the Set the Enable Debugging Mode option) in the settings form (open by selecting Service-Options..., the System tab).

Code Debugging on the Server

To set the debugging mode, run the 1C:Enterprise server using the /Debug command line option (ragent.exe /debug).

Debugging of External Connection and Web-Services

To specify the startup in the debugging mode for the external connection / web-service, use settings from xml-files (comcntrcfg.xml and webservicecfg.xml respectively) located in the CONF subdirectory of the 1C:Enterprise 8 executable file (BIN). If the file is not found, the application will be opened in the ordinary mode.

Debugging

To debug the module, the debug item should be connected for debugging.

To manage the connection, use the Select Debug Item and Configure Connection window.

When debugging several items at a time, take note of some specific aspects of the step-by-step execution:
  • If one debug item is stopped, the others will be also stopped upon the start of the code execution.
  • The Continue command makes the execution of all debug items continue.
  • The Step over command results in shifting to the following string in all debug items.
  • The Step to command (where the module operator being executed is a call of a procedure/function) results in shifting to the first operator within this call, theStep over command is always executed for other debug items.
If the client/server mode version is debugged and the code is executed on the client and on the server successively (client and server debug items have been connected), then:
  • The Step to command (where the module operator being executed is a procedure/function call) results in shifting to the first operator within this call.
  • Selecting the Step out of or Step to options for the last executed operator (where the module operator being executed is a procedure/function code executed on the server, and which has been called from the module run in the client application) results in shifting to the next operator within this call.
After the debugging starts, the Debug Items toolbar is displayed for you to select the debug item to view variable values related to it, and to see the current debug item. The toolbar consists of just one selection field that displays the current debug item. This selection field is only available when the Debugger has control over any connected debug item operation (e.g when a break point has been activated). In this case debug item list will only include items whose operation is controlled from the Debugger, including the current debug item.
The Display and the Expression dialogue can be used to view expression values you need. The Call Stack makes it possible to track the sequence of procedure/function calls.
If the step-by-step process is executed, the call stack and variable values are displayed (on the display and in the Expression dialogue) for the current debug item. After the debug item is changed, the call stack and variable values are also changed.
Important! After the connection of client and server debug items and the move from the client section to the server part, no calculations are performed at the client level of the call stack. These levels are displayed in grey in the call stack window.
In case the module execution should continue, enable the connected debug items to execute the module (up to the next breakpoint) by selecting Debugging-Continue Debugging. If the client application is connected for debugging, it will be enabled automatically.
When it is necessary to abort the overall debugging process, uncheck all breakpoints for all modules and select Debugging-Continue Debugging, if a breakpoint has gone off When it is necessary to abort the debugging and complete the execution of connected debug items, use theDebugging-Cancel option. In the latter case the BeforeSystemShutdown and UponSystemShutdown procedures will not be performed.
You can edit the current configuration and save changes while debugging.
Caution! Though the module can be edited during its debugging, the Debugger does not compile the edited code- the database configuration code is still being debugged (at the time the Debugger is being launched or connected). To debug the changes made to the configuration, the database configuration should be updated.

1C:Enterprise Developer's Community