softwareCobbler / luceedebug

line debugger for lucee
GNU Lesser General Public License v2.1
42 stars 15 forks source link

Breakpoints and app restarts #56

Open zspitzer opened 1 month ago

zspitzer commented 1 month ago

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

softwareCobbler commented 1 month ago

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).

zspitzer commented 1 month ago

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?

pibica commented 3 weeks ago

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

softwareCobbler commented 2 weeks ago

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

pibica commented 1 week ago

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