Debugging traditional Synergy with Visual Studio

This topic includes the following sections:


With Synergy DBL Integration for Visual Studio (SDI), you can use Visual Studio to debug traditional Synergy programs. You'll use standard Visual Studio commands to start and control debugging (Start Debugging, Step Into, Break All, Attach to Process, Stop Debugging, etc.), and you can use some standard Synergy debugger commands. You can also remotely debug a Synergy program, which enables you to debug a Synergy program on a different machine (Windows, UNIX, or OpenVMS), even if you have no Visual Studio project for that program. See Remote debugging below.

To debug, build projects in debug mode. (The debugger can step into a routine only if the project is built in debug mode.) Then, while your project is open in Visual Studio, select a Visual Studio debugging command, such as Debug > Start Debugging from the Visual Studio menu.

Note the following:


If you enter one of these commands without the exclamation point, the debugger will interpret it as a variable, which will cause errors.

Remote debugging

You can use the Visual Studio Remote Debugger to debug a traditional Synergy program running on Windows, UNIX, or OpenVMS. (This includes xfServerPlus server code when xfServerPlus is on a Windows, UNIX, or OpenVMS machine.) You don’t need to have a Visual Studio project for the program, but the program must be built in debug mode, SDI must be installed, and you’ll need the source file (.dbl) with the code you want to step through.

For OpenVMS, note you must define the DBG_RMT logical (e.g., $ DEFINE DBG_RMT "-rd 1024:80"). Note that paths are ignored when debugging on OpenVMS.

For xfServerPlus debugging, the machine running the Visual Studio remote debugging session may be the xfServerPlus machine, the xfNetLink client machine, or a separate machine.

1. In Visual Studio, open the .dbl file(s) that you want to step through, and set breakpoints.

For OpenVMS, the remote debugger ignores paths. The file you open in Visual Studio determines which program on the OpenVMS machine will be debugged. This may not work if more than one file has the same name.

For an xfServerPlus program, this will be the .dbl file (or files) with the routines that are accessed via xfServerPlus.

2. On the remote machine, start the traditional Synergy program you want to debug remotely.

For client or stand-alone programs, use dbr with the ‑dv and ‑rd options. For example:

dbr -dv -rd 1965 my_program

For OpenVMS, use the RUN command. For example:


For xfServerPlus server code, restart the xfServerPlus session with remote debugging enabled (or you can start a completely new session on a different port if desired). Then run the xfNetLink client application so that a connection is made to xfServerPlus and the xfServerPlus code is invoked. See Restarting xfServerPlus with remote debugging below, and note the following:

3. Open the Attach to Process dialog in Visual Studio (Debug > Attach to Process).
4. In the Attach to Process dialog, select "Synergy (telnet based)" from the Transport drop-down list.

1. Selecting the “Synergy (telnet based)” option in the Attach to Process dialog.

Selecting the Synergy (telnet based) option in the Attach to Process dialog

5. In the "Specify IP address and port" field, enter the IP address or machine name and the port number separated by a colon (for example, or localhost:1965) and click enter. (Do not click the Find button.) For xfServerPlus server code, make sure the port you specify is the debug port number specified for remote debugging in step 2. (For the example illustrated in figure 3 below, the port number would be 9999.)
6. Make sure the “dbr base” process is selected in the Available Processes section of the dialog, and then click Attach. Note the following for xfServerPlus:

Once connected, the remote debug session works just like any other Visual Studio debug session for traditional Synergy. If you get an error, check the time-out setting and make sure it is long enough for you to complete step 3 through step 6.

If paths on the remote machine don't match specified paths, Visual Studio dialogs will open as you debug, prompting you for paths.

When you are finished debugging an OpenVMS program, unset the DBG_RMT logical.

When you are through debugging an xfServerPlus program, run the Synergy Configuration Program (or restart rsynd without the ‑rd option) to turn off remote debugging. If you leave remote debugging enabled, the server will always wait for the specified time-out before continuing with the application. Note the following for xfServerPlus:

Restarting xfServerPlus with remote debugging

To restart the xfServerPlus session with remote debugging enabled, do one of the following:

For details on using the Synergy Configuration Program, refer to the Synergy Configuration Program online help.

Note that for remote debugging xfServerPlus server code on Windows, xfpl.dbr uses the regular runtime (dbr) instead of the non-interactive runtime (dbs). This means that your environment may change, because dbr always reads the synergy.ini file, whereas dbs reads it only when SFWINIPATH is set. We recommend that you use SFWINIPATH to point to the location of your synergy.ini file and thereby avoid potential problems. For information on dbs, see Running Synergy DBL programs.

rsynd -rd debug_port[:timeout] -w -u xfspAcct

where debug_port is the port number that the xfServerPlus machine should listen on for the Telnet client, and timeout is the number of seconds that the server should wait for a Telnet connection after the xfNetLink-xfServerPlus connection has been made. The default is 100 seconds. This time-out should always be less than the connect time-out set on the client (which defaults to 120 seconds), but it needs to be long enough for you to attach to the xfServerPlus process (step 3 through step 6 above) after the client connects to xfServerPlus. (For more information about starting xfServerPlus, see Running xfServerPlus on UNIX. For complete rsynd syntax, see rsynd program.)