From Real Software Documentation
Remote Debugging
Remote debugging enables you to test your application on a different computer from your development machine. For example, if you are developing under Mac OS X and need to test the application under Windows, you can do so from your Macintosh. Remote Debugging sends a debug build of the application to the remote machine and launches it automatically.
Without Remote Debugging, you would have to create a standalone Windows build on your Macintosh, move it to the Windows computer, and then launch it from that computer.
Remote Debugging is available in the Professional and Enterprise versions of Real Studio. Also, Remote Debugging requires that you open additional ports in both computers’ firewalls. This information is given in the section About Firewalls in Chapter 12.
We’ll call the computer on which the Real Studio IDE is running the development machine and the remote computer on which you will be testing your application the debugging machine.
Remote Debugging works with a small utility application that runs on the debugging machine. It is called the Remote Debugger Stub. The Remote Debugger Stub is in the Extras folder in your Real Studio application folder.
You first configure the Remote Debugger Stub on the debugging machine. When you want to test the application on that machine, you use the IDE’s Project ↠ Run Remote menu command instead of the Project ↠ Run command. If you don’t have the Professional or Enterprise versions of Real Studio, the Run Remote command is not available.
To configure the Remote Debugger Stub, do this:
 |
- Copy the Remote Debugger Stub application to a debugging machine and double-click it.
The Stub main screen appears. Initially, the machine name will be “Machine Name Goes Here”.
The Remote Debugger Stub main screen.
- Choose File ↠ Options (Windows and Linux) or Remote Debugger Stub ↠ Preferences (Mac OS X) to configure the Remote Debugger Stub.
The configuration dialog box appears:
The Remote Debugger General Preferences screen. It offers the following options: * Name: The name of the debugging machine that will identify it on the development machine. It can be any name you like. * Password: The password you will use from the development machine to access this machine. * Download Location: The local directory where the application will be downloaded for testing. The default is the same directory as the stub. The second panel of the Preferences screen allows you to set the listening port. Normally, you do not need to change this preference.
The Networking Options panel. * Network Interface: The network interface that the stub will support. Most computers have only one network interface adapter; it is identified as “Default” and by its IP address. If the computer has more than one network interface adapter, then the IP addresses of each adapter will appear as menu items. * Port: The port that all incoming TCP connections should be routed to. Most people will want to use the default value. If you have a firewall, this port may be blocked by default and you will need to modify the firewall to permit communications. * Max Connections: The maximum number of connections that you will allow to this machine. * Public Debugger: If selected, the machine can be auto-discovered by the development machine during the setup process. By default, the debugger stub is public. When it is public, the name of the machine appears in the remote debugging setup dialog automatically. If this option is not selected, the developer will need to enter the IP address of the machine in order to connect. * Public Debugger Stub: If selected, the machine appears in the development machine. Otherwise, the developer can select it only by knowing the machine’s IP address.
|
The next step is to set up Remote Debugging on your development machine. Before you can use a remote machine for debugging, Real Studio needs to be configured to send the debug application to the remote machine and launch it automatically.
To configure the Real Studio IDE for Remote Debugging, do this:
 |
- Choose Project ↠ Run Remotely ↠ Setup.
The Debugging panel of the Options dialog box appears. Alternately, you can open the Options dialog box directly (Preferences dialog on Macintosh) and navigate to Debugger options.
The Debugger Options panel. The Remote Debugging Sessions ListBox will show all the debugging machines that have already been configured. The Network Interface drop-down list shows all the network interface adapters for the machine. Most computers have only one network interface adapter; it is identified as “Default” and by its IP address. If the computer has more than one network interface adapter, then the IP addresses of each adapter will appear as menu items.
- (Optional) If the default network interface adapter is not correct, select the correct network interface.
You then need to add the desired machines to this list.
- Click Add to add a debugging machine to the list.
The Auto-discover dialog box appears.
The Auto-discover Remote Machines dialog. In this illustration, one computer is running the Remote Debugger Stub and has the Public Debugger Stub option enabled. It is identified by the Machine Name that had been entered into the Remote Debugger Stub configuration screen. If you find that not all your remote debugging machines are listed, verify that the Remote Debugger Stub is actually running on those machines and that you have selected the Public Debugger Stub option. This is set by default on the Networking preferences screen. Also, double-check that the firewalls on both machines are configured property. For more information, see About Firewalls in Chapter 12.
- (Optional) Click Refresh if a machine that you are expecting to be listed does not appear.
- Highlight a debugging machine.
Its Machine Name and IP address appear in the Name and Address areas in the lower section of the dialog box. You can also add a debugging machine by typing its name and IP address into the entry areas but you may want to figure out why Real Studio was unable to see it automatically.
- Enter the password if the machine is password-protected.
- If Public Debug Stub is off, enter the IP address and password of the machine.
- Click OK to add the debugging machine.
When you return to the Debugging Preferences panel, it will appear in the Remote Debugger Connections ListBox.
- If desired, repeat the process to add additional debugging machines.
|
When you are finished with the Debugging Preferences screen, the selected debugging machines are added to the Project ↠ Run Remotely submenu.
The most recently used debugging machine will be at the top of the menu and get the keyboard shortcut.
To debug on a remote machine, do this:
 |
- Verify that the Remote Debugger Stub is running on the desired debugging machine.
You should see the message “Listening on Port XXXXX.” If not, you may need to configure the firewall on that machine.
- Choose the desired debugging machine from the Project ↠ Run Remotely ↠ DebugMachineName menu.
Real Studio creates a debug build for the correct platform, sends it over the network to the debugging machine and launches it automatically. As it is doing so, a progress indicator on the development machine gives you the status of the operation.
- Reorient yourself in front of the debugging machine and test the application normally.
If you have put a breakpoint in your code or otherwise break into the Debugger, it will appear on the development machine.
|
When you are finished debugging, you need to quit out of the debug build before resuming work in the IDE on the development machine. You can do so on the debugging machine or, on the development machine, click the Stop button in the Debugger or choose Project ↠ Stop Debugging.
About Firewalls
If you are behind a firewall, the default ports you need to open are as follows:
Table 40: Development Machine.
| 44553
| UDP
|
| 44553
| TCP
|
| 13897
| TCP
|
Table 41: Debugging Machine.
You can change the ports communicated on by the stub (port 44553) in the Networking panel of the Options dialog box. In the IDE, you can connect to the new port by specifying the address as “X.X.X.X:Port” (see the above illustration). Please note that if you change the default port, the stub can no longer be automatically discovered.
In order for remote debugging to work, the selected UDP and TCP ports must be opened in the OS’s firewall or any third-party firewall applications that are running.