Type: Debugger
The pretty-printers don't work for remote debugging with gdbserver,
whilst they do work for local debugging with gdb only.
target machine with Ubuntu 18.04:
gdbserver :10000 ./test_app
host machine with Ubuntu 18.04:
Visual Studio Code - debugging
Describe the bug
To Reproduce
The launch.json configuration:
{
"name": "C++ Remote Debug - local",
"type": "cppdbg",
"request": "launch",
"miDebuggerPath":"/usr/bin/gdb",
"miDebuggerServerAddress": "x.x.x.x:10000",
"program": "/home/slawek/test_app",
"cwd": "/home/slawek",
"externalConsole": true,
"linux": {
"MIMode": "gdb",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
},
{
"description": "Auto load symbols when loading an .so file",
"text": "set auto-solib-add",
"ignoreFailures": false
}
]
},
},
Additional context
Here is the launch.json configuration for local debugging with gdb:
{
"name": "(gdb) Launch",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/test_app",
"args": [],
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
"environment": [],
"externalConsole": false,
"MIMode": "gdb",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
]
},
@slawmilcz When you say they don't work, are you saying that gdb <-> gdbserver doesn't support pretty printing or that our extension is doing something wrong?
Hi, I don't know if the problem is in your extension or somewhere between gdb and gdbserver.
I see that your extension does provide an option to enable pretty-printers also for the configuration with gdbserver, so I assumed that gdb <-> gdbserver should support it. However I failed to run it successfully on my side and I found no special instructions on your website to apply. So please advice if you managed to get it up and running when validating this option. Thanks in advance.
The default json adds that flag if you use gdb. It doesn't necessarily mean it works with gdb <-> gdbserver.
OK, I understand that you don't have any evidence for this feature to work with gdbserver.
Do you have any other extensions with debugging helpers for libstdc++ that could be used successfully for remote debugging with gdbserver? Thank you for your support.
@slawmilcz This article seems to solve the gdbserver problem. It looks like a problem with where the pretty printers are located in that they need to be in the same spot on both machines.
Let me know if that helps.
Yes, this article was very helpful for me to understand how to set up pretty-printers for remote debugging with gdbserver. For the configuration with both local and remote machines running on Ubuntu 18 all I had to do was create on the local machine in its home directory the .gdbinit file with correct path to the libstdc++ pretty-printer. Many, many thanks for your help!
@slawmilcz did you fix your problem? I'm following the instructions and my pretty print still without working
Never mind, I just looked again step by step and adapting the locations of the files mentioned there into my context and I was able to achieve it.
I just want to warn the next persons that face this problem, that the files referenced on the post may not be in the exact paths mentioned but in a totally different path, that depends on your SO or distro.
I managed to configure it on Debian 9 using this config in ~/.gdbinit:
python
import sys
sys.path.insert(0, '/usr/share/gcc-6/python/')
from libstdcxx.v6.printers import register_libstdcxx_printers
register_libstdcxx_printers (None)
end
@Ecordonnier This works for me. It's great!
This issue has been closed automatically because it's labeled as 'external'.