Re: Thread number
Re: Thread number
- Subject: Re: Thread number
- From: Ed Wynne <email@hidden>
- Date: Mon, 19 Mar 2007 16:48:52 -0400
On Mar 19, 2007, at 4:35 PM, David Alter wrote:
I want to get the thread number for a pthread. When I say the
thread number, I'm looking for the same thread number that gdb
would use when selecting threads to debug. I want the thread number
to be part of the information I log.
I don't mean to be disheartening, but I think this is impossible.
Last I knew, the thread number gdb used was the mach_port_t naming
the underlying mach thread. The problem with this is that mach ports
are like file descriptors. They are just process specific integer
values used to name kernel resources. You can figure out the
mach_port_t for your thread in your process by calling
pthread_mach_thread_np(), but when gdb asks mach for your threads
it'll receive them with mach_port_t assignments that are specific to
it's process context. Gdb's mach_port_t's won't have any relation to
your mach_port_t's. Just like if your process and gdb opened the same
file, their fd's would be entirely unrelated.
That said, it is possible for gdb to figure out the mach_port_t
values from your processes perspective and display them... but last I
checked, it didn't.
-Ed
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden