Configuring a connection to a Linux target using gdbserver

You can connect to an application that is already running on a target using gdbserver.

Show/hidePrerequisites

Before connecting you must:

  1. Set up the target with an Operating System (OS) installed and booted. See the documentation supplied with the target for more information.

  2. Set up the target connection:

    • For a TCP connection, obtain the target IP address or name.

    • For a serial connection, configure the target serial port and baud rate. For example:

      stty -F /dev/ttyS2 115200 -brkint -icrnl -imaxbel -opost -onlcr -isig -icanon -iexten -echo -echoe -echok -echoctl -echoke
      

If you are connecting to an already running gdbserver you must ensure that you have:

  1. gdbserver installed and running on the target.

    To run gdbserver and the application on the target you can use:

    gdbserver port path/myApplication
    

    Where:

    • port is the connection port between gdbserver and the application. For example :5000.

    • path/myApplication is the application that you want to debug.

  2. An application image loaded and running on the target.

Show/hideProcedure

To connect to the target:

  1. Select Window → Open Perspective → DS-5 Debug from the main menu.

  2. Select Debug Configurations... from the Run menu.

  3. Select DS-5 Debugger from the configuration tree and then click on New to create a new configuration. Alternatively you can select an existing DS-5 Debugger configuration and then click on Duplicate from the toolbar.

  4. In the Name field, enter a suitable name for the new configuration.

  5. Click on the Connection tab to configure a DS-5 Debugger target connection:

    1. Select the required platform.

    2. Select the Linux Application Debug project type.

    3. Select the required debug operation.

    4. Configure the connection between the debugger and gdbserver.

  6. Click on the Files tab to define the target environment and select debug versions of the application file and libraries on the host that you want the debugger to use.

    1. In the Target Configuration panel, select the application on the host that you want to download to the target and specify the location on the target where you want to download the selected file.

    2. In the Files panel, select the files on the host that you want the debugger to use to load the debug information. If required, you can also specify other files on the host that you want to download to the target.

    Note

    Options in the Files tab are dependent on the type of debug operation that you select.

  7. Click on the Debugger tab to configure the debugger settings.

    1. In the Run control panel, specify the actions that you want the debugger to do after connection to the target.

    2. Configure the host working directory or use the default.

    3. In the Paths panel, specify any source or library search directories on the host that the debugger uses when it displays source code.

  8. If required, click on the Arguments tab to enter arguments that are passed to the application when the debug session starts.

  9. If required, click on the Environment tab to create and configure the target environment variables that are passed to the application when the debug session starts.

  10. Click on Apply to save the configuration settings.

  11. Click on Debug to connect to the target.

  12. Debugging requires the DS-5 Debug perspective. If the Confirm Perspective Switch dialog box opens, click Yes to switch perspective.

When connected and the DS-5 Debug perspective opens you are presented with all the relevant views and editors.

For more information on these options, use the dynamic help.

Show/hideSee also

Copyright © 2010, 2011 ARM. All rights reserved.ARM DUI 0446D
Non-ConfidentialID011411