3
votes

Issue

I am trying to enable Pretty Printers on Windows to debug STL containers. I installed Eclipse, MinGW (to get gdb-python27 and Pretty Printers) and Python 2.7.7. After configuration, during debugging (from Eclipse and console), I am receiving the error: "ImportError: No module named _gdb".

Traceback (most recent call last):
  File "<string>", line 70, in <module>
  File "<string>", line 67, in GdbSetPythonDirectory
  File "c:\mingw\share\gdb/python\gdb\__init__.py", line 19, in <module>
    import _gdb
ImportError: No module named _gdb

Question

I am missing _gdb module. Is this module a part of Python? How should I get this? Did I missed something during configuration? Any direction that will guide me?

Rescue words - Help Me!

I tried to find the answer, but I cannot figure out how to solve the issue. I will appreciate if you could help me. Thank you!

Setup

  • Eclipse: Eclipse IDE for C/C++ Developers (Luna Service Release 1 (4.4.1)). I setup path to gdb-python27 and .gdbinit in Window -> Preferences -> C/C++ -> Debug -> GDB
  • MinGW: gdb-python.exe (GNU gdb (GDB) 7.5), Pretty Printers
  • Python: 2.7.7
  • Path: c:\MinGW\bin\
  • PYTHONHOME: C:/Program Files (x86)/Python27
  • PYTHONPATH: C:/Program Files (x86)/Python27/Lib/
  • .gdbinit:

    python import sys sys.path.insert(0, 'C:/MinGW/share/gcc-4.8.1/python') from libstdcxx.v6.printers import register_libstdcxx_printers register_libstdcxx_printers (None) end

Cause

MinGW GDB 7.5.1 uses Python Scripts from normal GDB 7.6.

Solution

I found the solution here: ANSWER.

Steps:

  1. Download gdb 7.5.1: GDB 7.5.1.
  2. Copy syscalls and python directories from gdb-7.5.1\gdb\ to MinGW\share\gdb.

Thank you

Thank you fukanchik for your support! Your answer helped me to find the cause and solution. Wish you the best!

Regards, Simon

2

2 Answers

1
votes

Cause

MinGW GDB 7.5.1 uses Python Scripts from normal GDB 7.6.

Solution

I found the solution here: ANSWER.

Steps:

  1. Download gdb 7.5.1: GDB 7.5.1.
  2. Copy syscalls and python directories from gdb-7.5.1\gdb\ to MinGW\share\gdb.

Thank you

Thank you fukanchik for your support! Your answer helped me to find the cause and solution. Wish you the best!

-2
votes

Simple tip that may work for any one have issues with pretty printers:

Replace every '\' inside .gdbinit file to '/' that worked for me!