Forum > Debugger
An instruction to pause the debugger. [SOLVED]
BrunoK:
Marking discussion as SOLVED.
--- Quote from: 440bx on June 29, 2024, 06:57:23 pm ---If you are using Windows, use DebugBreak(), that one works. I use it all the time.
--- End quote ---
Thank you very much, this works on Windows with FPDebugger provided the Uncheck'ed IgnoreAll as indicated by Martin.
No need of USES Windows ...
The bit of code (CocoR) ends up being :
--- Code: Pascal [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} --- while fCurrentInputSymbol<>EOFSYMB do begin if fCurrentInputSymbol=lAheadSym then begin DebugBreak; { Some checking about aAfterSymName preceding found aAheadSymName } if lPrevSym<>lAfterSym then DebugBreak; lDefaultSym := lAfterSym; Exit; end; lPrevSym := fCurrentInputSymbol; Get; end; That pop's up the Call Stack when reaching one the DebugBreak instructions, then one F7 single step places you on the next executable line.
Maybe, just maybe, a feature would be the debugger poping the source at the DebugBreak instruction as if a Break point had been set there.
This is very useful and I should have asked many months/year ago.
440bx:
--- Quote from: BrunoK on June 29, 2024, 07:41:33 pm ---This is very useful and I should have asked many months/year ago.
--- End quote ---
Just in case you might find this useful, this is what I do:
--- Code: Pascal [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} --- if IsDebuggerPresent() then begin DebugBreak(); end; Checking if the debugger is present before calling DebugBreak() allows leaving the debugging code in the executable. This makes removing the DebugBreak() in the release version unnecessary. Without the check for the Debugger presence then the calls to DebugBreak() have to be removed or placed in a {$ifdef } conditional compilation because if a DebugBreak() occurs without a debugger to catch it, Windows will report it as an unhandled exception and terminate the program (usually not a desirable outcome ;) )
Activating the DebugBreak() only if a debugger is present is a very convenient and practical solution. The cost is a slight increase in code size (I think about 8 bytes total per instance... that's nothing in today's machines.)
HTH.
Martin_fr:
--- Quote from: BrunoK on June 29, 2024, 07:41:33 pm ---Maybe, just maybe, a feature would be the debugger poping the source at the DebugBreak instruction as if a Break point had been set there.
--- End quote ---
There are a lot of refinements this could get. But, even though I do note that there is more interest than was originally anticipated, it will have to wait. Too many other things on my list.
BrunoK:
--- Quote from: 440bx on June 29, 2024, 07:54:36 pm ---Just in case you might find this useful, this is what I do:
--- Code: Pascal [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} --- if IsDebuggerPresent() then begin DebugBreak(); end;
--- End quote ---
Noted, thank you.
440bx:
You're welcome Bruno.
Navigation
[0] Message Index
[#] Next page
[*] Previous page