Skip to content

Commit b4bb190

Browse files
Show grey Unknown Source node in call stack ui view for stackframe without attached source (microsoft#29)
Signed-off-by: Jinbo Wang <jinbwan@microsoft.com>
1 parent 28e4933 commit b4bb190

File tree

2 files changed

+17
-2
lines changed

2 files changed

+17
-2
lines changed

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,11 @@ private Types.Source convertDebuggerSourceToClient(Location location, IDebugAdap
123123
} else {
124124
// If the source lookup engine cannot find the source file, then lookup it in the source directories specified by user.
125125
String absoluteSourcepath = AdapterUtils.sourceLookup(context.getSourcePaths(), relativeSourcePath);
126-
return new Types.Source(sourceName, absoluteSourcepath, 0);
126+
if (absoluteSourcepath != null) {
127+
return new Types.Source(sourceName, absoluteSourcepath, 0);
128+
} else {
129+
return null;
130+
}
127131
}
128132
}
129133
}

com.microsoft.java.debug.plugin/src/main/java/com/microsoft/java/debug/plugin/internal/JdtSourceLookUpProvider.java

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,18 @@ public void acceptSearchMatch(SearchMatch match) {
227227
Object element = match.getElement();
228228
if (element instanceof IType) {
229229
IType type = (IType) element;
230-
uris.add(type.isBinary() ? getFileURI(type.getClassFile()) : getFileURI(type.getResource()));
230+
if (type.isBinary()) {
231+
try {
232+
// let the search engine to ignore those class files without attached source.
233+
if (type.getSource() != null) {
234+
uris.add(getFileURI(type.getClassFile()));
235+
}
236+
} catch (JavaModelException e) {
237+
// ignore
238+
}
239+
} else {
240+
uris.add(getFileURI(type.getResource()));
241+
}
231242
}
232243
}
233244
};

0 commit comments

Comments
 (0)