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)
 

======================================

msys2 出现这个错误

网上的解决方案 一般是这个 

------------------------------------

解决方案: 
在自己的用户根目录下面新建.gdbinit文件 
cd ~ 
vim .gdbinit 
然后复制如下代码到.gdbinit文件:

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

但实验后 发现没有效果

搜索 gdbinit 发现 /etc/ 底下有一个 gdbinit

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)
end

发现这里的gcc-6.3.0 和 msys2里带的 gcc的版本不一样 把

'/../../gcc-6.3.0/python' 改成  '/../../gcc-7.3.0/python'  就可以了。。。

转载于:https://my.oschina.net/u/4000302/blog/2906875

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值