Scala debug question

45 views
Skip to first unread message

Jatin Puri

unread,
May 29, 2014, 8:18:19 AM5/29/14
to scala-...@googlegroups.com
Hi

It might be a lame question but I am struggling to understand. The question is about debug in scala-ide

I can see a class called `org.scalaide.ui.internal.editor.ScalaToggleBreakpointAdapter`. Where it creates/removes a breakpoint on toggle.
I can see that it does `JDIDebugModel.createLineBreakpoint(resource, tname, lnumber, -1, -1, 0, true, attributes)` and so. i.e. it adds breakpoint using eclipse platform api.

But again when I see `org.scala-ide.sdt.debug` project, there are classes to add break points. Say `org.scalaide.debug.internal.model.JdiRequestFactory#createBreakpointRequest` which does the same job as adding a breakpoint.

Question: What exactly happens above. Secondly, when I edit the source in any class in `org.scala-ide.sdt.debug` and launch it. My new code is never reflected. It always runs as the original build. Am I doing anything wrong?




iulian dragos

unread,
May 29, 2014, 8:57:13 AM5/29/14
to scala-ide-dev
Hi,



On Thu, May 29, 2014 at 2:18 PM, Jatin Puri <puri...@gmail.com> wrote:
Hi

It might be a lame question but I am struggling to understand. The question is about debug in scala-ide

I can see a class called `org.scalaide.ui.internal.editor.ScalaToggleBreakpointAdapter`. Where it creates/removes a breakpoint on toggle.
I can see that it does `JDIDebugModel.createLineBreakpoint(resource, tname, lnumber, -1, -1, 0, true, attributes)` and so. i.e. it adds breakpoint using eclipse platform api.

There are breakpoints and breakpoints :) One is the platform concept, which is a logical representation + UI. And there's the JVM debug interface breakpoint, which does the heavy lifting. They are (hopefully) mapped one to another, but the platform concept is persistent (Eclipse breakpoints exist between launches, or restarts of Eclipse. The JDI breakpoints live as long as the debug session is alive).
 
But again when I see `org.scala-ide.sdt.debug` project, there are classes to add break points. Say `org.scalaide.debug.internal.model.JdiRequestFactory#createBreakpointRequest` which does the same job as adding a breakpoint.

Question: What exactly happens above. Secondly, when I edit the source in any class in `org.scala-ide.sdt.debug` and launch it. My new code is never reflected. It always runs as the original build. Am I doing anything wrong?

Assuming you built it, and have no errors, you should make sure in the launch configuration to select the workspace version of the org.scala-ide.sdt.debug plugin (and de-select the one from the target platform (the running instance of Eclipse).

cheers,
iulian
 




--
You received this message because you are subscribed to the Google Groups "Scala IDE Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scala-ide-de...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/scala-ide-dev/ddcb576e-83c5-4f37-8533-ef2d1f34d6cf%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
« Je déteste la montagne, ça cache le paysage »
Alphonse Allais

Simon Schäfer

unread,
May 29, 2014, 8:59:05 AM5/29/14
to scala-...@googlegroups.com
I don't know anything about the debugger but to address your other question: Did you load the right plugin? In the run configuration you can select a tab called plug-ins. When you change the combo box titled with "launch with" to "plug-ins selected below only" are the plugins of your workspace selected?

Jatin Puri

unread,
May 29, 2014, 9:53:07 AM5/29/14
to scala-...@googlegroups.com
Yes they are selected and point to my same project. 

But I am not sure still why the changes are not reflected. In fact even if there are compile time errors in `sdt.debug`, it still runs normally.
I rechecked to see in my run configuration to see if it points to my workspace one and it does. (Here is image snapshot: http://picpaste.com/pics/Screenshot_from_2014-05-29_19_17_24-Kixi8eov.1401371291.png)

The only change I have done in the code, is to have statements writing to a file; say:
 import java.io._
   val f = new FileWriter(new File("/home/jatinpuri/Desktop/bb.txt"))
    f.write("step into ")
    f.flush()
    f.close()

//I am doing this because I am not sure how to log to a file where logger is not available from any inherited traits unlike in scalaide.core.
I have added above statement in multiple files, inside ScalaStepInto, StepOver, ScalaDebugPlugin and many other classes. None on them writes to file which means they are not getting called. 

Any other information I can provide?

Jatin Puri

unread,
May 29, 2014, 9:56:30 AM5/29/14
to scala-...@googlegroups.com
Thanks a lot for help :)

There are breakpoints and breakpoints :) One is the platform concept, which is a logical representation + UI. And there's the JVM debug interface breakpoint, which does the heavy lifting. They are (hopefully) mapped one to another, but the platform concept is persistent (Eclipse breakpoints exist between launches, or restarts of Eclipse. The JDI breakpoints live as long as the debug session is alive).

