• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
How to tell which thread is which in the debugger?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

How to tell which thread is which in the debugger?


  • Subject: How to tell which thread is which in the debugger?
  • From: Jens Alfke <email@hidden>
  • Date: Thu, 22 Mar 2012 10:19:25 -0700

I’m trying to debug some multithreaded code, but I can’t figure out how to tell which NSThread I create corresponds to which thread in the Xcode debugger view.

In other words: my code creates an NSThread and sets its .name property. If I get a description of the NSThread or log it in an NSLog, it describes itself as e.g.:
	<NSThread: 0x101020410>{name = MyGroovyThread, num = 5}

However, the Xcode debugger (and gdb, and ‘sample’, and the crash reporter) show the thread with a different, larger number. As far as I can tell, the ‘num =‘ in the NSThread’s description is simply a serial number incremented by NSThread, and doesn’t correspond to the way the rest of the OS numbers threads. (Why not?)

I was hoping that the ‘name’ property of the NSThread would show up in the debugger, since it does display names with some threads. But it doesn’t. (Why not?) How can I set a name that will show up in the debugger — do I need to use the pthreads API for that?

—Jens

PS: This is one of those questions that might also belong in xcode-users, but it seems more like the issue is with NSThread, not with Xcode.
_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden


  • Follow-Ups:
    • Re: How to tell which thread is which in the debugger?
      • From: Wade Tregaskis <email@hidden>
  • Prev by Date: Re: CALayer composition changes with frame position
  • Next by Date: Re: How to tell which thread is which in the debugger?
  • Previous by thread: Easy wifi credentials
  • Next by thread: Re: How to tell which thread is which in the debugger?
  • Index(es):
    • Date
    • Thread