Using Eclipse as a Front-End to GDB Debugging on the Device

You can use the Eclipse IDE for debugging applications directly on the device. To do this, you must have the following in place:

  1. A GDB (GNU Debugger) client set up in Eclipse.

  2. A GDB server on the device when running the application. See http://www.gnu.org/software/gdb/documentation/ for information on using GDB. The Palm PDK comes with a pre-configured workspace. Using this requires some initial configuration when starting Eclipse for the first time.

Notes:

The pre-configured workspace setup assumes the Palm PDK is installed at C:\Program Files\HP webOS\PDK\ and the Codesourcery Toolchain is installed at C:\Program Files\CodeSourcery.

This procedure was done with Eclipse Galileo v3.5. Other versions of Eclipse (i.e., Ganymede, Helios) are likely to be different.

To run the sample application in Eclipse:

  1. Configure Eclipse to use the Palm PDK workspace.

    • Launch Eclipse

    • In the Workspace textbox, browse to and select, the workspace provided with the PDK:

      C:\Program Files\HP webOS\PDK\EclipseWorkspace

      The EclipseWorkspace is already configured to debug the Palm PDK's simple application.

  2. Compile the sample application in debug mode.

    • Open a command prompt and go to the following directory:

      C:\Program Files\HP webOS\PDK\share\samples\simple\windows

    • In buildit.cmd, set DEBUG=1 and run it. This script compiles the sample application with debug symbols (the –g option for the GCC compiler).

  3. Import the sample application executable.

    • Select File > Import.

      The Import dialog box appears:

      image
    • Select C/C++ Executable as shown, and click Next.

    • In the Import Executable dialog box, if not already selected, click the Select Executable radio button.

    • Browse and select:

      C:\Program Files\HP webOS\PDK\share\samples\simple\windows\simple

    • Click Next.

      image
    • Deselect the Create a Launch Configuration checkbox and click Finish. There should now be a Debug_simple project entry in the Project Explorer pane.

  4. Configure the GDB client for the host PC.

    • Select Run > Debug Configurations and expand the C/C++ Application menu.

      image
    • Click on the GDBClient menu item and change the Project field to the name of your imported project and the C/C++ Application field to point to your executable.

    • Click on the Source tab.

      image
    • Select the simple entry and click Add.

    • In the Add Source dialog box, select File System Directory and click OK.

    • In the Add File System Directory dialog box, browse and select the simple directory and click OK. The Add File System Directory dialog box reappears with your selection:

      image
    • Click OK.

    • Click Apply and then Close.

  5. Configure the GDB server for the device.

    Configure the debugit.cmd script to run when you start debugging and running the sample application. This script will stop the GDB server on the device if it is still running, transfer the simple executable, and restart (or start) the GDB server, passing it the sample application's executable name.

    • Select Run > External Tools > External Tools Configurations.

    • In the Working Directory textbox, enter "C:\".

    • Enter "media/internal/simple" in the Arguments textbox.

    • Click Apply, then Close.

  6. Run the sample application in debug mode.

    • Click the drop-down menu:

      image
      And select Debug Device. The layout changes to a Debug Perspective. To return to the Project Explorer perspective, select Windows > Close Perspective. You should see the rotating cube displayed on the device.