User forums > Using Code::Blocks

Debugger: use gdb python pretty printer for the libstdcxx under msys2

(1/3) > >>

ollydbg:
Hi, this is my way to use gdb python pretty printer for the libstdcxx under msys2.
Suppose you use 64bit gcc compiler. My msys2 is installed under F:\msys64

In the Menu->Settings->Debugger settings. Open the debugger plugin setting dialog.

Then, in the "Executable path" field, select "F:\msys64\mingw64\bin\gdb.exe"
in the "Debugger initialization commands" field, put the following text in the edit control.

--- Code: ---source F:\msys64\mingw64\etc\gdbinit

--- End code ---

I see that I have to modify the file "F:\msys64\mingw64\etc\gdbinit" file: below is the original code


--- Code: ---python
import sys
sys.path.insert(0, sys.path[0] + '/../../gcc-9.2.0/python')
from libstdcxx.v6.printers import register_libstdcxx_printers
end

--- End code ---

But you have to add one line before the "end" statement like below to let the register_libstdcxx_printers function get executed.


--- Code: ---python
import sys
sys.path.insert(0, sys.path[0] + '/../../gcc-9.2.0/python')
from libstdcxx.v6.printers import register_libstdcxx_printers
register_libstdcxx_printers(None)
end

--- End code ---

BTW: It is the same thing to add the python pretty printer for wxWidgets. You can use this file:

--- Code: ---https://github.com/wxWidgets/wxWidgets/blob/master/misc/gdb/print.py
--- End code ---

BlueHazzard:
a wiki article would be nice :)

ollydbg:

--- Quote from: BlueHazzard on November 30, 2019, 01:50:03 pm ---a wiki article would be nice :)

--- End quote ---

Done, see here: Configure GDB pretty printer for Msys2 - CodeBlocks

Though a bit late.

BlueHazzard:
Great!

Suryavarman:
It doesn't work for the wx print.
When i find some time i will use "source -p" like wxWidgets team say:


--- Quote ---this file is meant to
#               be sourced from gdb using "source -p" (or, better, autoloaded
#               in the future...)
--- End quote ---

Navigation

[0] Message Index

[#] Next page

Go to full version