Makes sense. Thanks. Are you aware in which file does the eclipse persist breakpoint information? 
I suspect, when we toggle at a line, it adds breakpoint to be added in some local file. Later when debug session is launched, in a loop it might add all breakpoints to the debugger by reading from the file (this is where scalaide.deug comes into picture where it adds to the debugger). Am I right?

Thanks

iulian dragos

unread,
May 29, 2014, 3:01:26 PM5/29/14
to scala-ide-dev
On Thu, May 29, 2014 at 3:56 PM, Jatin Puri <puri...@gmail.com> wrote:
Thanks a lot for help :)

There are breakpoints and breakpoints :) One is the platform concept, which is a logical representation + UI. And there's the JVM debug interface breakpoint, which does the heavy lifting. They are (hopefully) mapped one to another, but the platform concept is persistent (Eclipse breakpoints exist between launches, or restarts of Eclipse. The JDI breakpoints live as long as the debug session is alive).

Makes sense. Thanks. Are you aware in which file does the eclipse persist breakpoint information? 

No, not really, probably somewhere deep inside the workspace .settings directory.
 
I suspect, when we toggle at a line, it adds breakpoint to be added in some local file. Later when debug session is launched, in a loop it might add all breakpoints to the debugger by reading from the file (this is where scalaide.deug comes into picture where it adds to the debugger). Am I right?

It's handled here. When we initialize a debug session, we retrieve breakpoints from the platform breakpoint manager (and also install a listener, in case more are added/removed).

I'm pretty sure the problems you have stem from having both the workspace project AND the target platform scala-ide.debug plugin. Disable the one from the target platform to make sure the one you build is the right one.

