Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
28630 Discussions

Setting user breakpoints at runtime

ingo_berg
Beginner
460 Views
Hi,

What was the name of the Windows API function that allowed setting a user breakpoint at program runtime? I have a app that runs very fast and want to debug the running app but i do not want to start it from the debugger since im investigating an error that does not occur when starting the app from the debugger.

Regards,
Ingo
0 Kudos
4 Replies
Steven_L_Intel1
Employee
460 Views
DebugBreak
0 Kudos
ingo_berg
Beginner
460 Views
Is there already a module that enables DebugBreak for fortran or do I have to write my own interface? If so, can you give me an example how?
0 Kudos
Steven_L_Intel1
Employee
460 Views
USE KERNEL32

When you look up a Win32 API routine in the MSDN documentation, click the "check" on the page to see more information. It will list the library the routine is found in, such as "kernel32.lib". That's your clue as to the module name to use.

Here's a little program I wrote yesterday to test this API (and IsDebuggerPresent, which tells you if the program is running under the debugger).


program Console3

implicit none
integer i
do i=1,10
call sub (i)
end do

end program Console3

subroutine sub (i)
use kernel32
integer i, ret
if (i == 5) then
if (IsDebuggerPresent() /= 0) then
Call DebugBreak
else
write (*,*) "Not in debugger"
end if
end if
return
end subroutine sub
0 Kudos
ingo_berg
Beginner
460 Views
Thank you very much, this is all I need.
0 Kudos
Reply