This is the mail archive of the gdb@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: How to load C++ pretty-printers


On Sat Mar 16 2019 20:58:22 GMT+0800, Eli Zaretskii wrote:
>> From: asmwarrior <asmwarrior@gmail.com>
>> 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



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]