# Remote GDB

**URL:** <https://forum.sierrawireless.com/t/remote-gdb/11917>\
**Category:** Uncategorized\
**Created:** [March 27, 2014, 4:25am UTC](https://forum.sierrawireless.com/t/remote-gdb/11917 "2014-03-27T04:25:30Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![davidc](https://avatars.discourse-cdn.com/v4/letter/d/a183cd/32.png) [@davidc](https://forum.sierrawireless.com/u/davidc)\
**Post date:** [March 27, 2014, 4:25am UTC](https://forum.sierrawireless.com/t/remote-gdb/11917/1 "2014-03-27T04:25:30Z")

</div>

Hi All,

This one’s for the Legato gurus 😃

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

---

<div class="post-metadata">

**Author:** ![daav](https://sea1.discourse-cdn.com/flex025/user_avatar/forum.sierrawireless.com/daav/32/2767_2.png) [@daav](https://forum.sierrawireless.com/u/daav)\
**Post date:** [March 27, 2014, 8:49am UTC](https://forum.sierrawireless.com/t/remote-gdb/11917/2 "2014-03-27T08:49:30Z")

</div>

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:  
[list]  
[\*]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.  
[/\*:m][/list:u]

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

---

<div class="post-metadata">

**Author:** ![davidc](https://avatars.discourse-cdn.com/v4/letter/d/a183cd/32.png) [@davidc](https://forum.sierrawireless.com/u/davidc)\
**Post date:** [March 28, 2014, 1:39am UTC](https://forum.sierrawireless.com/t/remote-gdb/11917/3 "2014-03-28T01:39:09Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![daav](https://sea1.discourse-cdn.com/flex025/user_avatar/forum.sierrawireless.com/daav/32/2767_2.png) [@daav](https://forum.sierrawireless.com/u/daav)\
**Post date:** [March 28, 2014, 7:37am UTC](https://forum.sierrawireless.com/t/remote-gdb/11917/4 "2014-03-28T07:37:30Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![davidc](https://avatars.discourse-cdn.com/v4/letter/d/a183cd/32.png) [@davidc](https://forum.sierrawireless.com/u/davidc)\
**Post date:** [March 28, 2014, 10:32pm UTC](https://forum.sierrawireless.com/t/remote-gdb/11917/5 "2014-03-28T22:32:31Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![daav](https://sea1.discourse-cdn.com/flex025/user_avatar/forum.sierrawireless.com/daav/32/2767_2.png) [@daav](https://forum.sierrawireless.com/u/daav)\
**Post date:** [March 31, 2014, 6:54am UTC](https://forum.sierrawireless.com/t/remote-gdb/11917/6 "2014-03-31T06:54:27Z")

</div>

> [@davidc](#):
>
> Although I guess you connect to a legato app using GDB in a similar fashion?

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.
