LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 08-08-2011, 02:08 AM   #1
ven_visu
LQ Newbie
 
Registered: Aug 2011
Posts: 2

Rep: Reputation: Disabled
how to debug single thread using gdb


Hi All,

I have a written a function which will spawn a thread.
i want to debug the thread function.

func1()
{

pthread_create(&thread,NULL,thread_fun,&thread_arg);

}
thread_fun()
{
printf("inside function");
}

when i do the gdb

>gdb test
> b func1
>n
> thread created.
> info threads
> shows two threads.
> thread 2 (switched to 2nd thread)



I have tried: break filename:line number thread 2

After i have entered "continue".

program exited normally came

Then how to debug the thread_fun().
Please help me.

Regards,
venkat.
 
Old 09-08-2011, 04:04 AM   #2
mulyadi.santosa
Member
 
Registered: Sep 2011
Posts: 96

Rep: Reputation: 15
Hi

Well, have you simply tried to issue "break thread_fun"? And have you made you your program is compiled with debugging symbol included? It is "-g" in gcc in case you forgot it.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
how to debug macros under gdb dayalan_cse Programming 7 06-29-2010 09:24 AM
Debug using gdb and gdbserver Hachaso Programming 0 06-05-2009 03:56 PM
cannot debug with gdb ufmale Programming 9 04-27-2009 05:21 PM
Using gdb to debug different arhitectures george_mercury Linux - Software 1 01-07-2005 06:19 PM
how to debug multithread using GDB? ryanux Programming 1 05-11-2004 12:58 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 04:24 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration