Visitar URL original
SourceLookup fails for dependencies · Issue #100 · microsoft/java-debug · GitHub
The Wayback Machine - https://web.archive.org/web/20201202182626/https://github.com/microsoft/java-debug/issues/100
Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SourceLookup fails for dependencies #100

Open
gorkem opened this issue Nov 13, 2017 · 2 comments
Open

SourceLookup fails for dependencies #100

gorkem opened this issue Nov 13, 2017 · 2 comments
Assignees

Comments

@gorkem
Copy link
Collaborator

@gorkem gorkem commented Nov 13, 2017

Setting a breakpoint to a file from a dependency fails on source lookup.

In my gradle project I have dependency to compile group: 'xerces', name: 'xercesImpl', version:'2.11.0 and I am trying to set a breakpoint on 'org.apache.xerces.parsers.DomParser.parse()' which is located on this dependency. I can browse to the file through vscode and see the code but when I try to set the breakpoint it fails with the below stacktrace.

[Error - 12:12:00] 13-Nov-2017 12:10:58 PM DebugSession dispatch exception: java.lang.IllegalStateException: Java Model Exception: Java Model Status [/Users/gercan/.m2/repository/xerces/xercesImpl/2.11.0/xercesImpl-2.11.0.jar is not on its project's build path]
	at org.eclipse.jdt.internal.core.JavaElement.newJavaModelException(JavaElement.java:570)
	at org.eclipse.jdt.internal.core.Openable.generateInfos(Openable.java:247)
	at org.eclipse.jdt.internal.core.Openable.openAncestors(Openable.java:505)
	at org.eclipse.jdt.internal.core.Openable.generateInfos(Openable.java:241)
	at org.eclipse.jdt.internal.core.Openable.openAncestors(Openable.java:505)
	at org.eclipse.jdt.internal.core.Openable.generateInfos(Openable.java:241)
	at org.eclipse.jdt.internal.core.JavaElement.openWhenClosed(JavaElement.java:583)
	at org.eclipse.jdt.internal.core.JavaElement.getElementInfo(JavaElement.java:320)
	at org.eclipse.jdt.internal.core.JavaElement.getElementInfo(JavaElement.java:306)
	at org.eclipse.jdt.internal.core.Openable.getBuffer(Openable.java:285)
	at org.eclipse.jdt.internal.core.AbstractClassFile.getBuffer(AbstractClassFile.java:212)
	at org.eclipse.jdt.internal.core.AbstractClassFile.getSource(AbstractClassFile.java:324)
	at org.eclipse.jdt.core.dom.ASTParser.internalCreateAST(ASTParser.java:1131)
	at org.eclipse.jdt.core.dom.ASTParser.createAST(ASTParser.java:815)
	at com.microsoft.java.debug.plugin.internal.JdtSourceLookUpProvider.getFullyQualifiedName(JdtSourceLookUpProvider.java:140)
	at com.microsoft.java.debug.core.adapter.handler.SetBreakpointsRequestHandler.convertClientBreakpointsToDebugger(SetBreakpointsRequestHandler.java:119)
	at com.microsoft.java.debug.core.adapter.handler.SetBreakpointsRequestHandler.handle(SetBreakpointsRequestHandler.java:83)
	at com.microsoft.java.debug.core.adapter.DebugAdapter.dispatchRequest(DebugAdapter.java:80)
	at com.microsoft.java.debug.core.adapter.ProtocolServer.dispatchRequest(ProtocolServer.java:66)
	at com.microsoft.java.debug.core.protocol.AbstractProtocolServer.processData(AbstractProtocolServer.java:166)
	at com.microsoft.java.debug.core.protocol.AbstractProtocolServer.start(AbstractProtocolServer.java:80)
	at com.microsoft.java.debug.core.adapter.ProtocolServer.start(ProtocolServer.java:53)
	at com.microsoft.java.debug.plugin.internal.JavaDebugServer$2.run(JavaDebugServer.java:136)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at java.lang.Thread.run(Thread.java:745
@akaroml
Copy link
Member

@akaroml akaroml commented Nov 17, 2017

@testforstephen please take a look.

@testforstephen
Copy link
Contributor

@testforstephen testforstephen commented Nov 20, 2017

cannot reproduce.

i tried gradle dependencies by debugging a sample gradle project https://github.com/gradle/gradle-build-scan-quickstart, i can set breakpoint at the source code from third party jar com.google.guava:guava.

Here are some additional details about how does the debugger set breakpoint at third-party jars.

  1. when set breakpoint in third-party jar, the client will send jdt schema jdt://contents/xxx.jar/xxx.class to debugger server, then the debugger will find the Java Model IClassFile by the uri.
  2. The debugger need parse the fully qualified class where the breakpoint locates before setting it in debuggee jvm. Currently, the debugger will use jdt ast parser to parse the source contents.
  3. For every breakpoint request, the debugger will new an ASTParser, and set the IClassFile as the parser's source by invoking setSource(IClassFile), that means the IClassFile's attached source code will be used. When eclipse workspace cannot detect the attached source correctly for the target class file, the parser would fail.

Looks like your error happens when the ASTParser tries to get the attached source for xercesImpl.jar.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.