首页 > 解决方案 > gdb Python 漂亮的打印机不能与 MinGW Windows 一起使用

问题描述

我按照说明安装了以下网站中提到的 Python 漂亮打印机。 https://sourceware.org/gdb/wiki/STLSupport

我签出了我E:\Project目录中的 python 模块。我创建了一个.gdbinit文件并将路径替换为E:\Project\python最后将文件放在文件C:\Users\username夹中。(我什至尝试放置在当前工作目录中E:\Project)。

无论哪种情况,我似乎都会收到以下消息:

PS E:\Project> gdb .\practise
GNU gdb (GDB) 7.6.1
Copyright (C) 2013 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 "mingw32".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from E:\Project\practise.exe...done.
warning: File "E:\Project\.gdbinit" auto-loading has been declined by your `auto-load safe-path' set to "$debugdir:$datadir/auto-load".
To enable execution of this file add
        add-auto-load-safe-path E:\Project\.gdbinit
line to your configuration file "$HOME/.gdbinit".
To completely disable this security protection add
        set auto-load safe-path /
line to your configuration file "$HOME/.gdbinit".
For more information about this security protection see the
"Auto-loading safe path" section in the GDB manual.  E.g., run from the shell:
        info "(gdb)Auto-loading safe path"

我尝试set auto-load safe-path /.gdbinit文件中添加该行,但它继续显示相同的消息。

很少有关于 MinGW 的漂亮打印机的帖子。以下帖子中提到的方法也不起作用。 如何在 gdb 启动时加载 .gdbinit?

有人可以帮我让 Python 漂亮的打印机在 Windows 上与 MinGW 一起工作吗?

标签: pythonwindowsgdbmingwpretty-print

解决方案


原来MinGW安装的版本没有启用 Python。要检查是否gdb启用了 Python,请在 中执行以下命令gdb

(gdb) python print sys.version

如果不支持 Python,请MingW-W64-builds从他们的网站安装:http:
//mingw-w64.org/doku.php/download
该版本MinGW支持 Python。

确保您的系统上安装了 Python 2.7。
在更新.gdbinit文件时,Python 漂亮的打印机必须在 Windows 上工作。


推荐阅读