使用ipdb与emacs的gud没有明确的断点在代码中 [英] Using ipdb with emacs' gud without explicit breakpoints in code

查看:212
本文介绍了使用ipdb与emacs的gud没有明确的断点在代码中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用python.el
如果我从菜单中选择'debugger',并输入'python -m pdb myfile.py',gud启动,并且在一个分割帧中,我看到(Pdb)提示在一个,我的python代码在另一个与一个插入符号在第一行,表示它已经准备好了。例如,'n'步骤到下一行,插入符号相应地移动。

I'm using python.el If I choose 'debugger' from the menu, and enter 'python -m pdb myfile.py', gud starts, and in a split frame I see the (Pdb) prompt in one, and my python code in the other with a caret on the first line, indicating that it's ready to go. For example 'n' steps to the next line and the caret moves accordingly.

如果我输入'python -m ipdb myfile.py',则框架分裂,一个拆分被标记为gud,但没有ipdb控制台显而易见。换句话说,这种启动ipdb的方式似乎不起作用。如果我使用ipdb.set_trace()手动将断点插入到我的python代码中,Ipdb工作正常,但不使用gud界面。这是有意的,以便ipdb的堆栈跟踪将很好地工作吗?

If instead I enter 'python -m ipdb myfile.py', the frame splits, and one split is labeled gud, but there's no ipdb console evident. In other words, this way of starting ipdb doesn't seem to work. Ipdb works just fine if I manually insert a breakpoint into my python code using ipdb.set_trace(), except that it does not use the gud interface. Is this intentional so that ipdb's stack trace will work nicely?

如果是这样,这是很好的,但是有没有办法从emacs启动ipdb而不手动添加set_trace()命令?

If so, that's fine, but is there a way to start ipdb from emacs without manually adding a set_trace() command?

推荐答案

这里的基本问题是, gud 正在寻找一个(Pdb)提示符和 ipdb 不会以这种方式提示。有三种方法可以解决这个问题:修复 ipdb 以给出(Pdb)提示,修复 gud 不需要要查找(Pdb)或(我的最爱)在 gud 侧或 ipdb 侧。

There basic problem here is that gud is looking for a (Pdb) prompt and ipdb doesn't prompt this way. There are three ways to fix this: fix ipdb to give a (Pdb) prompt, fix gud not to need to look for (Pdb) or (my favorite) use something else either on the gud side or on the ipdb side.

修复 gud 的问题是,使用全局变量,而不是使用Emacs,这是相当老旧的,我的想法有点尴尬除了列表和 cons 单元格之外的Lisp数据结构可用。 gud 的完全重写称为 realgud ,它目前在MELPA中并且在某些时候也将在ELPA中。但是现在它不支持ipdb。 有关如何添加的说明ipdb 支持

The problem with fixing up gud is that it is rather old and to my mind a bit creaky using global variables and not making use of Emacs Lisp data structures available other than lists and cons cells. A total rewrite of gud is called realgud, it is currently in MELPA and at some point will be in ELPA as well. However right now it doesn't support ipdb. There are instructions for how one would add ipdb support though.

第二个选项是使用别的东西,所以让我建议一下 Python trepan调试器已被集成到 realgud (但不是 gud ,因为我认为那是一个死胡同)。虽然它给出的回溯并不完全像ipdb它使它们和源代码着色。

The second option is to use something else, so let me suggest the Python trepan debugger which is already integrated into realgud (but not gud since I consider that a dead end). Although the backtraces it gives are not exactly like ipdb's it does colorize them and the source code.

这篇关于使用ipdb与emacs的gud没有明确的断点在代码中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