This page is no longer maintained — Please continue to the home page at www.scala-lang.org

Need help getting started with ensime debugger

3 replies
OP
Joined: 2011-02-08,
User offline. Last seen 1 year 17 weeks ago.

Hello, ensime users

I'm trying to get ensime-debugging working, but seem to be missing something.

What is the minimum configuration that I need to load and step through the class below in the debugger that ensime launches?
What should my .ensime file look like?


class StartDebugging {
  def p = println("up!")
}

object StartDebugging {
  def main(args: Array[String]) {
    var o = new StartDebugging // would like to set break-point here and go from there
    o.p
  }
}


My ensime settings are already good enough for ensime to work well in other contexts like autocompletion.
 (apologies for not pasting contents here!)


 But, when I try
 "M-x ensime-db-start RET StartDebugging RET go"
( "StartDebugging" at qualified-name-of-class-to-debug prompt, "go" at commandline-arguments prompt )

I only get this..

Initializing jdb ...
> run StartDebugging go
Set uncaught java.lang.Throwable
Set deferred uncaught java.lang.Throwable
>
VM Started:
Exception occurred: java.lang.ClassNotFoundException (uncaught)"thread=main", java.net.URLClassLoader$1.run(), line=202 bci=73

main[1]


If possible, I would like to stay clear of sbt for now. Is it possible to do scala-debugging in ensime without sbt?

 
OP
Joined: 2011-02-08,
User offline. Last seen 1 year 17 weeks ago.
Re: Need help getting started with ensime debugger
So I tried renaming the companion object to StartDebuggingOb, but i still get stuck.
 The difference (minor improvement?) is that at least the "classes" command successfull lists/shows the object

Initializing jdb ...
> run StartDebuggingOb
Set uncaught java.lang.Throwable
Set deferred uncaught java.lang.Throwable
>
VM Started:
Exception occurred: java.lang.ClassNotFoundException (uncaught)"thread=main", java.net.URLClassLoader$1.run(), line=202 bci=73

main[1] classes
** classes list **
StartDebuggingOb /** now visible in "classes" o/p */
boolean[]
byte[]
..
.. <whole lot of other classes>
..



On Sun, Apr 3, 2011 at 1:19 PM, OP <ovr [dot] pron8r [at] gmail [dot] com> wrote:

Hello, ensime users

I'm trying to get ensime-debugging working, but seem to be missing something.

What is the minimum configuration that I need to load and step through the class below in the debugger that ensime launches?
What should my .ensime file look like?


class StartDebugging {
  def p = println("up!")
}

object StartDebugging {
  def main(args: Array[String]) {
    var o = new StartDebugging // would like to set break-point here and go from there
    o.p
  }
}


My ensime settings are already good enough for ensime to work well in other contexts like autocompletion.
 (apologies for not pasting contents here!)


 But, when I try
 "M-x ensime-db-start RET StartDebugging RET go"
( "StartDebugging" at qualified-name-of-class-to-debug prompt, "go" at commandline-arguments prompt )

I only get this..

Initializing jdb ...
> run StartDebugging go
Set uncaught java.lang.Throwable
Set deferred uncaught java.lang.Throwable
>
VM Started:
Exception occurred: java.lang.ClassNotFoundException (uncaught)"thread=main", java.net.URLClassLoader$1.run(), line=202 bci=73

main[1]


If possible, I would like to stay clear of sbt for now. Is it possible to do scala-debugging in ensime without sbt?

 

Cay Horstmann
Joined: 2009-09-04,
User offline. Last seen 42 years 45 weeks ago.
Re: Re: Need help getting started with ensime debugger

I just tried this with Ensime and no SBT. I put StartDebugging.scala
inside src/main/scala, just in case. I ran M-x ensime, gave the
obvious answers to all prompts, and then ran C-c C-b b to build. Then
C-c C-d d to run the debugger, C-c C-d b to set a breakpoint, and C-c
C-d r to run the program.

I can never remember any of these--I take them all from the cheat
sheet at http://aemon.com/file_dump/ensime_manual.html.

It all worked without a hitch, with Scala 2.8.1 and Ensime 0.4.4. Here
is my .ensime:

(
:project-name "ensime-test"
:project-package ""
sources ("./src/main/scala/")
:compile-jars ("./" "/path/to/scala-2.8.1.final/lib")
:target "./bin"
)

I am a bit surprised myself that whenever I beat my head against some
flakiness in IntelliJ or Eclipse, I come back to Ensime and it all
just works, but there you are. For now, Ensime is hard to beat. But
bite the bullet and install sbt too. It won't hurt a bit :-)

Cheers,

Cay

