pdb

Python (pdb) - Queueing up commands to execute

坚强是说给别人听的谎言 提交于 2019-12-05 02:57:20
问题 I am implementing a "breakpoint" system for use in my Python development that will allow me to call a function that, in essence, calls pdb.set_trace(); Some of the functionality that I would like to implement requires me to control pdb from code while I am within a set_trace context. Example: disableList = [] def breakpoint(name=None): def d(): disableList.append(name) #**** #issue 'run' command to pdb so user #does not have to type 'c' #**** if name in disableList: return print "Use d() to

How to make pdb recognize that the source has changed between runs?

只谈情不闲聊 提交于 2019-12-05 00:19:43
From what I can tell, pdb does not recognize when the source code has changed between "runs". That is, if I'm debugging, notice a bug, fix that bug, and rerun the program in pdb (i.e. without exiting pdb), pdb will not recompile the code. I'll still be debugging the old version of the code, even if pdb lists the new source code. So, does pdb not update the compiled code as the source changes? If not, is there a way to make it do so? I'd like to be able to stay in a single pdb session in order to keep my breakpoints and such. FWIW, gdb will notice when the program it's debugging changes

验证符号文件的又一方法(!itoldyouso)

柔情痞子 提交于 2019-12-04 23:19:15
如果您正在开发软件,很可能遇到了“不匹配的PDB”调试器错误。 当您将调试器指向错误的符号路径时,通常会发生这种情况。 但有时你确信你所指向的符号是正确的符号,这让你想知道为什么调试器认为这些符号不匹配。 "! sym noisy“将告诉您windows调试器如何搜索符号,并在遇到不匹配的pdb时报告它们,但它不会告诉您符号不匹配的原因。针对这一点,我们可以用扩展命令!itoldyouso !itoldyouso简介 这个扩展命令根据模块测试符号文件的有效性。模块可以由其名称或基址指定。如果未指定符号文件,则测试加载的符号。否则,如果指定了pdb或dbg符号文件路径,则针对加载的模块对其进行测试。 语法 !IToldYouSo <module> [symbol] module 模块,可以是名称也可以是地址 symbol 符号文件路径 用例 匹配的情况 0:000> !itoldyouso libcef F:\..\libcef.dll.pdb libcef.dll Timestamp: 5A9FC023 SizeOfImage: 2F86000 pdb: F:\Code\cef\2623\chromium\src\out\Release\libcef.dll.pdb pdb sig: BE989A0F-1981-4A33-8F9C-44FDDE3E2BB2 age: 1

How do I force Matplotlib to draw while in the ipdb debugger in Spyder (or any other debugger)?

柔情痞子 提交于 2019-12-04 10:07:35
问题 EDIT Unfortunately, at the moment this is not possible. I found out that it is a bug in Spyder. The developers are still figuring out how to approach this. Goal Visualize data while debugging code (and I want to use Spyder too!). Attempt #1: Run foo.bar from IPython from Spyder Create a file named foo.py with the following code: from ipdb import set_trace as st import matplotlib.pyplot as plt def bar(): st() While in IPython, type the following: In [4]: import foo In [5]: foo.bar() --Return--

Emacs python-mode: Keyboard shortcuts for pdb step-by-step debugging

让人想犯罪 __ 提交于 2019-12-04 06:51:57
I was wondering if there is a way to associate: n RET (next) p RET (previous) c RET (continue) C-x SPC RET (set/clear breakpoint) with function keys F1 - F12 or other keyboard shortcuts. The idea is to emulate the keyboard shortcuts that other IDEs have for debugging (e.g. Visual Studio, MATLAB, etc.). Is this already supported by python-mode? Are there any Emacs modes that can be used to complement python-mode for debugging purposes? gavenkoa You always can define own key-bindings in Emacs. Firstly type C-h m to see help on mode in pdb buffer (which start by M-x pdb ). Next bind any keyboard

Docs-.NET-C#-指南-语言参考-预处理器指令:#pragma checksum(C# 参考)

夙愿已清 提交于 2019-12-04 06:17:02
ylbtech-Docs-.NET-C#-指南-语言参考-预处理器指令:#pragma checksum(C# 参考) 1. 返回顶部 1、 #pragma checksum(C# 参考) 2015/07/20 生成源文件的校验和以帮助调试 ASP.NET 页面。 语法 C# 复制 #pragma checksum "filename" "{guid}" "checksum bytes" 参数 "filename" 需要监视更改或更新的文件的名称。 "{guid}" 哈希算法的全局唯一标识符 (GUID)。 "checksum_bytes" 表示校验和字节的十六进制数字的字符串。 必须是 偶数个十六进制数字 。 奇数个十六进制数字会导 致编译时警告出现,且指令遭忽略 。 备注 Visual Studio 调试器 使用校验和确保它可始终找到正确的源 。 编译器为源文件计算校验和,然后将输出发出到程序数据库 (PDB) 文件。 调试器随后使用 PDB 针对它为源文件计算的校验和进行比较。 此解决方案 不适用于 ASP.NET 项目 , 因为计算的校验和用于生成的源文件,而不用于 .aspx 文件 。 为解决此问题, #pragma checksum 为 ASP.NET 页面提供校验和支持。 在 Visual C# 中创建 ASP.NET 项目时,生成的源文件包含 .aspx 文件

Is there a trick to break on the print builtin with pdb?

主宰稳场 提交于 2019-12-04 03:37:18
问题 Basically, the title. I am trying to trace down where a spurious print happens in a large codebase, and I would like to break, or somehow get a stack trace whenever a print "happens." Any ideas? 回答1: For this particular case you can redirect stdout to a helper class that prints the output and its caller. You can also break on one of its methods. Full example: import sys import inspect class PrintSnooper: def __init__(self, stdout): self.stdout = stdout def caller(self): return inspect.stack()

How to get source/line number for IL instruction using Mono.Cecil

给你一囗甜甜゛ 提交于 2019-12-04 02:48:56
I'm using Mono.Cecil to write a simple utility that looks for type/method usage within .NET assemblies (ex. calling ToString on enums). I am able to get find the method, but it would be cool to display the source/line information to the user. Is this possible with Mono.Cecil? It is possible. First you should read the guide from the Mono.Cecil wiki about debugging symbols . Make sure you have Mono.Cecil.Pdb.dll near Mono.Cecil.dll, set the ReaderParameters to read the symbols as indicated in the guide, and then, instructions who have a sequence point in the pdb file will have their

What's a PDB file?

萝らか妹 提交于 2019-12-04 00:49:10
What's the PDB files inside the .NET dll files and what it does? Usually peoples remove this file in deploying and only keep the dll file in lib folders but it seems nothing happened and everything works well... So, what's the PDB files does? A Program Data Base file has nothing to do with incremental linking and Project State ! PDB files are used to map EXE with SOURCES. They are used for Debug and Release binaries. Here an article that explains this binding link between an Executable Image and its PDB file PDB files store the information that allows you to debug an application. The reason

Get reference to the current exception

与世无争的帅哥 提交于 2019-12-04 00:26:57
$ ./runtests.py -v tests/managers/test_customer.py:CustomerManagerTest.test_register_without_subscription --ipdb ... test_register_without_subscription (tests.managers.test_customer.CustomerManagerTest) ... - TRACEBACK -------------------------------------------------------------------- Traceback (most recent call last): File "/usr/lib/python2.7/unittest/case.py", line 331, in run testMethod() File "*****/tests/managers/test_customer.py", line 198, in test_register_without_subscription 1/0 ZeroDivisionError: integer division or modulo by zero ---------------------------------------------------