Also, if you are working on master sources you have to use a recent nightly build. Also, make sure you build once on the command line (it generates some files that are needed to build inside Eclipse too.

BTW, what are you working on?

cheers,
iulian
 

Thanks

--
You received this message because you are subscribed to the Google Groups "Scala IDE Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scala-ide-de...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

iulian dragos

unread,
May 29, 2014, 3:03:38 PM5/29/14
to scala-ide-dev
On Thu, May 29, 2014 at 3:53 PM, Jatin Puri <puri...@gmail.com> wrote:
Yes they are selected and point to my same project. 

But I am not sure still why the changes are not reflected. In fact even if there are compile time errors in `sdt.debug`, it still runs normally.
I rechecked to see in my run configuration to see if it points to my workspace one and it does. (Here is image snapshot: http://picpaste.com/pics/Screenshot_from_2014-05-29_19_17_24-Kixi8eov.1401371291.png)

The only change I have done in the code, is to have statements writing to a file; say:
 import java.io._
   val f = new FileWriter(new File("/home/jatinpuri/Desktop/bb.txt"))
    f.write("step into ")
    f.flush()
    f.close()

//I am doing this because I am not sure how to log to a file where logger is not available from any inherited traits unlike in scalaide.core.

You can simply inherit `HasLogger` from sdt.core and have a logger available.
 
I have added above statement in multiple files, inside ScalaStepInto, StepOver, ScalaDebugPlugin and many other classes. None on them writes to file which means they are not getting called.  

Any other information I can provide?

As I said in the previous email, make sure you have unchecked the target platform version of the debug plugin. You also mentioned compilation errors. That should not happen, so maybe we should start with fixing those.

Also, if you set breakpoints in the debug plugin, do they get hit?

cheers,
iulian

 

On Thursday, 29 May 2014 18:29:05 UTC+5:30, Simon Schäfer wrote:

On 05/29/2014 02:18 PM, Jatin Puri wrote:
Hi

It might be a lame question but I am struggling to understand. The question is about debug in scala-ide

I can see a class called `org.scalaide.ui.internal.editor.ScalaToggleBreakpointAdapter`. Where it creates/removes a breakpoint on toggle.
I can see that it does `JDIDebugModel.createLineBreakpoint(resource, tname, lnumber, -1, -1, 0, true, attributes)` and so. i.e. it adds breakpoint using eclipse platform api.

But again when I see `org.scala-ide.sdt.debug` project, there are classes to add break points. Say `org.scalaide.debug.internal.model.JdiRequestFactory#createBreakpointRequest` which does the same job as adding a breakpoint.

Question: What exactly happens above. Secondly, when I edit the source in any class in `org.scala-ide.sdt.debug` and launch it. My new code is never reflected. It always runs as the original build. Am I doing anything wrong?
I don't know anything about the debugger but to address your other question: Did you load the right plugin? In the run configuration you can select a tab called plug-ins. When you change the combo box titled with "launch with" to "plug-ins selected below only" are the plugins of your workspace selected?




--
You received this message because you are subscribed to the Google Groups "Scala IDE Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scala-ide-de...@googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "Scala IDE Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scala-ide-de...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Jatin Puri

unread,
May 31, 2014, 3:28:56 AM5/31/14
to scala-...@googlegroups.com

It's handled here. When we initialize a debug session, we retrieve breakpoints from the platform breakpoint manager (and also install a listener, in case more are added/removed).


This is very helpful. Thanks.
 
I'm pretty sure the problems you have stem from having both the workspace project AND the target platform scala-ide.debug plugin. Disable the one from the target platform to make sure the one you build is the right one.

I am going bonkers over this. I think I have removed it (Here is snapshot). I have unchecked in target platform and checked in wokspace
 
Also, if you are working on master sources you have to use a recent nightly build. Also, make sure you build once on the command line (it generates some files that are needed to build inside Eclipse too.


Ok. Thanks a lot.
 
BTW, what are you working on?


To be able to insert breakpoints and debug macros.

Thanks again. I really appreciate it!

Jatin Puri

unread,
May 31, 2014, 3:31:06 AM5/31/14
to scala-...@googlegroups.com
Hi
 
You can simply inherit `HasLogger` from sdt.core and have a logger available.

O wow. Awesome. Thanks

As I said in the previous email, make sure you have unchecked the target platform version of the debug plugin. You also mentioned compilation errors. That should not happen, so maybe we should start with fixing those.
 
 I think I have removed it (Here is snapshot). I have unchecked in target platform and checked in wokspace

Also, if you set breakpoints in the debug plugin, do they get hit?

No 

Thanks for help!

iulian dragos

unread,
Jun 2, 2014, 9:51:30 AM6/2/14
to scala-ide-dev
On Sat, May 31, 2014 at 9:31 AM, Jatin Puri <puri...@gmail.com> wrote:
Hi
 
You can simply inherit `HasLogger` from sdt.core and have a logger available.

O wow. Awesome. Thanks

As I said in the previous email, make sure you have unchecked the target platform version of the debug plugin. You also mentioned compilation errors. That should not happen, so maybe we should start with fixing those.
 
 I think I have removed it (Here is snapshot). I have unchecked in target platform and checked in wokspace

I noticed that you're using 4.0-M1. I don't think you'll be able to build master using that IDE. You need to upgrade to a nightly build. You should have some build errors (or unresolved dependencies), is that not the case?

cheers,
iulian
 


Also, if you set breakpoints in the debug plugin, do they get hit?

No 

Thanks for help!

--
You received this message because you are subscribed to the Google Groups "Scala IDE Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scala-ide-de...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages