Re: GDB variants accepting plugins (to the debugger) ?
Basile Starynkevitch <[email protected]> Fri, 30 Jan 2026 18:03:26 +0100
| Newsgroups | gmane.comp.gdb.devel |
|---|---|
| Message-ID | <[email protected]> |
On Fri, 2026-01-30 at 10:35 -0500, Simon Marchi via Gdb wrote: > > > On 2026-01-30 08:33, Eli Zaretskii via Gdb wrote: > > > From: Basile Starynkevitch <[email protected]> > > > Cc: [email protected] > > > Date: Fri, 30 Jan 2026 14:13:51 +0100 > > > > > > I am using GDB-17.1 on Linux/Debian/x86-64 to debug a C++ coded, GPL licensed, inference engine > > > > > > > > > Is there any GDB variant accepting plugins to the debugger process > > > (these could be definitely useful to display C++ data in a nice way, std::vector or std::map instances come to mind immediately). > > > > > > I do know that GDB accept eg Guile or Python scripts. > > > But coding manually a Python or Guile function for every important C++ classes of a software is very time consuming > > > > Did you read the node "Auto-loading extensions" in the GDB manual? > > GDB installs such an auto-loaded extension for standard C++ classes, > > which actually uses printers.py provided by GCC/libstdc++ > > distribution. But you can use the same mechanism to provide > > extensions for your classes, if needed. > > Here's the file Eli is referring to, for libstdc++: > > https://gcc.gnu.org/git/?p=gcc.git;a=blob;f=libstdc%2B%2B-v3/python/libstdcxx/v6/printers.py;hb=HEAD > > And here is the API it uses: > > https://sourceware.org/gdb/current/onlinedocs/gdb.html/Pretty-Printing.html > > Simon I am (perhaps incorrectly) understanding that I could inside the ELF executable embed some ELF section containing Python code for GDB. https://sourceware.org/gdb/current/onlinedocs/gdb.html/dotdebug_005fgdb_005fscripts-section.html mention something. I don't understand if the script file name should be an absolute path, or a relative one? If the Python script is a relative path, is it relative the working directory of GDB or of the debugged process? Does anyone has some concrete toy -preferably opensource- example (for an open source C++ program, on Linux, and how to link that program to add the ELF sections containing Python code for the GDB debugger)? Thanks -- Basile STARYNKEVITCH basile AT starynkevitch DOT net 8 rue de la Faïencerie http://starynkevitch.net/Basile/ 92340 Bourg-la-Reine https://github.com/bstarynk France https://github.com/RefPerSys/RefPerSys https://orcid.org/0000-0003-0908-5250