python exception No module named gdb:

后端 未结 4 1417
半阙折子戏
半阙折子戏 2020-12-17 20:35

I\'ve just compiled gdb 7.8 from source in my home directory on a server machine running linux. I had previously been using gdb 7.6, and aside from

相关标签:
4条回答
  • 2020-12-17 21:15

    You should specify the value of "--data-directory". For example, if you load gdb from the build directory, the command should be:

    ./gdb -data-directory ./data-directory
    

    Then gdb can know where to find python module.

    You can refer this discussion.

    0 讨论(0)
  • 2020-12-17 21:17

    just to complete the above responses:

    Probably you have copied the executable gdb to /usr/local/bin (which is my way to prioritize the lastest gdb that I installed as default shell gdb, while preventing messing up with the default Ubuntu's gdb). Then you should consider that you must give the data-directory parameter from the original place to the one that you have copied in /usr/local/bin. So that would be:

    /usr/local/bin/gdb --data-directory=/path_to_fully_installed_gdb_folder/data-directory
    

    PS: I did this for gdb-8.1 on Ubuntu 16.04

    0 讨论(0)
  • 2020-12-17 21:22
    root@labs:~/gdb-8.1# gdb --version
    Python Exception <type 'exceptions.ImportError'> No module named gdb: 
    gdb: warning: 
    Could not load the Python gdb module from `/usr/local/share/gdb/python'.
    Limited Python support is available from the _gdb module.
    Suggest passing --data-directory=/path/to/gdb/data-directory.
    ....
    

    Try to cp python lib to --data-directory=/path/to/gdb/data-directory. My data directory is /usr/local/share/gdb/python,

    # mkdir -p /usr/local/share/gdb/python/gdb
    # cp -rf ~/gdb-8.1/gdb/python/lib/gdb/* /usr/local/share/gdb/python/gdb/
    
    
    # gdb --version
    GNU gdb (GDB) 8.1
    Copyright (C) 2018 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 "x86_64-pc-linux-gnu".
    Type "show configuration" for configuration details.
    For bug reporting instructions, please see:
    <http://www.gnu.org/software/gdb/bugs/>.
    Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.
    For help, type "help".
    Type "apropos word" to search for commands related to "word".
    
    0 讨论(0)
  • 2020-12-17 21:23

    I just ran into this and wanted to share what I found. During compilation, specifically the 'make install' step, I noticed this message:

    WARNING: `makeinfo' is missing on your system.  You should only need it if
             you modified a `.texi' or `.texinfo' file, or any other file
             indirectly affecting the aspect of the manual.  The spurious
             call might also be the consequence of using a buggy `make' (AIX,
             DU, IRIX).  You might want to install the `Texinfo' package or
             the `GNU make' package.  Grab either from any GNU archive site.
    

    It sounds as if it's OK that I don't have makeinfo, but in fact it led to the error that the OP asked about. After installing texinfo I then reran make install and ran gdb with no python error message.

    0 讨论(0)
提交回复
热议问题