Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -66,14 +66,14 @@ public CompletableFuture<Response> handle(Command command, Arguments arguments,
int totalFrames = 0;
if (thread != null) {
try {

totalFrames = thread.frameCount();
if (totalFrames <= stacktraceArgs.startFrame) {
response.body = new Responses.StackTraceResponseBody(result, totalFrames);
return CompletableFuture.completedFuture(response);
}
StackFrame[] frames = context.getStackFrameManager().reloadStackFrames(thread);

int count = stacktraceArgs.levels == 0 ? totalFrames - stacktraceArgs.startFrame
: Math.min(totalFrames - stacktraceArgs.startFrame, stacktraceArgs.levels);
for (int i = stacktraceArgs.startFrame; i < frames.length && count-- > 0; i++) {
Expand Down Expand Up @@ -108,7 +108,9 @@ private Types.StackFrame convertDebuggerStackFrameToClient(StackFrame stackFrame
if (lineNumber < 0 && !location.method().isNative()) {
// For other unavailable method, such as lambda expression's built-in methods run/accept/apply,
// display "Unknown Source" in the Call Stack View.
clientSource = null;
clientSource = new Types.Source("Unknown Source", "unknown", 0);
// DAP specifies lineNumber to be set to 0 when unavailable
lineNumber = 0;
}
String presentationHint = decodedMethod.isGenerated() ? "subtle" : null;
return new Types.StackFrame(frameId, formattedName, clientSource, lineNumber, context.isClientColumnsStartAt1() ? 1 : 0, presentationHint);
Expand Down Expand Up @@ -139,7 +141,7 @@ public static Types.Source convertDebuggerSourceToClient(String fullyQualifiedNa
IDebugAdapterContext context) throws URISyntaxException {
// use a lru cache for better performance
String uri = context.getSourceLookupCache().computeIfAbsent(fullyQualifiedName, key -> {

String fromProvider = context.getProvider(ISourceLookUpProvider.class).getSourceFileURI(key, relativeSourcePath);
// avoid return null which will cause the compute function executed again
return StringUtils.isBlank(fromProvider) ? "" : fromProvider;
Expand Down