Breakpoints are ignored in remote debugger

537 views
Skip to first unread message

scala solist

unread,
Jun 6, 2016, 6:04:25 AM6/6/16
to Scala IDE User
I'm using SBT for developing, but it lacks debug features, so I'd like to use the Scala IDE for debugging. As for editing I'm happy with simple editor I've already have, so it is my first experience with the Scala IDE.

What I've tried:

I set sbt listen for remote debug. Then I added sbt-eclipse plugin to the SBT build config. I generated eclipse project configuration with it and import project to the eclipse. After that I created new remote debug configuration where specified the corresponding port to attach and selected "Scala Remote Launcher" (later I'd tried "Eclipse JDT Launcher" it works the same). Debug button became active and the Scala IDE remote debugger seemed to attach correctly. I could see threads, suspend and activate them. But when I'd tried to set breakpoints, they all were ignored, the application executes until the end without any stops.

What I need:

Make thread stop on breakpoints. I'm in confusion, what else I need to do to make remote debugging work.

Some hint, that may be relevant to the issue. When I tried to debug the project locally (without remote connection to the sbt session), the Scala IDE complains that the project contains build errors and the IDE could not find or load main class. SBT builds the project without errors and locates the main class pretty well.

wpopie...@virtuslab.com

unread,
Jun 6, 2016, 9:41:55 AM6/6/16
to Scala IDE User
Hello,

did you set 'Connection Type' to one of 'Scala debugger`?

Cheers
W.

scala solist

unread,
Jun 6, 2016, 9:48:38 AM6/6/16
to Scala IDE User
Yes. Connection Type is set to the "Scala debugger (Socket Attach)". And it connects properly.

wpopie...@virtuslab.com

unread,
Jun 6, 2016, 10:04:36 AM6/6/16
to Scala IDE User
Well, you need to give me minified sample of your project. Really hard to say. I'm using debugging really intensively and works quite glibly. Also, hard to say from where compilation errors come from, compiler or presentation compiler. About the main class localization, this part is delivered by eclipse so java centric so it usually does not find scala main (if it is not a class but object). Try to put there the full path by hand.

scala solist

unread,
Jun 6, 2016, 11:36:58 AM6/6/16
to Scala IDE User
All build buttons are grey, it may relate to the local debug errors.

Steps to reproduce:

0. unpack attached mini-project and chdir inside
1. run sbt (sbt commands below)
1.1 compile
1.2 eclipse
1.3 debugging
1.4 run
2. open eclipse and import the Mini project
3. Add breakpoint to the 5th line in the Implementation object (val c = a * a)
4. Add remote debug configuration: project mini, scala debugger (socket attach), localhost, 5005, using scala remote launcher
5. Click the Debug button.

At the 1.4 point sbt launches main class, but suspends immediately waiting for the debugger. After debugger connects at the 5 point sbt run finishes immediately without any breaks.
mini.tar.gz

wpopie...@virtuslab.com

unread,
Jun 7, 2016, 2:42:42 AM6/7/16
to Scala IDE User
thanks

scala solist

unread,
Jun 8, 2016, 2:16:45 PM6/8/16
to Scala IDE User
Have you managed to reproduce the issue?

wpopie...@virtuslab.com

unread,
Jun 9, 2016, 3:11:39 AM6/9/16
to Scala IDE User
unfortunately not, but I didn't do it too intensively, just smoke one. tomorrow I hope to find more time to look at it closer.

wpopie...@virtuslab.com

unread,
Jun 10, 2016, 9:43:04 AM6/10/16
to Scala IDE User
So looks that everything is running smoothly with no additional lubrication. The problem is in project structure. Scala IDE works with Eclipse (debug perspective strictly speaking) and because of it there are some limitations. First of all looks like folder structure should reflects package structure to allow debug machinery to find appropriate file (more accurate is to say about compilation unit I guess). In this particular case
src/Mini.scala should be moved to src/mini/Mini.scala
debug/Mini.scala should be moved to debug/mini/Mini.scala
I'm aware that there is not a need to reflect packages by folder structure in Scala but Debug Perspective was done for Java.
I would be grateful if you could confirm it.
W.

scala solist

unread,
Jun 14, 2016, 8:59:32 PM6/14/16
to Scala IDE User
I tried to modify the project structure and debugger started to work normally. So I could confirm the solution.

I went to Scala without prior experience in Java, and if there were no Scala I would never touched JVM. Java legacy constantly kicks my ass. Besides structure issues with debugging, there were naming issues with other projects. In Scala packages and objects resembles each other much. There are even package objects. So I thought their names should starts with capital. object Mini {}, package Mini {}. Not so fast, number of scala tools assumes that package names could not contain capital letters.

wpopie...@virtuslab.com

unread,
Jun 15, 2016, 3:18:22 AM6/15/16
to Scala IDE User
I'm really happy that you can work normally at last. I know that some things can be somehow vexing. Unfortunately Scala IDE uses Eclipse debugger which is not able to link sources (called stratum in debugging argot) with product (.class file). The whole JDI implementation is taken from Eclipse and in some cases it can be seen that this is java biased not just jvm centric :) but is quite useful if you are writing free and open tools.

scala solist

unread,
Jul 14, 2016, 2:51:08 PM7/14/16
to Scala IDE User
Rewriting all project files is not something I would call "work normally". It was fine for minimal test example project, but I prefer not to redo all conventions for a working project for a mere debugging. So now I know that my project is incompatible with official IDE but IntelliJ IDEA provides alternative that works as is, without rewriting. I would be glad if I could avoid tooling outgrowth, but that is the lesser evil. So now I have additional dependency on IDE that is not used for editing, but for debugging only.

virtualeyes

unread,
Sep 16, 2016, 4:26:40 PM9/16/16
to Scala IDE User
After wasting the better part of a day trying to get debugging working, this thread reveals the problem -- thanks to both of you!

Of coursing restructuring play framework sources to adhere to the one-to-one package-to-directory rule required for eclipse debugging to work is not something I particularly feel like doing, but so be it, at some point you have to be able to look under the hood of the running app.

Thanks again.
Reply all
Reply to author
Forward
0 new messages