470,866 Members | 1,862 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,866 developers. It's quick & easy.

pthreads and gdb?

I have made a simple pthread program. In main I create a pthread that
has a startroutine as argument which adds two integers. The output is
correct so I guess the threas runs this startroutine. But when I try to
use gdb on the program it never jumps to the start routine, it just
goes through the main function and then returns. I use emacs on Ubuntu
and normaly a little arrow indicates where I am in the code. Why does
this arrow not move to the start routine?

Feb 23 '06 #1
5 2561
blop wrote:
I have made a simple pthread program. In main I create a pthread that
What is a `pthread`? Do you have a C Standard reference for it?
has a startroutine as argument which adds two integers. The output is
correct so I guess the threas runs this startroutine. But when I try to
use gdb on the program it never jumps to the start routine, it just
goes through the main function and then returns. I use emacs on Ubuntu
and normaly a little arrow indicates where I am in the code. Why does
this arrow not move to the start routine?


<OT>
It must be stuck! You need to oil the little gears to the left of the
power switch.
</OT>

--
BR, Vladimir

Feb 23 '06 #2
Hi,
When you use gdb to debug a thread, you should use attach following
the PID to attach the program.

Feb 23 '06 #3

0peng...@gmail.com wrote:
Hi,
When you use gdb to debug a thread, you should use attach following
the PID to attach the program.


a) Quote what and who you're replying to
b) This whole thing is horribly off topic

Please go to a better suited group. If you look around (which none of
you seem to have done) you'll realise this group is dedicated to
Standard C, and not gdb or threads.

--
BR, Vladimir

Feb 23 '06 #4
"blop" <fe******@yahoo.dk> writes:
I have made a simple pthread program. In main I create a pthread that
has a startroutine as argument which adds two integers. The output is
correct so I guess the threas runs this startroutine. But when I try to
use gdb on the program it never jumps to the start routine, it just
goes through the main function and then returns. I use emacs on Ubuntu
and normaly a little arrow indicates where I am in the code. Why does
this arrow not move to the start routine?


Standard C doesn't have threads. If a search of the gdb documentation
doesn't aswner your question, try one of the gdb mailing lists at
<http://www.gnu.org/software/gdb/mailing-lists/>.

--
Keith Thompson (The_Other_Keith) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
Feb 23 '06 #5
blop wrote
(in article
<11********************@z34g2000cwc.googlegroups.c om>):
I have made a simple pthread program. In main I create a pthread that
has a startroutine as argument which adds two integers. The output is
correct so I guess the threas runs this startroutine. But when I try to
use gdb on the program it never jumps to the start routine, it just
goes through the main function and then returns. I use emacs on Ubuntu
and normaly a little arrow indicates where I am in the code. Why does
this arrow not move to the start routine?


It's off-topic. See comp.programming.threads.

hint: look up pthread_join().
--
Randy Howard (2reply remove FOOBAR)
"The power of accurate observation is called cynicism by those
who have not got it." - George Bernard Shaw

Feb 23 '06 #6

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by john | last post: by
reply views Thread by Kevin Dahlhausen | last post: by
5 posts views Thread by Arnd Schroeter | last post: by
15 posts views Thread by John David Ratliff | last post: by
2 posts views Thread by Jack | last post: by
4 posts views Thread by Neel | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.