Remote debugging with gdbserver



I was trying to debug the HelloWorld app from Developper Studio directly on my target when I encountered this error :

How I reached this point :
I successfully connected the device to my VM.
Developper Studio has access to the target because I can list installed apps in the “Remote Sytem Explorer” Perspective.
I am also able to start/stop/restart apps from the “Remote System” View in that Perspective. There, I see the console of the app.
In the Debug Perspective, I set up a Debug configuration as following :
[li]Legato Application configuration[/li]
[li]In the “Main” tab : C/C++ Application = Target_Legato_Debug/staging/bin/helloWorld and Project = HelloWorld[/li]
[li]Nothing in “Arguments” or “Source” tabs[/li]
[li]In “Debugger” tab :
[list][]“Main” sub-tab : GDB debugger = ${externalTool:legato-linux-gdb-client}
As I want it to connect to the target as a client of the gdbserver running on it.[/li]
[li]“Gdbserver settings” sub-tab : Gdbserver name and Port number are locked to “gdbserver” and “2345”[/li][/ul][/

On the target, I launched the gdserver with :

root@swi-mdm9x15:/# gdbserver /opt/legato/apps/HelloWorld/bin/helloWorld Process /opt/legato/apps/HelloWorld/bin/helloWorld created; pid = 7477 Listening on port 2345

I then Debugged the Project through the configuration I described above and Devlopper Studio just threw the error quoted first.

Has anyone encountered this issue ?
Any idea is warmly welcomed :smiley: ?




there should be some incompatibility between your Developer Studio and Legato versions.
Legato beta version should be able to launch the gdbserver by itself, without needing you to launch it manually.
This is done by configuring the debug port in the project properties on Developer Studio side; go to:
Right-click menu > Properties… > Legato application > Build Settings
And add an entry in the list, with the executable name you want to debug + the associated debug port (in your case, should be “heloworld” and “2345”)

This will set the necessary configuration to enable debugging; i. e. when you’ll do the app start, it will start the gdbserver for you.
And actually when you launch the debug configuration from DS, it will also automatically trigger the app start command on the device.

This is the way that things are supposed to work, but one again, maybe your Legato version is too old.
While waiting for the Beta one, you could have a look at Remote C/C++ Application launch configurations to handle debugging.



Adding the entry in the list, with the executable name and the port (2345) solved the issue. The gdbserver was launched automatically when I started the debugging session.

Thanks daav !

Although gdb seems to be unable to step through the dynamic libraries loaded for the project. Is it possible to solve this issue (I’m running the Beta version) ?



Please can you give a concrete example of what you’re trying to do? Stepping into one of your library code? Stepping into a Legato library code?



I adapted the modemDemo app so it doesn’t use Sms reception. The app assesses the network and sim statuses, queries a data connection and give some infos about it (gateway, dns1 addresses, interface name).

I launched the debug session successfuly, with this warning message though:

warning: Unable to find dynamic linker breakpoint function. GDB will be unable to debug shared library initializers and track explicitly loaded dynamic code.

And I can “step over” all the functions but I can’t “step into” functions from legato’s framework.
For instance : le_mrc_AddNetRegStateHandler(NetRegStateHandler, NULL);

If I try to do so, the debug session is stopped with this error message in Debug View upon the current thread:

Thread[1] 16045 [core:0] (Suspended:Signal:SIGSEGV:Segmentation fault) No source available for "0xe7f001f0"



OK, thanks for the procedure. We’ve logged the issue; I’ll get back to you as soon as we have a fix or a workaround.


Please note that the debugger behavior has been improved in DS 3.1:
[li]It is now possible to step into Legato and components code[/li]
[li]Debug workflow has been greatly simplified; there is no need anymore to define a “debug port” in the project properties and rebuild the app to be able to debug it: it is now possible to trigger the debug session without rebuilding or even redownloading the app[/li][/ul]


My /opt is Empty !!! Can anyone tell me why and how I can get the path OP has suggested ?


Hi codegit001,

This thread is from 2014, the app path “/opt/legato/apps” is no longer used.
Please try “/legato/systems/current/apps”.