Bug 537699 - Source not found debugging with Photon but not Oxygen
Summary: Source not found debugging with Photon but not Oxygen
Status: RESOLVED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Debug (show other bugs)
Version: 4.8   Edit
Hardware: PC Windows 10
: P3 normal (vote)
Target Milestone: 4.12   Edit
Assignee: Igor Fedorenko CLA
QA Contact:
URL:
Whiteboard:
Keywords: needinfo
Depends on:
Blocks:
 
Reported: 2018-08-05 13:50 EDT by Gary Furash CLA
Modified: 2019-05-17 10:55 EDT (History)
4 users (show)

See Also:


Attachments
Zip File of Project (81.85 KB, application/x-zip-compressed)
2018-08-06 10:23 EDT, Gary Furash CLA
no flags Details
SourceNotFound (62.54 KB, image/png)
2018-11-23 03:31 EST, Sarika Sinha CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Gary Furash CLA 2018-08-05 13:50:52 EDT
Stepping through in debug mode produces "Source Not Found" in Photon but not in Oxygen.

If I take a small set of classes, create a Java Project, and then put those classes in the SRC directory, under Oxygen without any special configuration I can step through the execution just fine in debugging mode, but get the "source not found" error in Photon even if I'm only stepping through those exact same classes.

What I tried in Photon

- adding the source of the project manually to Photon (after clicking the button you get when source isn't found). this didn't work but the project's own source is already part of the source path (under default)
checking the checkbox for the JRE.

JRE: 1.8.0_181-b13 
OS: Windows 7 x64, Windows 10 x64

Note that this happens EVEN if I'm only stepping from one user class to another - I'm not trying to step into libraries or JRE.
Comment 1 Andrey Loskutov CLA 2018-08-06 01:26:04 EDT
Please provide detailed steps to reproduce.
Comment 2 Gary Furash CLA 2018-08-06 10:23:40 EDT
Created attachment 275288 [details]
Zip File of Project

How to Reproduce
1. Create project in Eclipse using 1.8 jre
2. copy this source into that eclipse project
3. Put debugging breakpoint at 2nd line in main (where it calls test method)
4. Run in debugging and try to step into that step
(throws error in picture - see scratchpad png)

Works fine in Eclipse Oxygen without ANY special configuration.

I can replicate this with a fresh install of Eclipse Photon on either a Windows 7 or Windows 10 machine.
Comment 3 Andrey Loskutov CLA 2018-08-06 11:46:20 EDT
(In reply to Gary Furash from comment #2)
> Created attachment 275288 [details]
> Zip File of Project
> 
> How to Reproduce
> 1. Create project in Eclipse using 1.8 jre
> 2. copy this source into that eclipse project
> 3. Put debugging breakpoint at 2nd line in main (where it calls test method)
> 4. Run in debugging and try to step into that step
> (throws error in picture - see scratchpad png)

Thanks for example, but I can't reproduce errors :-(

> Works fine in Eclipse Oxygen without ANY special configuration.

For me, using 4.9 HEAD works fine. Can you please check your example with http://download.eclipse.org/eclipse/downloads/drops4/I20180806-0300/?

> I can replicate this with a fresh install of Eclipse Photon on either a
> Windows 7 or Windows 10 machine.

Most likely some exception is thrown in "PreMain": do you have errors either in the debug console or in the log?

Can you please try to disable "Java->Debug->Use advanced source lookup"?
Comment 4 Gary Furash CLA 2018-08-06 12:23:14 EDT
Is there anything else I can try? It really happens on either a win7 or win 10 machine with a FRESH install of the standard (java developer) eclipse photon using the standard jre.

Is there a stack trace or something I could send you?  How do I do that?

Thanks!
Comment 5 Gary Furash CLA 2018-08-06 12:38:48 EDT
If I turn off
"Java->Debug->Use advanced source lookup"?
it works perfectly with the default eclipse photon

If i use the new built you sent the link to, it doesn't work unless i uncheck
"Java->Debug->Use advanced source lookup"?

So should I just leave that off?

Thanks!
Comment 6 Sarika Sinha CLA 2018-08-06 22:59:12 EDT
@Igor,
Can you help here ?
Comment 7 Sarika Sinha CLA 2018-08-19 23:52:03 EDT
Ping!!!
Comment 8 Igor Fedorenko CLA 2018-08-20 00:16:08 EDT
I'll try to find time to look at this either the next week or the week after.
Comment 9 Igor Fedorenko CLA 2018-08-22 20:03:41 EDT
I can't reproduce the problem using provided example project. Tried both 4.9M2 and 4.8. I am on OSX, so the problem could be Windows-specific. 

Also, Premain:53 (as per sceenshot) is a trivial == check [1]. Can't think of anything in jdt code that could trigger an exception there.


[1] https://git.eclipse.org/c/jdt/eclipse.jdt.debug.git/tree/org.eclipse.jdt.launching.javaagent/src/main/java/org/eclipse/jdt/launching/internal/javaagent/Premain.java?h=R4_8#n53
Comment 10 Sarika Sinha CLA 2018-08-24 03:40:25 EDT
In the master line no 53 is
inst.addTransformer(new ClassFileTransformer() {
Comment 11 Clément SIPIETER CLA 2018-09-18 08:46:46 EDT
I have the same problem on a 
"Linux 4.9.0-8-amd64 #1 SMP Debian 4.9.110-3+deb9u4 (2018-08-21) x86_64 GNU/Linux"
with Eclipse photon 4.8.0 (Build id: 20180619-1200)

the solution from Gary Furash to turn off "Java->Debug->Use advanced source lookup" works for me.
Comment 12 Sarika Sinha CLA 2018-11-23 03:31:52 EST
Created attachment 276668 [details]
SourceNotFound

I was able to reproduce this with 4.10 M3 build.

Stepping into the creation of ClassA() or ClassB() gives this error as it reaches 
Premain$1.transform(ClassLoader, String, Class<?>, ProtectionDomain, byte[]) line: 45	

Igor, we should fix this for 4.11.
Comment 13 Igor Fedorenko CLA 2018-11-23 07:53:45 EST
@Sarika, not sure if you see the same behaviour as the original reporter, but in your case this is almost certainly normal step-into behaviour. When JVM loads a user class for the first time, it goes through bunch of non-user code, including sourcelookup agent instrumentation logic. Debugger stops in the agent code, if the agent code isn't explicitly "filtered" in debug preferences. The solution is to add agent package to the default set of step filters and possibly enable it by default.

As a side note, sourcelookup agent isn't the only missing step filter. I _always_ add filters for java.lang.ClassLoader and couple of jdk.internal.* packages. So maybe we should review default set of filters and adjust them to provide better debugging experience.
Comment 14 Eclipse Genie CLA 2018-11-23 08:18:58 EST
New Gerrit change created: https://git.eclipse.org/r/132969
Comment 16 Sarika Sinha CLA 2019-05-17 06:44:40 EDT
@Gary,
Can you confirm if you are still seeing/not seeing the problem?
Comment 17 Clément SIPIETER CLA 2019-05-17 09:07:30 EDT
@Sarika
I had the problem, but I'm now on Eclipse 20190314-1200 with "Java->Debug->Use advanced source lookup" activated and everything works fine.
Comment 18 Sarika Sinha CLA 2019-05-17 10:55:37 EDT
Marking as resolved in that case. Thanks!