Skip to content

Tutorial : How to debug a remote application ?

tpetazzoni edited this page Mar 21, 2013 · 6 revisions

This tutorial describes how to debug a remote application using a Buildroot toolchain in Eclipse.

The first step will be to create a launch configuration, if you already run the execution you can use the same launcher for debugging. Else have a look to the How to execute a remote application tutorial ? to see the way to create a new launch configuration.

Buildroot setup

As a preliminary step, you also need to ensure that gdbserver is present on your target and that your toolchain provides a cross-debugger.

  • If you use the Buildroot toolchain toolchain type, enable the following options:
    • Toolchain -> Build gdb server for the Target
    • Toolchain -> Build gdb for the Host
  • If you use the External toolchain toolchain type, enable the following option:
    • Toolchain -> Copy gdb server to the Target.
    • Note that this assumes your external toolchain already comes with a pre-built cross-gdb and gdbserver, which is usually the case.
  • If you use the Crosstool-NG toolchain toolchain type, enable the following options:
    • Toolchain -> Build gdb server for the Target
    • Toolchain -> Build gdb for the Host

Also, in order to get a nice debugging experience, you may want Buildroot to build the libraries with debugging symbols. To do so, enable the Build options -> build packages with debugging symbols option.

Add breakpoints

From the editor you can double click on the left side to add a breakpoint : Add breakpoints or still on the left side of the editor by right clicking, a Add breakpoint context menu appears : Add breakpoints

Launch remote debug

Click on the debug button in the toolbar and select the launcher you defined : Debug

Eclipse switched automatically to the Debug perspective : Debug

Click on the Resume toolbar button : Debug

The debugger stops on the breakpoint you defined : Debug first step

You can see directly from the code the actual value associated to a variable just by hovering it with the mouse.

If you run again, you will see the variable values changing from the Variables view : Debug next step