Project

General

Profile

GDB Multiarch Installation

Objective

The objective is to install gdb-multiarch on the host system. gdb-multiarch is a variant of gdb which supports multiple target architectures. This is needed when debugging an ARM Linux program running on the target and being debugged from the Linux host system.

Summary of Steps

  • Install the program
  • See how to debug a program within Code Composer
    • Starting the target program with gdbserver
    • Creating a Debug Configuration in Code Composer

Steps

Install gdb-multiarch

  • Enter the following commands on the host system.
sudo apt-get update
sudo apt-get install gdb-multiarch

The program is installed and ready for use.

How to debug a program within Code Composer

Starting the target program with gdbserver

When using Code Composer to debug a target program, the target program must be started on the target by gdbserver. The gdbserver program provides the host system access and control of the target program.

To start the program on the target do something like this:

gdbserver :10000 ./hello

The :10000 specifies the TCP port which will be used to communicate with the host. This can be any unused port and must match what is used in Code Composer.

The ./hello is the name of the target program in this example. If the target program needs arguments, the arguments can be added after the ./hello.

The ./hello must be the same program as referenced on the host. It is assumed that you build the program on the host, transfer the program to the target, and then start the program with gdbserver.

After entering the gdbserver command, the program is loaded but execution does not begin until the host connects to the target. When the host connects, then the program starts execution and stops as directed by the host. Status messages are printed indicating that gdbserver is waiting for the host and further messages are printed when the host connects.

Creating a Debug Configuration in Code Composer

You will need to perform these steps whenever you create a Debug Configuration in Code Composer.

  • Start Code Composer
  • Run->Debug Configurations
    • Select C/C++ Remote Application
    • Press the New Configuration button (upper left) or C/C++ Remote Application->right-mouse->New Configuration
      • On the Main tab
        • Enter a Name for the configuration. (i.e. replace the New_configuration with a meaningful name)
        • At the bottom of the dialog it indicates that it is "Using GDB (DSF) Automatic Remote Debugging Launcher". Press the Select other... link to the right of this text.
          • Check the "Use configuration specific settings"
          • Select GDB Manual Remote Debugging Launcher.
          • Press OK
      • On the Debugger tab
        • On the Main tab of the Debugger Tab: Change the GDB debugger: line from gdb to gdb-multiarch
        • On the Connection tab of the Debugger Tab
          • Make sure the Type is TCP
          • Change localhost to the ip address of your target.
          • Change the port number to 10000 or whichever port you choose to use when starting gdbserver
      • On the Main tab for the configuration
        • Select the project and program to be debugged. This must match the program started on the target by gdbserver.

The Debug Configuration is now ready to start debugging.

The above steps configure a Debug Configuration as needed. It is also possible to change the Workspace Preferences so that the default choices when creating a new Debug Configuration will be appropriate. These preferences only apply to the current workspace. This method would be of use if you have multiple Debug Configurations in a single workspace.

Conclusion

The gdb-multiarch program has been installed and the steps for creating a Debug Configuration using gdb-multiarch have been provided.

Go to top
Add picture from clipboard (Maximum size: 1 GB)