编辑: 好吧,我不会放弃的。在
我试图在代码块中设置此项,但也不太奏效:
Starting debugger: C:\MinGW\bin\gdb-python27.exe -nx -fullname -quiet
done
Setting breakpoints
Attaching to program with pid: 7760
Debugger name and version: GNU gdb (GDB) 7.5
Attaching to process 7760
> source C:\MinGW\bin\.gdbinit
Traceback (most recent call last):
File "<string>", line 5, in <module>
File "C:\MinGW\share\gcc-4.8.1\python\libstdcxx\v6\printers.py", line 917, in register_libstdcxx_printers
register_type_printers(obj)
File "C:\MinGW\share\gcc-4.8.1\python\libstdcxx\v6\printers.py", line 855, in register_type_printers
add_one_type_printer(obj, 'basic_string', pfx + 'string')
File "C:\MinGW\share\gcc-4.8.1\python\libstdcxx\v6\printers.py", line 846, in add_one_type_printer
gdb.types.register_type_printer(obj, printer)
File "c:\mingw\share\gdb/python\gdb\types.py", line 179, in register_type_printer
locus.type_printers.insert(0, printer)
AttributeError: 'module' object has no attribute 'type_printers'
C:\MinGW\bin\.gdbinit:7: Error in sourced command file:
Error while executing Python code.
Error while executing Python code.
> python print sys.version
2.7.6 (default, Nov 10 2013, 19:24:18) [MSC v.1500 32 bit (Intel)]
> show version
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/>.
Debugger name and version: GNU gdb (GDB) 7.5
所以看起来这似乎与eclipse把事情搞砸无关,而是脚本的行为不端。在
编辑: 我刚刚启动了msys,导航到eclipse suposely所做的相同路径(2-environment-cdd:/work/ludum-dare/Debug),设置了相同的参数(除了5-enable-pretty-printing,因为gdb python似乎不知道这个设置),最后找到了.gdbinit,它甚至不想这么做。完全没有错误。在
当我单击debug时,有人知道如何找出eclipse试图运行什么吗?在
此外,我还尝试了“标准创建进程启动器”,起初运行得很顺利,但在跟踪控制台中滚动时,我看到它只是跳过了python文件中遇到的错误。在
编辑:我刚刚意识到,不设置5-enable-pretty-printing并不能设置“使用”gdb_-pp in打印机.py,所以无论如何它的运行方式都不会和eclipse中的相同。在
我想mingw+eclipse cdt中漂亮的打印被破坏了
完成以下步骤后:https://stackoverflow.com/a/14266862/3239702 我在eclipse中面临以下输出:
^{pr2}$我在网上搜索过其他有这个问题的人,但看起来我中了头奖。我得到了: C/C++开发人员
的Eclipse IDE版本:开普勒服务版本1 内部版本号:20130919-0819
我的mingw安装程序已全部更新,gdb-python27安装位置:
gdb-python-7.5.1-mingw32-bin.tar.lzma
python 2.7.6 32位 用户环境变量:
PYTHONHOME = C:\Python27
PYTHONPATH = C:\Python27\Lib
PATH = c:\mingw\bin
全局环境变量: 包含更多,我只发布相关部分:
PATH = C:\Python27\;
编辑: 我刚试过svn(svn://gcc.gnu.org/svn/gcc/trunk/libstdc++-v3/python)当然,我相应地改变了.gdbinit中的路径。 “gdb traces”控制台中的输出基本上是相同的,除了一些行号不同,但是这些行中的错误是相同的,所以我猜想只是发生了一些重构之类的事情。在
还有我现在的.gdbinit文件。在svn签出之前,使用了注释行而不是第4行:
python
import sys
# sys.path.insert(0, 'C:/MinGW/share/gcc-4.8.1/python')
sys.path.insert(0, 'D:/work/libstdc++-v3/python')
from libstdcxx.v6.printers import register_libstdcxx_printers
register_libstdcxx_printers (None)
end
编辑: 试着调试一下打印机.py脚本: 我在register\u libstdcxx_printers函数中添加了一些打印:
def register_libstdcxx_printers (obj):
"Register libstdc++ pretty-printers with objfile Obj."
global _use_gdb_pp
global libstdcxx_printer
print("initialy obj: " + str(obj))
print("_use_gdb_pp: " + str(_use_gdb_pp))
if _use_gdb_pp:
gdb.printing.register_pretty_printer(obj, libstdcxx_printer)
else:
if obj is None:
obj = gdb
obj.pretty_printers.append(libstdcxx_printer)
print("after gdb.printing.register_pretty_printer(obj, libstdcxx_printer): obj: " + str(obj))
register_type_printers(obj)
其输出为:
559,740 ~"initialy obj: None\n"
559,740 ~"_use_gdb_pp: True\n"
559,740 ~"after gdb.printing.register_pretty_printer(obj, libstdcxx_printer): obj: None\n"
我真的不能怪它在None上找不到“type_printers”属性,现在可以吗? 我想我的.gdbinit中的第6行没有:
register_libstdcxx_printers (None)
mingwgdb7.5.1使用普通gdb7.6中的Python脚本。因此脚本失败。在
在我把syscalls和python文件夹从
http://ftp.gnu.org/gnu/gdb/gdb-7.5.1.tar.gz
又试了一次,奇迹般地成功了。在
所以,对于将gdb7.6python脚本放入mingwgdb7.5.1包的人来说,这是一份“不错的工作”。不是。在
相关问题 更多 >
编程相关推荐