site_archiver@lists.apple.com Delivered-To: Darwin-dev@lists.apple.com On Mar 19, 2007, at 4:35 PM, David Alter wrote: I don't mean to be disheartening, but I think this is impossible. -Ed _______________________________________________ Do not post admin requests to the list. They will be ignored. Darwin-dev mailing list (Darwin-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/darwin-dev/site_archiver%40lists.appl... 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. 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. This email sent to site_archiver@lists.apple.com
participants (1)
-
Ed Wynne