Skip to content

Commit fa14e9b

Browse files
committed
Use Log.info/warn for debugging stepping issues
1 parent 733c193 commit fa14e9b

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

luceedebug/src/main/java/luceedebug/coreinject/NativeDebuggerListener.java

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -474,12 +474,12 @@ public static PageContext getAnyPageContext() {
474474
public static PageContext getPageContext(long javaThreadId) {
475475
WeakReference<PageContext> ref = nativelySuspendedThreads.get(javaThreadId);
476476
if (ref == null) {
477-
Log.debug("getPageContext: thread " + javaThreadId + " not in suspended threads map. Map contains: " + nativelySuspendedThreads.keySet());
477+
Log.warn("getPageContext: thread " + javaThreadId + " not in map! Map=" + nativelySuspendedThreads.keySet());
478478
return null;
479479
}
480480
PageContext pc = ref.get();
481481
if (pc == null) {
482-
Log.debug("getPageContext: PageContext for thread " + javaThreadId + " was garbage collected");
482+
Log.warn("getPageContext: PageContext for thread " + javaThreadId + " was GC'd!");
483483
}
484484
return pc;
485485
}
@@ -500,23 +500,23 @@ public static SuspendLocation getSuspendLocation(long javaThreadId) {
500500
* @return true if the thread was found and resumed, false otherwise
501501
*/
502502
public static boolean resumeNativeThread(long javaThreadId) {
503-
Log.debug("resumeNativeThread: called for thread " + javaThreadId + ", suspended threads: " + nativelySuspendedThreads.keySet());
503+
Log.info("resumeNativeThread: thread=" + javaThreadId + ", map=" + nativelySuspendedThreads.keySet());
504504
WeakReference<PageContext> pcRef = nativelySuspendedThreads.remove(javaThreadId);
505505
if (pcRef == null) {
506-
Log.debug("resumeNativeThread: thread " + javaThreadId + " not found in suspended threads map");
506+
Log.warn("resumeNativeThread: thread " + javaThreadId + " not in map!");
507507
return false;
508508
}
509509
PageContext pc = pcRef.get();
510510
if (pc == null) {
511-
Log.debug("resumeNativeThread: PageContext for thread " + javaThreadId + " was garbage collected");
511+
Log.warn("resumeNativeThread: PageContext for thread " + javaThreadId + " was GC'd!");
512512
return false;
513513
}
514-
Log.debug("resumeNativeThread: calling debuggerResume() for thread " + javaThreadId);
514+
Log.info("resumeNativeThread: calling debuggerResume() for thread " + javaThreadId);
515515
try {
516516
// Call debuggerResume() via reflection (Lucee7+ method)
517517
java.lang.reflect.Method resumeMethod = pc.getClass().getMethod("debuggerResume");
518518
resumeMethod.invoke(pc);
519-
Log.debug("resumeNativeThread: debuggerResume() completed for thread " + javaThreadId);
519+
Log.info("resumeNativeThread: debuggerResume() completed for thread " + javaThreadId);
520520
return true;
521521
} catch (NoSuchMethodException e) {
522522
Log.error("debuggerResume() not available (pre-Lucee7?)");
@@ -625,7 +625,7 @@ public static int getStackDepth(PageContext pc) {
625625
*/
626626
public static void onSuspend(PageContext pc, String file, int line, String label) {
627627
long threadId = Thread.currentThread().getId();
628-
Log.debug("Suspend: thread=" + threadId + " file=" + Config.shortenPath(file) + " line=" + line + " label=" + label);
628+
Log.info("onSuspend: thread=" + threadId + " file=" + Config.shortenPath(file) + " line=" + line);
629629

630630
// Check if we were stepping BEFORE clearing state
631631
StepState stepState = steppingThreads.remove(threadId);
@@ -643,6 +643,7 @@ public static void onSuspend(PageContext pc, String file, int line, String label
643643
// Track the suspended thread so we can resume it later
644644
// We store PageContext (not PageContextImpl) to avoid class loading cycles
645645
nativelySuspendedThreads.put(threadId, new WeakReference<>(pc));
646+
Log.info("onSuspend: added thread " + threadId + " to map, map=" + nativelySuspendedThreads.keySet());
646647

647648
// Store suspend location for stack trace (needed when no native DebuggerFrames exist)
648649
// Include the exception if we're suspending due to one

0 commit comments

Comments
 (0)