Remote GDB

Hi All,

This one’s for the Legato gurus :smiley:

Can you supply me with some instructions for using GDB from DS3 to the Legato please.

Got an application that’s segfaulting and I need to trap where the fault is happening.

ta, Dave

Hi Dave,

here are some instructions to get GDB working with your Legato Linux app:

  • In the project explorer, select your project, and go to right-click menu > Debug As > Debug Configurations…
  • Double-click on C/C++ Remote Application to create a new configuration
  • There are only few things to configure from there:
    [*]Check that you’re using the correct Connection in the drop-down list
  • Configure the path of your binary on the remote system. e.g. if your binary is named hello, you can set it to /tmp/hello. It will be the path on the device where Eclipse copies your project binary before debugging it.
  • On the Debugger tab, set the GDB debugger command to ${externalTool:legato-linux-gdb-client}. This will allow to use the ARM Linux gdb client that is bundled in DS3.

… and you should be done. Launch the debug session and enjoy!

Hi Daav.

Excellent, Thank You.

Now beaten into shape.

There are a couple of ‘gotchas’ in the debug process - the main one is that the scp process can’t build the path to put the debug executable. For example:

C/C++ application is Debug/Hello
Project is Hello
connection properties remote workspace location is /home/root

When you try to debug, the debug process tries to put the executable at /home/root/Hello/Debug - which doesn’t exist and the scp process can’t (or doesn’t) make the path - so the debug session startup fails. If you ssh into the legato and manually create the full path that the debugger needs (i.e. mkdir -p /home/root/Hello/Debug) then all is well and the debug session works.

I don’t know if this is a bug in your code or something in CDT/Eclipse - but it took me a little while to work out why the debug session was crashing…

ciao, Dave

Good to know.

For your information: actually the Remote C/C++ Application launch configurations are part of the standard CDT features.
So we just integrated it in DS3 as part of the “goodies”, useful when you need to handle standard C/C++ projects aiming to run on the Legato Linux distro.
Our effort is focused on developing features around the Legato Application Framework itself.

Hi Daav,

No problems. Although I guess you connect to a legato app using GDB in a similar fashion?

Anyway, it’s good that you’ve included this functionality into DS.

Ciao, Dave

Yes, once you have a Legato application project, you can use a Legato application debug configuration to handle the debug session, whatever if the application is sandboxed or not.