You can fire a debugger breakpoint using either of these two:
asm int 3 end
which is the x86 debug interruptDebugBreak()
which is the Windows API function wrapping the above interrupt
I’m not sure how accurate it is (in the past it would fail under some debuggers other than the Delphi IDE), but as of Delphi 2, there is a DebugHook
variable that is non-zero when running under the Delphi debugger, so you can protect your code.
Via [WayBack] I remember some time ago, Jeroen Pluijmers posted a snippet of how to place a breakpoint directly in the Delphi source without relying on the F5 key. – Alberto Paganini – Google+
Related:
- [WayBack] debugging – How to simulate a Delphi breakpoint in code? – Stack Overflow
- [WayBack] The Delphi Geek: Debugging With Lazy Breakpoints
- [WayBack] System.DebugHook Variable
- [WayBack] DebugBreak function (Windows)
- [WayBack] DebugBreak and __debugbreak
- [WayBack] __debugbreak
- [WayBack] c++ – How to get a declaration for DebugBreak without including Windows.h? – Stack Overflow
- [WayBack] GitHub – scottt/debugbreak: break into the debugger programmatically
- [WayBack] Forcing a DebugBreak() | Dr Dobb’s
- [WayBack] Embarcadero Debuggers – RAD Studio
–jeroen