Skip to content

Commit 3c10a1f

Browse files
don't hide function names from the callStackGet tagstack
1 parent 6c015f5 commit 3c10a1f

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

luceedebug/src/main/java/luceedebug/instrumenter/CfmOrCfc.java

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,18 @@ public MethodVisitor visitMethod(
196196
|| name.startsWith("udfDefaultValue")
197197
|| name.equals("staticConstructor")
198198
)) {
199-
final String delegateToName = "__luceedebug__" + name;
199+
// We'd like to retain the ability for `callStackGet` to return function names.
200+
// Lucee scans stack traces for frames starting with "udfCall" in order to reflect back the function names.
201+
// It will ignore wrappers (that start with "udfCall") because we don't visit line number info
202+
// in those functions (that is, our wrapper method that changes the body of the lucee function to call our
203+
// "delegated-to" function has no line info, but the delegated-to method does get line number info visited).
204+
// Because the wrapper methods have no line info, stack trace elems in those methods have line numbers of -1,
205+
// which luckily for us, means "ignore this frame", for Lucee's `callStackGet` method.
206+
// see `lucee.runtime.functions.system.CallStackGet`
207+
final String delegateToName = name.startsWith("udfCall")
208+
? "udfCall__luceedebug__" + name
209+
: "__luceedebug__" + name;
210+
200211
createWrapperMethod(access, name, descriptor, signature, exceptions, delegateToName);
201212

202213
final var mv = super.visitMethod(access, delegateToName, descriptor, signature, exceptions);

0 commit comments

Comments
 (0)