mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* Re: Pthreadid, pid
       [not found] <200506302001.j5UK1L7w008821@cichlid.com>
@ 2005-07-01  5:02 ` KV Pavuram
  0 siblings, 0 replies; 2+ messages in thread
From: KV Pavuram @ 2005-07-01  5:02 UTC (permalink / raw)
  To: Andrew Burgess, linux-kernel


Thank you Andrew. It worked.

Pav. 


--- Andrew Burgess <aab@cichlid.com> wrote:

> >When i run a multi-threaded program from gdb, gdb
> >shows "New Thread XXXXXXXX (LWP LLLL)" for each new
> >thread created by the application.
> 
> >However, when I run ps -aelfm, the output shows
> each
> >thread of this application but with a different
> PID.
> 
> >And, getpid () in each thread inside the
> application
> >always retreives the same PID.
> 
> >What is the relation between LWP is given by GDB,
> PID
> >shown by ps call and the PID returned by getpid ().
> 
> >Is there any system call to obtain one from the
> >other??
> 
> see gettid(2)
> 
> you need to include the macro call
> _syscall0(pid_t,gettid)
> in your program as gettid isn't in glibc
> 
> 



		
_______________________________________________________
Too much spam in your inbox? Yahoo! Mail gives you the best spam protection for FREE! http://in.mail.yahoo.com

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Pthreadid, pid
@ 2005-06-30 13:14 KV Pavuram
  0 siblings, 0 replies; 2+ messages in thread
From: KV Pavuram @ 2005-06-30 13:14 UTC (permalink / raw)
  To: linux-kernel

Hello,

When i run a multi-threaded program from gdb, gdb
shows "New Thread XXXXXXXX (LWP LLLL)" for each new
thread created by the application.

However, when I run ps -aelfm, the output shows each
thread of this application but with a different PID.

And, getpid () in each thread inside the application
always retreives the same PID.

What is the relation between LWP is given by GDB, PID
shown by ps call and the PID returned by getpid ().

Is there any system call to obtain one from the
other??

The problem occurs when i run strace on one the
threads using PID given by ps command. I cant run
application through GDB for strace to work. So i am
not able to match the strace output to a particular
thread in my application. 

Thanks.
Pav.


		
__________________________________________________________
How much free photo storage do you get? Store your friends 'n family snaps for FREE with Yahoo! Photos http://in.photos.yahoo.com

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2005-07-01  5:02 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <200506302001.j5UK1L7w008821@cichlid.com>
2005-07-01  5:02 ` Pthreadid, pid KV Pavuram
2005-06-30 13:14 KV Pavuram

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®