断点处的交互式 pyDev 控制台
我使用 Aptana Studio 和 Pydev 1.5.3 来调试我的 Django 应用程序。我使用 PyDev 的远程调试器和 manage.py 中的一些代码,并且在大多数情况下,此设置都可以成功运行 - 我可以设置断点、检查变量并单步执行/继续执行我的代码。
然而,我想在断点处执行任意代码——这是从 pdb 切换到 Eclipse 调试后我真正想念的事情。调试视角中有一个交互式控制台可用,但它对我来说不活动。
所以我的问题是——是否可以在 PyDev 中使用远程调试器设置一个交互式控制台,该控制台可以在断点处“注入”代码?
I'm using Aptana Studio with Pydev 1.5.3 to debug my Django applications. I use PyDev's remote debugger and some code in manage.py and for most of the time this setup is working successfully- I can set breakpoints, inspect variables and step/continue through my code.
However, I'd like to execute arbitrary code at the breakpoint- the thing I really miss after switching from pdb to Eclipse debugging. There is an interactive console available in debug perspective but it is inactive for me.
So my question- is it possible to set up an interactive console in PyDev with remote debugger which could "inject" code at breakpoint?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
奇怪的是,我使用 pydev 1.5.6 进行远程调试,我可以使用交互式控制台 - 我输入 cmmand,按 Enter 键,过了一会儿就得到结果;检查您的防火墙没有阻止任何内容(如果您确定,交互式控制台在本地模式下工作)。 pydev 源代码中甚至有设置来设置应将多少标准输出返回给客户端(以字符形式),它应该可以工作
strange, i am using pydev 1.5.6 for remote debugging and I can use the interactive console - i type the cmmand, hit enter, after a while get results back; check your firewall is not blocking anything (if you are sure, the interactive console works in local mode). there is even settings in pydev source code to set how much of stdout should be returned back to client (in chars), it should work
经过一番挖掘后,我发现我可以使用表达式视图来访问变量属性并查看类方法的结果,但这仍然不是断点处的完整控制台。
After some digging I discovered that I can use Expressions view to access variables properties and view results of class methods, but that still isn't a complete console at breakpoint though.
对于 PyDev 1.5.5,它应该是可能的:
它仅用于检查,并且以一种非常奇怪的方式:您必须在“调试服务器”控制台中输入文本,然后您将在“文件名”控制台中获得输出。
另请注意,您需要按两次 Enter 键,留空行。
虽然“空行”技巧已被记录,但有关输入和输出的两个不同控制台的问题却没有记录,我认为这可能是一个错误。
With PyDev 1.5.5 it should be possible:
It is only for inspection and in a very strange way: you have to input the text in the "Debug server" console, and you will get the output in the "filename" console.
Note also that you need to press enter twice, leaving an empty line.
While the "empty line" trick is documented, the issue about two different console for input and output is not, and I think it may be a bug.
在我的开发堆栈上,运行 Apache + mod_wsgi,在控制台中输入命令,将其输出路由到站点的错误日志。要解决此问题,您需要设置
stdoutToServer=True
和sterrToServer=True
将捕获的所有输出路由到 PyDev 远程调试器:On my development stack running Apache + mod_wsgi entering commands into the console had their output routed to the site's error logs. To resolve this you have set the
stdoutToServer=True
andsterrToServer=True
to route capture all output to the PyDev remote debugger: