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

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

问题描述

我很确定我以前看过这个,但是我没有发现/记得如何做到这一点。我想要一行代码,当从Delphi调试器执行时,我希望调试器弹出,就像在该行上有一个断点。



如下所示:

  FooBar:= Foo(Bar); 
SimulateBreakPoint; //在Delphi IDE中导致断点发生在
WriteLn('Value:'+ FooBar);

希望这是有道理的。我知道我可以使用一个例外,但这样会是更多的开销,然后我想要。这是一些演示代码。



提前感谢!

解决方案

从代码触发调试器(据说我没有一个delphi的副本可以尝试):

  asm int 3结束

看到这个页面:



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


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.

Something like:

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.

Thanks in advance!

解决方案

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

asm int 3 end;

See this page:

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

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

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