Skip to content

Commit e0dda5b

Browse files
Improve the call stack display info for not avialable source (microsoft#72)
Signed-off-by: Jinbo Wang <[email protected]>
1 parent 574254a commit e0dda5b

1 file changed

Lines changed: 10 additions & 4 deletions

File tree

com.microsoft.java.debug.core/src/main/java/com/microsoft/java/debug/core/adapter/handler/StackTraceRequestHandler.java

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -92,10 +92,16 @@ private Types.StackFrame convertDebuggerStackFrameToClient(StackFrame stackFrame
9292
Types.Source clientSource = this.convertDebuggerSourceToClient(location, context);
9393
String methodName = method.name();
9494
int lineNumber = AdapterUtils.convertLineNumber(location.lineNumber(), context.isDebuggerLinesStartAt1(), context.isClientLinesStartAt1());
95-
if (lineNumber < 0 && method.isNative()) {
96-
// When the current stack frame stops at a native method, the line number is -1.
97-
// Display a tip text "native method" in the Call Stack View.
98-
methodName += "[native method]";
95+
// Line number returns -1 if the information is not available; specifically, always returns -1 for native methods.
96+
if (lineNumber < 0) {
97+
if (method.isNative()) {
98+
// For native method, display a tip text "native method" in the Call Stack View.
99+
methodName += "[native method]";
100+
} else {
101+
// For other unavailable method, such as lambda expression's built-in methods run/accept/apply,
102+
// display "Unknown Source" in the Call Stack View.
103+
clientSource = null;
104+
}
99105
}
100106
return new Types.StackFrame(frameId, methodName, clientSource, lineNumber, 0);
101107
}

0 commit comments

Comments
 (0)