pthreads and gdb?

B

blop

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?
 
V

Vladimir S. Oka

blop said:
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>
 
0

0peng.li

Hi,
When you use gdb to debug a thread, you should use attach following
the PID to attach the program.
 
V

Vladimir S. Oka

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.
 
K

Keith Thompson

blop said:
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/>.
 
R

Randy Howard

blop wrote
(in article
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().
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top