msys2 執行gdb時 出現 ImportError: No module named libstdcxx.v6.printers

zero@zero-PC MSYS ~
$ gdb
GNU gdb (GDB) 7.11.1
Copyright (C) 2016 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-msys".
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".
Traceback (most recent call last):
  File "<string>", line 3, in <module>
ImportError: No module named libstdcxx.v6.printers
/etc/gdbinit:6: Error in sourced command file:
Error while executing Python code.
(gdb)
 html

======================================python

msys2 出現這個錯誤redis

網上的解決方案 通常是這個 vim

------------------------------------app

解決方案: 
在本身的用戶根目錄下面新建.gdbinit文件 
cd ~ 
vim .gdbinit 
而後複製以下代碼到.gdbinit文件:code

python
import sys 
sys.path.append("/usr/share/gcc-4.8/python")
end
-------------------------------htm

但實驗後 發現沒有效果string

搜索 gdbinit 發現 /etc/ 底下有一個 gdbinitit

python
import sys
sys.path.insert(0, sys.path[0] + '/../../gcc-6.3.0/python')
from libstdcxx.v6.printers import register_libstdcxx_printers
register_libstdcxx_printers (None)
endio

發現這裏的gcc-6.3.0 和 msys2裏帶的 gcc的版本不同 把

'/../../gcc-6.3.0/python' 改爲  '/../../gcc-7.3.0/python'  就能夠了。。。

相關文章
相關標籤/搜索