luceedebug icon indicating copy to clipboard operation
luceedebug copied to clipboard

Breakpoints and app restarts

Open zspitzer opened this issue 1 year ago • 5 comments

One issue I've noticed is seeing breakpoints blocking app restarts when using a framework

It's less painful on windows, as vs code gets the lovely red outline when paused on a breakpoint in the start menu, unlike on Mac

Anyway, I was wondering if there is a way to clear paused breakpoints from lucee?

Conversely being able to trigger a breakpoint from cfml code would also be unreal, but I'm not sure if that's remotely (sic) possible!

Googling this is rather challenging

zspitzer avatar Jul 13 '24 13:07 zspitzer

Anyway, I was wondering if there is a way to clear paused breakpoints from lucee?

Not at the moment, but I guess it might look something like

createObject("java", "luceedebug.Hypothetical").resumeAll()

I'm not 100% if the IDE supports being notified of thread resumption though -- usually it's the IDE telling the thread to resume, not the JVM telling the IDE it has resumed.

Conversely being able to trigger a breakpoint from cfml code would also be unreal, but I'm not sure if that's remotely (sic) possible!

I think you're talking about a debugger statement

My current workaround for this is to add a debugger-esque dummy statement and set a breakpoint on it, I always use 0+0; (just 0; seems to get optimized away), so like

someCode();
0+0; // set breakpoint on this
debugger; // ideally one could do
otherCode();

Adding a debugger statement might need some support from Lucee internals to parse it, and to add a mechanism to register a callback so statement invocation can jump into luceedebug. Also a key point is that the statement should be a no-op if there is no debugger, otherwise you leave a debugger statement in and crash in production (0+0 satsifies this rule).

softwareCobbler avatar Jul 13 '24 15:07 softwareCobbler

ohhh, 0+0; is a nice trick!

@michaeloffner what can we do here to help make this debugger support work.

If there's no debugger attached, Lucee could just ignore the debugger tag / directive?

zspitzer avatar Jul 14 '24 08:07 zspitzer

ohhh, 0+0; is a nice trick!

I'm unable to use it:

<cfscript>
writeOutput("before<br>");
0+0;
writeOutput("after");
</cfscript>

I'm able to set in vscode a breakpoint on first line and it works; but the debugger does not stop automagically on line "0+0";

luceedebug 2.0.12 lucee 6.1.0.243 jdk 11.0.24 (Eclipse Adoptium) 64bit windows

pibica avatar Aug 10 '24 22:08 pibica

I can't reproduce the above locally; if you can create a reproduction via a docker container I will look into it.

softwareCobbler avatar Aug 17 '24 14:08 softwareCobbler

I can't reproduce the above locally; if you can create a reproduction via a docker container I will look into it.

I've created one: https://github.com/pibica/luceedebug-bug-repo http://localhost:8888/issue-56.cfm

pibica avatar Aug 20 '24 18:08 pibica