ImportError: No module named _gdb

  • Thread starter Marcelo Sardelich
  • Start date

M

Marcelo Sardelich

So I'm trying to implement pretty printing information using gdb-python27 on Windows7

Hopefully, someone experienced the same issue.

GDB is working fine, but when I run gdb-python27 I got the following error (related to a python import):

C:\MinGW\bin>gdb-python27.exe
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
GNU gdb (GDB) 7.5
Copyright (C) 2012 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "i686-pc-mingw32".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
warning: File "C:\MinGW\bin\.gdbinit" auto-loading has been declined by your `auto-load safe-path' set to "$debugdir:$datadir/auto-load".
(gdb)

Does anybody have any clue about this issue?

Best, Marcelo.

PS: I posted same question to MinGW group, but maybe the issue is related to Python.

Below, config information:

OS Windows 7

C:\MinGW\bin>cat .gdbinit
python
import sys
sys.path.insert(0, 'c:/gdb-printers/python')
from libstdcxx.v6.printers import register_libstdcxx_printers
register_libstdcxx_printers (None)
end

C:\MinGW\include>gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=c:/mingw/bin/../libexec/gcc/mingw32/4.8.1/lto-wrapper.exe
Target: mingw32
Configured with: ../gcc-4.8.1/configure --prefix=/mingw --host=mingw32 --build=mingw32 --without-pic --enable-shared --enable-static --with-gnu-ld --enable-lto --enable-libssp --disable-multilib --ena
ble-languages=c,c++,fortran,objc,obj-c++,ada --disable-sjlj-exceptions --with-dwarf2 --disable-win32-registry --enable-libstdcxx-debug --enable-version-specific-runtime-libs --with-gmp=/usr/src/pkg/gm
p-5.1.2-1-mingw32-src/bld --with-mpc=/usr/src/pkg/mpc-1.0.1-1-mingw32-src/bld --with-mpfr= --with-system-zlib --with-gnu-as --enable-decimal-float=yes --enable-libgomp --enable-threads --with-libiconv
-prefix=/mingw32 --with-libintl-prefix=/mingw --disable-bootstrap LDFLAGS=-s CFLAGS=-D_USE_32BIT_TIME_T
Thread model: win32
gcc version 4.8.1 (GCC)

C:\MinGW\include>python
Python 2.7.6 (default, Nov 10 2013, 19:24:18) [MSC v.1500 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
w32api.h (version):

#define __W32API_VERSION 3.17
#define __W32API_MAJOR_VERSION 3
#define __W32API_MINOR_VERSION 17

_mingw.h (version):

#define __MINGW_VERSION 4.0
#define __MINGW_MAJOR_VERSION 4
#define __MINGW_MINOR_VERSION 0
#define __MINGW_PATCHLEVEL 0

/* The following four macros are deprecated and will be removed
* in the release greater than 4.1.
*/
#define __MINGW32_VERSION 3.20
#define __MINGW32_MAJOR_VERSION 3
#define __MINGW32_MINOR_VERSION 20
#define __MINGW32_PATCHLEVEL 0
 
Ad

Advertisements

D

dieter

Marcelo Sardelich said:
So I'm trying to implement pretty printing information using gdb-python27 on Windows7

Hopefully, someone experienced the same issue.

GDB is working fine, but when I run gdb-python27 I got the following error (related to a python import):

C:\MinGW\bin>gdb-python27.exe
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

Likely, an external ("C") extension (named "_gdb") must be build
(and installed) - and apparently, this is not yet done in your installation.
 
M

Marcelo Sardelich

Didier thanks for your prompt reply.

I installed a pre-built version of Python.
As you said, probably something is missing.

I tried to google packages related to gdb, but ain't had no luck.

Do you have any idea if it is a compiler directive? I mean I can compile Python from source. Not a problem.

Let me know..
 
Ad

Advertisements

D

dieter

Marcelo Sardelich said:
Didier thanks for your prompt reply.
I installed a pre-built version of Python.
As you said, probably something is missing.

I tried to google packages related to gdb, but ain't had no luck.

The missing part is related to the gdb-Python integration.
Look around for information about this integration - e.g.
installation instructions.

What is missing is apparently a C extension for Python. When you have
the source of this package, then it may contain a "setup.py".
In this case "[sudo] python setup.py install" may do everything necessary
to get a working C extension.

Do you have any idea if it is a compiler directive?

Not for this problem.

However, using "gdb" usually profits considerably from
having debugging symbols. A system installed Python usually
lacks those symbols. Therefore, after you have solved
the current problem, it may be profitable to compile your
own Python from source.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top