Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   Java (http://www.velocityreviews.com/forums/f30-java.html)
-   -   debugging threads with eclipse (http://www.velocityreviews.com/forums/t318705-debugging-threads-with-eclipse.html)

Ben 07-21-2006 07:52 PM

debugging threads with eclipse
 
How do I debug threads using eclipse?

I have a bug in one of my threads, but I can't step to it for some
reason. Here is an example:


class A{

Thread thread = new thread(B);
thread.start(); //breakpoint1

....
}


class B implements Runnable{

run(){

blah blah // breakpoint 2

}

If I step into (F5) breakpoint 1, it doesn't go into the run method of
class B.

If I try to run to next breakpoint, it just runs till the end of the
program.

Now I know that the thread is executing because I get a partial ouput
from it, but it is incorrect.

So how do I step into a different thread of execution?

Thanks a lot,
Ben

Matt Humphrey 07-21-2006 10:15 PM

Re: debugging threads with eclipse
 

"Ben" <bescott1@vt.edu> wrote in message
news:e9rbb7$69b$1@solaris.cc.vt.edu...
> How do I debug threads using eclipse?
>
> I have a bug in one of my threads, but I can't step to it for some reason.
> Here is an example:
>
>
> class A{
>
> Thread thread = new thread(B);
> thread.start(); //breakpoint1
>
> ...
> }
>
>
> class B implements Runnable{
>
> run(){
>
> blah blah // breakpoint 2
>
> }
>
> If I step into (F5) breakpoint 1, it doesn't go into the run method of
> class B.


That's expected. Start does not call the run method.

>
> If I try to run to next breakpoint, it just runs till the end of the
> program.
>
> Now I know that the thread is executing because I get a partial ouput from
> it, but it is incorrect.


Your technique is correct--set the breakpoint within the code the thread
will execute. I can't tell why this doesn't work without seeing more of
your code, but I would think it has something to do with run not appearing
as you think it does. Either it's a different run method, or your
breakpoint statements really doesn't get executed.

> So how do I step into a different thread of execution?


But the breakpoint on the first statement within the run. If it still
doesn't stop, are you sure you're running with debugging and that it's
really the object you think it is?

Cheers,
Matt Humphrey matth@ivizNOSPAM.com http://www.iviz.com/




All times are GMT. The time now is 11:18 PM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.