如何在代码中模拟 Delphi 断点? [英] How to simulate a Delphi breakpoint in code?

查看:22
本文介绍了如何在代码中模拟 Delphi 断点?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我很确定我以前见过这个,但我还没有发现/记得怎么做.我想要一行代码,当从 Delphi 调试器执行时,我希望调试器弹出,就像该行上有一个断点一样.

I am pretty sure I have seen this before, but I haven't found out / remembered how to do it. I want to have a line of code that when executed from the Delphi debugger I want the debugger to pop-up like there was a break point on that line.

类似:

FooBar := Foo(Bar);
SimulateBreakPoint; // Cause break point to occur in Delphi IDE if attached
WriteLn('Value: ' + FooBar);

希望这是有道理的.我知道我可以使用异常,但这会比我想要的要多得多.这是一些演示代码.

Hopefully that makes sense. I know I could use an exception, but that would be a lot more overhead then I want. It is for some demonstration code.

提前致谢!

推荐答案

从代码中触发调试器(据说我手头没有delphi的副本可以试试):

To trigger the debugger from code (supposedly, I don't have a copy of delphi handy to try):

asm int 3 end;

查看此页面:

http://17slon.com/blogs/gabr/2008/03/debugging-with-lazy-breakpoints.html

这篇关于如何在代码中模拟 Delphi 断点?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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