Remote Debugging

When attempting to isolate a bug in an application, it is possible that you will encounter a case where a bug is reproducible on only a specific machine. For such a case, you can use the Flash Debug Player’s remote debugging feature. This feature can also be useful if you would want to use the Flex Builder debugger on a Windows or Mac-based machine while the application is executed under Linux, which does not have a native version of Flex Builder available.

As mentioned earlier, debugging occurs over a TCP connection on port 7935. Such a connection is typically established on the same machine transparently, but with remote debugging it is established from one machine to another. One machine will typically be running the debugger and can be referred to as the server, while the other will be running the application and can be referred to as the client machine. Once a connection is established between the client and the server, all of the features of using a debugger function in the same manner. It’s important to remember that in a typical workstation, the client machine may not be configured properly for remote debugging. Remember that the Flash Debug Player is required for a debug session, so you will need to ensure that it is installed on the client machine. It is also important to keep in mind that the client machine will need to be executing a debug-enabled SWF in the same manner as we discussed earlier in the chapter.

To initiate a debug session, follow these steps:

  1. Initialize the debugger on the server machine.

    1. With FDB: one benefit of using FDB when initializing a remote debugging session is that the steps for initializing FDB are exactly the same as those for initializing a local session. You initialize FDB by launching FDB and executing the run command.

    2. With Flex Builder’s Debugger: initializing a remote debugging session with Flex Builder is more involved. Flex Builder’s debugger doesn’t formally support remote debugging, although it is possible. We will cover remote debugging with Flex Builder in the next section.

  2. Initialize the debug-enabled SWF on the client machine and ensure that the Debug Player is installed.

  3. Once initialized, the player will prompt you for a debugger, because the debugger is not running on the client machine. Input the IP address of the server running the debugger and select Connect.

  4. If the server is running the debugger and listening for a connection, the client and server will connect. Note here that you will also need to ensure that the server is not blocking port 7935.

Once a connection has been established, debugging can be performed in the manner discussed earlier in this chapter.

Establishing a Remote Debugging Session with the Flex Builder Debugger

As mentioned earlier, debugging sessions—both local and remote—are established over a TCP connection on port 7935. Flex Builder uses the same connection to establish debug sessions. Although by default Flex Builder does not expose remote debugging capabilities, it still is possible to do so.

To initiate a remote debug session with Flex Builder, follow these steps:

  1. Compiled a debug-enabled .swf.

  2. Copy the debug-enabled .swf to the remote client machine.

  3. On the machine that will run the Flex Builder debugger (server), create an empty HTML file (typically within your project’s bin-debug folder). Since no content exists in an empty file, the Flex Builder debugger will launch a session that is empty and just wait for a remote connection.

  4. Ensure that no firewall is actively blocking port 7935 on the client machine.

  5. Edit the debug configuration within Flex Builder (select Run→Run).

  6. Select the target debug configuration.

  7. Uncheck the “Use defaults” checkbox.

  8. Click the Browse button for the debug file path.

  9. Select the blank HTML page created in step 3.

  10. Click Debug in Flex Builder. You should see “Launching {application name}” and a progress bar in the bottom status bar of Flex Builder (at this point, Flex Builder is waiting for a remote connection, in the same manner FDB does).

  11. Open the debug-enabled .swf on the remote machine and, when prompted for a remote host address, input the host address of the machine with the Flex Builder debugger.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset