Attach remote debugger to test action

248 views
Skip to first unread message

Haim Ashkenazi

unread,
Aug 24, 2009, 10:33:20 AM8/24/09
to simple-build-tool
Hi

Is there a way to attach a remote debugger in order to debug scalatest
tests? Just adding the regular java debug options doesn't work
(probably because tests are forked?).

Thanks

Bye

Mark Harrah

unread,
Aug 24, 2009, 7:10:31 PM8/24/09
to simple-b...@googlegroups.com

Can you be a bit more specific about what you are trying to do?

Thanks,
Mark

Haim Ashkenazi

unread,
Aug 25, 2009, 1:10:42 AM8/25/09
to simple-build-tool

Hi Mark,
Sure. I'm trying to run the scalatest tests in the intellij debugger.
When running the tests directly in intellij in debug mode it just
runs, and doesn't stop at the breakpoints. Then I tried running sbt
with the java options '-
agentlib:jdwp=transport=dt_socket,address=localhost:
5005,server=y,suspend=y' and connect to it with remote debugger but it
just runs without stopping at breakpoints.

I'm not sure if it's Intellij issue or scalatest issue, but the only
way I ever managed to debug scalatests in intellij was by running it
in maven (and because maven can't run directly scalatest, I used
scalatest-runner: http://github.com/teigen/scalatest-junit4runner/),
with the property -Dmaven.surefire.debug or with -DforkMode=none.

Later I found that I can call in eclipse directly the test class's
'execute' method and then I can debug it (it doesn't work in
Intellij), but since I'm using Intellij I guess currently remote
debugging is my only option.

Any ideas?

As always, Thank you for always helping.

Bye

Haim

Bill Venners

unread,
Aug 25, 2009, 1:54:05 AM8/25/09
to simple-b...@googlegroups.com, scalate...@googlegroups.com
Hi Haim,

I've been able to ScalaTest tests in the debugger in IntelliJ. Can you
elaborate on exactly how you are trying to go about it? I believe what
I did was set up a configuration that ran the test I wanted to debug,
then selected that configuration and hit the arrow with the little bug
on it. That was all it took. I set a breakpoint and it stopped there.
Although now that I think about it, I was probably doing this with the
1.0 trunk, not the 0.9.5 release. Shouldn't make a difference though.
If you let me know a bit more detail about your setup, I can try and
see if I can reproduce your problem.

Bill
--
Bill Venners
Artima, Inc.
http://www.artima.com

Haim Ashkenazi

unread,
Aug 25, 2009, 3:53:58 AM8/25/09
to simple-build-tool
Hi Bill,

On Aug 25, 8:54 am, Bill Venners <b...@artima.com> wrote:
> Hi Haim,
>
> I've been able to ScalaTest tests in the debugger in IntelliJ. Can you
> elaborate on exactly how you are trying to go about it? I believe what
> I did was set up a configuration that ran the test I wanted to debug,
> then selected that configuration and hit the arrow with the little bug
> on it. That was all it took. I set a breakpoint and it stopped there.
> Although now that I think about it, I was probably doing this with the
> 1.0 trunk, not the 0.9.5 release. Shouldn't make a difference though.
> If you let me know a bit more detail about your setup, I can try and
> see if I can reproduce your problem.
I more of less did the same thing. Import the sources from sbt into
Intellij, setup scalatest configuration and run it. It runs without a
problem but it doesn't stop at breakpoints. I uploaded a sample
project so you can try it yourself:
http://files.babysnakes.org/share/scouchdb_2.7.5-0.4-project.zip?attredirects=0

This is my test with adopting scouchdb (by Debasish Ghosh) to use sbt.
I tried running it without 'make' first (intellij had some errors
compiling the sources - which compiled perfectly in sbt, so I
configured the classes path correctly), and with 'make' (I fixed the
problems intellij complained about), but both runs without a problem
but doesn't stop at breakpoints.

One thing I noticed while making this sample, is that while running in
debug mode the red breakpoint had an "x" in it saying that there's no
executable code in this line, no matter where the breakpoint is. This
"x" disappears when the debug finishes.

Any ideas? I'm using Intellij 8.1.? on Mac.

Thanks

Haim

fede

unread,
Aug 30, 2009, 10:29:13 PM8/30/09
to simple-build-tool
Hello,

I am too trying to attach a jpda debugger (jswat) to a sbt instance
running jetty.
I started sbt with this parameters:

java -Xdebug -Xnoagent -Djava.compiler=NONE -
Xrunjdwp:transport=dt_socket,address=4000,server=y,suspend=n -Xmx768M -
jar `dirname $0`/sbt-launcher-$SBT_VERSION.jar "$@"

but I can't get the debugger to stop at a given breakpoint.
jps show no process but sbt and the debugger itself.

This does not work either connecting by socket or by process id.

I am totally lost so any help is more than welcome.

regards,

fede

By the way: sbt is super-nice and with the jetty-run action picking up
the changes in source
and redeploying the only thing I need now to achieve total nirvana is
getting the debbuger running.

On Aug 25, 4:53 am, Haim Ashkenazi <haim.ashken...@gmail.com> wrote:
> Hi Bill,
>
> On Aug 25, 8:54 am, Bill Venners <b...@artima.com> wrote:> Hi Haim,
>
> > I've been able to ScalaTest tests in thedebuggerin IntelliJ. Can you
> > elaborate on exactly how you are trying to go about it? I believe what
> > I did was set up a configuration that ran the test I wanted to debug,
> > then selected that configuration and hit the arrow with the little bug
> > on it. That was all it took. I set a breakpoint and it stopped there.
> > Although now that I think about it, I was probably doing this with the
> > 1.0 trunk, not the 0.9.5 release. Shouldn't make a difference though.
> > If you let me know a bit more detail about your setup, I can try and
> > see if I can reproduce your problem.
>
> I more of less did the same thing. Import the sources from sbt into
> Intellij, setup scalatest configuration and run it. It runs without a
> problem but it doesn't stop at breakpoints. I uploaded a sample
> project so you can try it yourself:http://files.babysnakes.org/share/scouchdb_2.7.5-0.4-project.zip?attr...
>
> This is my test with adopting scouchdb (by Debasish Ghosh) to use sbt.
> I tried running it without 'make' first (intellij had some errors
> compiling the sources - which compiled perfectly in sbt, so I
> configured the classes path correctly), and with 'make' (I fixed the
> problems intellij complained about), but both runs without a problem
> but doesn't stop at breakpoints.
>
> One thing I noticed while making this sample, is that while running in
> debug mode the red breakpoint had an "x" in it saying that there's no
> executable code in this line, no matter where the breakpoint is. This
> "x" disappears when the debug finishes.
>
> Any ideas? I'm using Intellij 8.1.? on Mac.
>
> Thanks
>
> Haim
>
>
>
>
>
> > Bill
>
> > On Mon, Aug 24, 2009 at 10:10 PM, Haim
>
> > Ashkenazi<haim.ashken...@gmail.com> wrote:
>
> > > Hi Mark,
>
> > > On Aug 25, 2:10 am, Mark Harrah <dmhar...@gmail.com> wrote:
> > >> On Monday 24 August 2009, Haim Ashkenazi wrote:
>
> > >> > Hi
>
> > >> > Is there a way to attach a remotedebuggerin order to debug scalatest
> > >> > tests? Just adding the regular java debug options doesn't work
> > >> > (probably because tests are forked?).
>
> > >> Can you be a bit more specific about what you are trying to do?
> > > Sure. I'm trying to run the scalatest tests in the intellijdebugger.
> > > When running the tests directly in intellij in debug mode it just
> > > runs, and doesn't stop at the breakpoints. Then I tried running sbt
> > > with the java options '-
> > > agentlib:jdwp=transport=dt_socket,address=localhost:
> > > 5005,server=y,suspend=y' and connect to it with remotedebuggerbut it

fede

unread,
Aug 30, 2009, 11:36:17 PM8/30/09
to simple-build-tool


On Aug 30, 11:29 pm, fede <fede.si...@gmail.com> wrote:
> Hello,
>
>  I am too trying to attach a jpda debugger (jswat) to a sbt instance
> running jetty.
> I started sbt with this parameters:
>
> java -Xdebug -Xnoagent -Djava.compiler=NONE -
> Xrunjdwp:transport=dt_socket,address=4000,server=y,suspend=n -Xmx768M -
> jar `dirname $0`/sbt-launcher-$SBT_VERSION.jar "$@"
>
> but I can't get the debugger to stop at a given breakpoint.
> jps show no process but sbt and the debugger itself.
>
> This does not work either connecting by socket or by process id.
>
> I am totally lost so any help is more than welcome.

To clarify:

In the sbt shell I get:
Listening for transport dt_socket at address: 4000
so the jvm is waiting for connections and when I connect if I "pause"
the
debugger, the shell freezes so I am connected.
Also if I ctrl-c the shell, the debugger detects disconnection.

This is probably a problem with the debugger's setup but I thought
somebody here
might have it running.

Also I got this setup running with maven and a scala app.

Again, any hints are welcome.
Reply all
Reply to author
Forward
0 new messages