2011/4/3 OP :
> So I tried renaming the companion object to StartDebuggingOb, but i still
> get stuck.
>  The difference (minor improvement?) is that at least the "classes" command
> successfull lists/shows the object
>
>> Initializing jdb ...
>> > run StartDebuggingOb
>> Set uncaught java.lang.Throwable
>> Set deferred uncaught java.lang.Throwable
>> >
>> VM Started:
>> Exception occurred: java.lang.ClassNotFoundException
>> (uncaught)"thread=main", java.net.URLClassLoader$1.run(), line=202 bci=73
>>
>> main[1] classes
>> ** classes list **
>> StartDebuggingOb /** now visible in "classes" o/p */
>> boolean[]
>> byte[]
>> ..
>> ..
>> ..
>
>
>
> On Sun, Apr 3, 2011 at 1:19 PM, OP wrote:
>>
>> Hello, ensime users
>>
>> I'm trying to get ensime-debugging working, but seem to be missing
>> something.
>>
>> What is the minimum configuration that I need to load and step through the
>> class below in the debugger that ensime launches?
>> What should my .ensime file look like?
>>
>>
>>> class StartDebugging {
>>>   def p = println("up!")
>>> }
>>>
>>> object StartDebugging {
>>>   def main(args: Array[String]) {
>>>     var o = new StartDebugging // would like to set break-point here and
>>> go from there
>>>     o.p
>>>   }
>>> }
>>
>>
>> My ensime settings are already good enough for ensime to work well in
>> other contexts like autocompletion.
>>  (apologies for not pasting contents here!)
>>
>>
>>  But, when I try
>>  "M-x ensime-db-start RET StartDebugging RET go"
>> ( "StartDebugging" at qualified-name-of-class-to-debug prompt, "go" at
>> commandline-arguments prompt )
>>
>> I only get this..
>>
>>> Initializing jdb ...
>>> > run StartDebugging go
>>> Set uncaught java.lang.Throwable
>>> Set deferred uncaught java.lang.Throwable
>>> >
>>> VM Started:
>>> Exception occurred: java.lang.ClassNotFoundException
>>> (uncaught)"thread=main", java.net.URLClassLoader$1.run(), line=202 bci=73
>>>
>>> main[1]
>>
>>
>> If possible, I would like to stay clear of sbt for now. Is it possible to
>> do scala-debugging in ensime without sbt?
>>
>>
>
>

OP
Joined: 2011-02-08,
User offline. Last seen 1 year 17 weeks ago.
Re: Re: Need help getting started with ensime debugger

Thank you, Cay!
After playing around a little more, and looking at your .ensime file, it worked.
I also had to add a runtime-jars entry - but that may only be because I need some 3rd-party jars.
:runtime-jars (<same as my ":compile-jars">)
  The details you included (keystrokes and all) made it surprisingly easy.


Regarding sbt:
 I'm still getting acquainted with Scala.. So it's just a matter of time and application - sbt, ScalaTest, Lift are all in my "things-to-try" pipeline :)
 For the moment I'm having enough "fun" jumping between Scala blogs and docs picking up hints and tricks! JJ

Thanks
 OP






On Sun, Apr 3, 2011 at 6:20 PM, Cay Horstmann <cay [dot] horstmann [at] gmail [dot] com> wrote:
I just tried this with Ensime and no SBT. I put StartDebugging.scala
inside src/main/scala, just in case. I ran M-x ensime, gave the
obvious answers to all prompts, and then ran C-c C-b b to build. Then
C-c C-d d to run the debugger, C-c C-d b to set a breakpoint, and C-c
C-d r to run the program.

I can never remember any of these--I take them all from the cheat
sheet at http://aemon.com/file_dump/ensime_manual.html.

It all worked without a hitch, with Scala 2.8.1 and Ensime 0.4.4. Here
is my .ensime:

(
:project-name "ensime-test"
:project-package ""
sources ("./src/main/scala/")
:compile-jars ("./" "/path/to/scala-2.8.1.final/lib")
:target "./bin"
)

I am a bit surprised myself that whenever I beat my head against some
flakiness in IntelliJ or Eclipse, I come back to Ensime and it all
just works, but there you are. For now, Ensime is hard to beat. But
bite the bullet and install sbt too. It won't hurt a bit :-)

Cheers,

Cay

2011/4/3 OP <ovr [dot] pron8r [at] gmail [dot] com>:
> So I tried renaming the companion object to StartDebuggingOb, but i still
> get stuck.
>  The difference (minor improvement?) is that at least the "classes" command
> successfull lists/shows the object
>
>> Initializing jdb ...
>> > run StartDebuggingOb
>> Set uncaught java.lang.Throwable
>> Set deferred uncaught java.lang.Throwable
>> >
>> VM Started:
>> Exception occurred: java.lang.ClassNotFoundException
>> (uncaught)"thread=main", java.net.URLClassLoader$1.run(), line=202 bci=73
>>
>> main[1] classes
>> ** classes list **
>> StartDebuggingOb /** now visible in "classes" o/p */
>> boolean[]
>> byte[]
>> ..
>> .. <whole lot of other classes>
>> ..
>
>
>
> On Sun, Apr 3, 2011 at 1:19 PM, OP <ovr [dot] pron8r [at] gmail [dot] com> wrote:
>>
>> Hello, ensime users
>>
>> I'm trying to get ensime-debugging working, but seem to be missing
>> something.
>>
>> What is the minimum configuration that I need to load and step through the
>> class below in the debugger that ensime launches?
>> What should my .ensime file look like?
>>
>>
>>> class StartDebugging {
>>>   def p = println("up!")
>>> }
>>>
>>> object StartDebugging {
>>>   def main(args: Array[String]) {
>>>     var o = new StartDebugging // would like to set break-point here and
>>> go from there
>>>     o.p
>>>   }
>>> }
>>
>>
>> My ensime settings are already good enough for ensime to work well in
>> other contexts like autocompletion.
>>  (apologies for not pasting contents here!)
>>
>>
>>  But, when I try
>>  "M-x ensime-db-start RET StartDebugging RET go"
>> ( "StartDebugging" at qualified-name-of-class-to-debug prompt, "go" at
>> commandline-arguments prompt )
>>
>> I only get this..
>>
>>> Initializing jdb ...
>>> > run StartDebugging go
>>> Set uncaught java.lang.Throwable
>>> Set deferred uncaught java.lang.Throwable
>>> >
>>> VM Started:
>>> Exception occurred: java.lang.ClassNotFoundException
>>> (uncaught)"thread=main", java.net.URLClassLoader$1.run(), line=202 bci=73
>>>
>>> main[1]
>>
>>
>> If possible, I would like to stay clear of sbt for now. Is it possible to
>> do scala-debugging in ensime without sbt?
>>
>>
>
>

Copyright © 2012 École Polytechnique Fédérale de Lausanne (EPFL), Lausanne, Switzerland