fdortu
October 4, 2022, 7:54am
1
Dear all,
I would like to speed up the launch of gdb when developping under VSCode / Torizon.
Loading symbols takes a lot of time, while these are always the same. For instance, the Debug Console shows hundreds of lines like this :
...
Reading /usr/lib/aarch64-linux-gnu/292df03e86d8c16a47592b4aca39d4e673f56d.debug from remote target...
Reading /usr/lib/aarch64-linux-gnu/.debug/292df03e86d8c16a47592b4aca39d4e673f56d.debug from remote target...
Reading /usr/lib/debug//usr/lib/aarch64-linux-gnu/292df03e86d8c16a47592b4aca39d4e673f56d.debug from remote target...
Reading /usr/lib/debug/usr/lib/aarch64-linux-gnu//292df03e86d8c16a47592b4aca39d4e673f56d.debug from remote target...
Reading target:/usr/lib/debug/usr/lib/aarch64-linux-gnu//292df03e86d8c16a47592b4aca39d4e673f56d.debug from remote target...
...
I tried to add a section in .vscode/launch.json
to enable caching as follows, but it does not help
"setupCommands": [
{
"description": "Setting architecture",
"text": "set architecture %{torizon.gdb-arch}",
"ignoreFailures": false
},
{
"description": "Setting cache on",
"text": "set index-cache on",
"ignoreFailures": false
}
Any other idea how to speed up gdb execution ?
Best regards,
Fabian
Hello @fdortu
I think that the correct syntax is:
set index-cache enabled on
Can you try with that and see if it works?
Best regards,
Josep
fdortu
October 5, 2022, 10:53am
3
Yes I already tried with enabled
as it is referenced in the manual, but then I get an error message from gdb saying the command does not exist.
Hi @fdortu !
Sorry for the delay. I asked internally if someone could help with this.
I will get back to you as soon as I have more information.
Best regards,
Hello @fdortu ,
You are right. Loading the symbols from the target to the host over the network causes a delay in building your program. What you could do as a workaround is to copy those shared libs from your target to a location in your host and set solib-absolute-prefix
and solib-search-path
to that location. This way, you don’t retrieve them through the network every time you start the session. In my setup, I copied the /lib/ld-linux-aarch64.so
file from my target to /tmp/host/lib/
on my host machine and modified the launch.json
file accordingly:
"setupCommands": [
{
"description": "Setting architecture",
"text": "set architecture %{torizon.gdb-arch}",
"ignoreFailures": false
},
{
"description": "Setting local path for target's shared object",
"text": "set solib-absolute-prefix /tmp/host",
"ignoreFailures": false
},
{
"description": "Setting search path for target's shared object",
"text": "set solib-search-path /tmp/host/lib",
"ignoreFailures": false
}
]
That solved this issue for me. Please let me know if that works for you. Happy coding
Best regards,
Rudhi
fdortu
November 4, 2022, 3:06pm
6
Great it works !
Actually, specifying set solib-absolute-prefix /tmp/host
is enough as long as the directory structure within /tmp/host
respects the one on the host.
Btw, comas are missing between the brackets }{
→ },{
In summary, the following works for me
"setupCommands": [
{
"description": "Setting architecture",
"text": "set architecture %{torizon.gdb-arch}",
"ignoreFailures": false
},
{
"description": "Setting local path for target's shared object",
"text": "set solib-absolute-prefix ${workspaceRoot}/cache-host",
"ignoreFailures": false
}
]
Hi @fdortu ,
I’m glad that it works for you. Also, thanks for pointing out the mistake. I have edited the solution by adding the comas so that it will be helpful to someone else later
Best regards,
Rudhi