Re: How to load C++ pretty-printers

asmwarrior <[email protected]>
Newsgroups gmane.comp.gdb.devel
Message-ID <[email protected]>
On Sat Mar 16 2019 20:58:22 GMT+0800, Eli Zaretskii wrote:
>> From: asmwarrior <[email protected]>
>> Date: Sat, 16 Mar 2019 20:41:13 +0800
>>
>> Under My Windows 7 system, I'm using such commands(I put them in a my.gdb script file) to load and register the pretty printers.
>> I put the libstdcxx folder in the same folder as the my.gdb file.
>>  

The file "my.gdb" is a simple text script file, which contains the lines(commands) below

>>
>> set auto-load safe-path $debugdir;$datadir/auto-load
>> python
>> import sys
>> sys.path.insert(0, '')
>> from libstdcxx.v6.printers import register_libstdcxx_printers
>> # load other pretty printers
>> end


> Thanks, but I don't think I understand which part(s) of this are
> necessary in my case.  E.g., is the "set auto-load" command
> needed/relevant?  

Currently, I don't have an idea about whether "set auto-load" command is relevant or not. I use this script for several years.
I think for your original question, you need one line:

from libstdcxx.v6.printers import register_libstdcxx_printers

But you should let GDB know where the "libstdcxx" folder locates.

> Also, which of the commands you've shown actually loads the
> pretty-printers from their file?

I just type the command below:
source d:/path/to/my.gdb

Asmwarrior
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.