By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,469 Members | 1,885 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,469 IT Pros & Developers. It's quick & easy.

Multithreaded debugging?

P: n/a
What's the best way to debug a multithread program?

I'm using JBuilderX (Foundation), not sure if this has decent
multithread debug capabilities, are there any good tutorials out there
that explain how to do it in JBuilder?

I'm not so botherered about synchorisiation, I just have several
independedent threads happening at once and I'd like to be able to
step through one thread at a time as if it was an ordinary program
with the other threads not there.
Jul 17 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
I've developed several multi-threaded applications with JBuilder. in
fact, i cannot imagine trying to get one done without it.

give it a whirl, place break points inside separate threads, watch the
debugger handle it with no problems at all....

- perry

Charles Fox wrote:
What's the best way to debug a multithread program?

I'm using JBuilderX (Foundation), not sure if this has decent
multithread debug capabilities, are there any good tutorials out there
that explain how to do it in JBuilder?

I'm not so botherered about synchorisiation, I just have several
independedent threads happening at once and I'd like to be able to
step through one thread at a time as if it was an ordinary program
with the other threads not there.


Jul 17 '05 #2

P: n/a
Thanks for your reply, however,

I don't quite get how JBuilder does this -- I have tried putting
breakpoints in parts of the code run by each thread, but I find that
when I step though the code, it randomly skips between threads. I
need to be able to step through a single thread and ignore the other
threads. Am I missing something? I've tried right-clicking the
thread icon in the 'threads,call stacks,data' window and selecting
'steppign thread' but it doesn't seem to do anything different. Are
there any instructions on the web with details of how to do this? I
can't find anything!
Jul 17 '05 #3

P: n/a
"but I find that when I step though the code, it randomly skips between
threads."

you have to realize that it is part of the java specification to allow
threads to execute whenever and however they want. no part of the
contract says that one thread must execute before, during or after
another. in fact, it's technically possible for the java runtime to hold
a thread altogether until it feels it's ready to run it.

if your seeing this behaviour then the good news is, is that your jre is
working fine.

as for stepping thru a single thread, do so! as for the other threads in
the background doing there thing, this is where design comes into play.
your problems are not with the thread implementation provided by java,
it's with your need for a good thread synchronization strategy. there's
a very good book dedicated to JavaSpaces that provides plenty of cool
ways to get threads to share a resource or share a work in progress.

http://www.awprofessional.com/title/0201309556

the cool part of this is that you get to learn this and apply your own
ideas on it today!

amazon has a good book review too. but don't get side tracked into
thinking that you need JavaSpaces on top of what you are already doing.
JavaSpaces was intended to simplify a distributed application over Jini.
In your case, you'll be more interested in the design patterns.

This I think is what you are really after.

Feel free to email me directly for more on this.

- perry

pe***@cplusplus.org
Charles Fox wrote:
Thanks for your reply, however,

I don't quite get how JBuilder does this -- I have tried putting
breakpoints in parts of the code run by each thread, but I find that
when I step though the code, it randomly skips between threads. I
need to be able to step through a single thread and ignore the other
threads. Am I missing something? I've tried right-clicking the
thread icon in the 'threads,call stacks,data' window and selecting
'steppign thread' but it doesn't seem to do anything different. Are
there any instructions on the web with details of how to do this? I
can't find anything!


Jul 17 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.