It doesn't work for the wx print.
When i find some time i will use "source -p" like wxWidgets team say:
this file is meant to
# be sourced from gdb using "source -p" (or, better, autoloaded
# in the future...)
OK, I understand your problem. Here is the method to solve this problem.
First, you download the file
https://github.com/wxWidgets/wxWidgets/blob/master/misc/gdb/print.py
For me, I renamed this file to wxprint.py, and I saved it to the same folder as the gdbinit file locates.
Then, I modify the gdbinit file as below:
python
import sys
sys.path.insert(0, sys.path[0] + '/../../gcc-10.2.0/python')
from libstdcxx.v6.printers import register_libstdcxx_printers
register_libstdcxx_printers (None)
sys.path.insert(0, sys.path[0] + '/../../../etc')
import wxprint
end
Look at the two lines:
sys.path.insert(0, sys.path[0] + '/../../../etc')
import wxprint
The first line adds the current directory of the wxprint.py, and the second line just imports the wxprint.py file. I think the "import" directive us just like the "source" directive in Python, am I correct?
Anyway, this works OK in my msys2. I can have both wxWidgets and C++ std library's pretty printers working when debugging.
BTW: I haven't find a simple way to load the wxprint.py file, I just want to avoid the first line, but that line is always needed
. Maybe, some guys can improve the loading code.