This is the legacy 4D documentation web site. Documentations are progressively being moved to developer.4d.com

Home

 
4D v20 R7
Debugging from Remote Machines

Debugging from Remote Machines  


 

When a 4D database is running on 4D Server, you can debug the 4D code running on the server from a remote 4D Developer application. You just need to attach the debugger to a specific remote machine, and the code execution can be monitored in the debugger directly on the remote machine. 

On a remote machine, the debugger displays a specific server icon and a blue background color to indicate that the debugging code: 

  

This feature is particularly useful when 4D Server runs in headless mode (see Command Line Interface), or when access to the server machine is not easy.  

Compatibility Note: This feature is only available in application projects

Only one debugger can debug a 4D Server application at a given time --it is named the attached debugger. The attached debugger can be:

  • the local 4D Server debugger (default) - if the server is not running headless. 
  • the debugger of a remote 4D - if the remote session has access to the Design mode.

The attached debugger is called whenever a 4D Server encounters a break point or a TRACE command or a caught command or an error. 

Keep in mind that error messages are sent to the attached debugger machine. It means that, in case of a remote debugger, server error messages are displayed on the remote 4D.

Notes:  

  • The code executed in the On Server Startup Database Method cannot be debugged remotely. It can only be debugged on the server side. 
  • If no debugger is attached, the running code is not stopped by debugging commands.
  • There are some limitations in the remote debugger compared to a local debugger (see Debugger).

By default, the debugger is not attached to a remote 4D:

  • If 4D Server is not running headless, the debugger is attached to the server.
  • If 4D Server is running headless, no debugger is attached.  

You can attach the debugger to any remote 4D allowed to connect to the 4D Server application. 

Note: The remote 4D user session must have access to the Design environment of the database.

To attach the debugger to a remote 4D:

  1. In the 4D Server menu bar, select Detach Debugger from the Edit menu, so that the debugger becomes available to remote machines.
    - This step is useless if the 4D Server is running headless. 
    - You can attach back the debugger to the server by selecting Attach Debugger from the Edit menu (if not attached to a remote 4D, see Rejected attachment requests).
  2. In a remote 4D connected to the server, select Attach Remote Debugger from the Run menu:

If the attachment is accepted (see Rejected attachment requests), the menu command becomes Detach Remote Debugger

The debugger is then attached to the remote 4D:

  • until the end of the user session, or
  • until the user selects Detach Remote Debugger.  

4D allows you to automatically attach the debugger to a remote 4D or to the server at startup:

  • On the server (if not headless), this option is named Attach Debugger At Startup. When the server is started, it automatically attaches the debugger (default):

    4D Server Edit menu

    Warning: If this option is selected for a server which is subsequently launched in headless mode, it will not be possible to use the debugger on this server.

  • On a remote 4D, this option is named Attach Remote Debugger At Startup. When selected, the remote 4D will automatically try to attach the remote debugger at each subsequent connection to the same 4D Server database. If the attachment is accepted (see Rejected attachment requests), the remote debugger is automatically attached to the remote 4D application (the Detach Remote Debugger option is displayed):

    4D Developer (remote) Run menu

 This setting is per database and is stored locally in the .4DPreferences file.

While the debugger is already attached to a remote 4D or to 4D Server (default), no other machine can attach the debugger. 

If a machine tries to attach the debugger while it is already attached, the attachment is rejected and the following dialog box is displayed:

 

Attaching the debugger in this case requires that:

  • the attached debugger is detached from the remote 4D using the Detach remote debugger menu command or from the server using the Detach debugger command, or
  • the attached remote 4D session is closed. 

 
PROPERTIES 

Product: 4D
Theme: Using a remote 4D

 
PAGE CONTENTS 
 
HISTORY 

Created: 4D v18 R5

 
ARTICLE USAGE

4D Server Reference ( 4D v20 R7)