[FDS-99] FusionDebug 1.0 Finds the Wrong Source File

Description

Problem: When a breakpoint fires or I’m using the stepping commands, FusionDebug sometimes finds the wrong source code file.

FusionDebug uses the source tab in the Configuration dialog to find any source code it needs. By default, this tab contains all projects in the workspace, and is configured to stop looking for source code when it finds a matching file.

If you have the same filename in two or more projects, FusionDebug will pick the first one it finds – which may not be correct.

This behaviour is easy to change.

Changing Source Lookup Behaviour

  • Open the Configuration dialog and select the configuration you’d like to edit.
    Open Run -> Debug, open the FusionDebug element and select your FusionDebug configuration.
  • Either
    1. Select Search for duplicate source files on the path.
      This will make FusionDebug find all the matching files, and ask you to pick the right one every time it finds duplicates.
    2. Edit the source lookup path manually.
      Instead of looking in all Eclipse projects, you can fine tune the search areas to include only your current project, or a small collection of projects. See the next section for more information on using this functionality.
  • In either case, don’t forget to click ‘Apply’, and re-start your debugging session to make the change visible.

Editing the Source Lookup Path

By default, the source lookup path contains all workspace projects. You can change how the lookup path works by adding or removing projects from the path, or changing the order in which the path is searched.

The following screenshot shows a default source lookup path.

The projects CF_VideoStoreApplication and FDB_TestFiles both contain a testfile.cfm, but only the FDB_TestFiles one has been distributed to the web server, since that’s the application we’re debugging. Since the source lookup path is unchanged from the default, FusionDebug will pick the first one in the list – that from the CF_VideoStoreApplication – which is incorrect.

We can solve this by checking the box marked Search for duplicate source files on the path. Now, when FusionDebug tries to find the file, it asks us which one is correct, by popping up the following dialog:

This is a good solution, but being asked every time can be a bit time-consuming. Instead, we can edit the source lookup path to include just the project we need. The source path is specific to each configuration, so if we were debugging another project, we could simply add a new configuration, and set up the source path for that project too. More information on creating configurations can be found in the User Manual.

We can’t edit the Default element of the source path, since Eclipse maintains that automatically. We can remove it though. We click on the Default element, and select Remove. This removes the default element completely, leaving an empty source path.

Now we select Add. The Add Source (Selection Needed) dialog appears, listing all resources available in the workspace.

We select Project and put a check-mark against the FDB_TestFiles project, then click OK. This adds the FDB_TestFiles project to the source path. We click Apply and, since FusionDebug is not connected, Debug.

Now whenever the breakpoint fires in testfile.cfm, FusionDebug opens the correct one without asking – that from the FDB_TestFiles project.

Conclusions and Further Exercises For The Reader

We’ve created a custom source lookup path for our configuration. This ensures that FusionDebug is able to find the correct source file whenever a breakpoint fires. It’s particularly important to do this since many projects share common files, not the least of which is application.cfm.

Some development organisations may also have common libraries of CFCs or pages which they re-use. It would be a simple matter to create an Eclipse project for these common libraries, and then to include it in the source lookup path too.

Careful ordering of path elements (using the up and down buttons) can help FusionDebug quickly locate the right file without having to turn on Search for duplicate source files on the path.

Issue Details

Type: Technote
Issue Number: FDS-99
Components: Configuration
Environment:
Resolution: Fixed
Added: 22/08/2007 18:05:54
Affects Version: 1.0
Fixed Version: 2.0
Server: Tomcat, LiveCycle Data Services, Flex Data Services, JRun 4, ColdFusion 8, ColdFusion 6, ColdFusion 7, JBoss, WebSphere, WebLogic
Platform: Solaris, MacOS, Linux, Windows 2003, Windows 2000, Windows XP
Related Issues:
  • FDS-86 – My breakpoint fires, but the editor doesn’t highlight the line I am on

Comments are closed.