• 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
Re: Still no way to view CFString in custom data fomatter, huh?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Still no way to view CFString in custom data fomatter, huh?


  • Subject: Re: Still no way to view CFString in custom data fomatter, huh?
  • From: Chris Espinosa <email@hidden>
  • Date: Wed, 31 Oct 2007 21:53:59 -0700


On Oct 31, 2007, at 8:32 PM, Rick Mann wrote:


Huh. Well, two things.

1) When I look at a C++ object pointer and drill down to the CFTypeRef, I get nothing. Now, maybe that's not the data formatting fault, because Xcode thinks the variable is out of scope. Here's the code:

GroundStation* gs = new GroundStation();


gs->setID(1);
gs->setName("San Carlos");


setName takes an object NString, which wraps a CFTypeRef, which is really a pointer to a CFStringRef.

At a breakpoint just after the setName() call, I can dink open gs, and get something like this:

gs
  ObjectOfInterest (superclass of gs)
    private
      mName   type: NString  value: {...}   summary: out of scope
        NCFObject
          private
            mObject   type: CFTypeRef  value: 0x664d20   summary: <empty>


So, I don't know why the first is out of scope, but it seems to have an address for mObject, but it won't render it. Maybe that's because it can't tell what it is, but I *can* choose Print Description to Console and that prints the value of the string. Seems like it could do the same to the summary window.

2) The doc for Custom Data Formatters says "Note, however, that you cannot specify a custom format for string types, such as NSString, char*, and so on." This makes me sad, 'cause I'd really like to make one so that the top-level NString shows the string value.

I think you're misinterpreting that sentence.  It means you can't write a custom data formatter to display CFStringRefs differently than the standard CFStringRef formatter. It doesn't mean that it can't display strings.  (Even we would consider that lame.)

The notable thing about data formatters, standard or custom, is that they're keyed off of the declared type of the variable or data member, not the type of what you assign to it.  So if mObject is an NString, and there's no standard data formatter for NString, then you need to create a custom data formatter for it.

It's easy enough to do so; if you can assure that an NString is always a CFStringRef, then you just cast it.  In the Summary, type:

{(CFStringRef)$VAR}:s

That's a custom data formatter for NString that causes it to be displayed as a CFStringRef.

Now the fact that the debugger thinks it's out of scope at that point is interesting, and may be an obstacle, but if you can print the NString in the debugger console by casting it to a CFStringRef, then you can show it in the debugger by creating a custom data formatter that does the same thing.

Chris
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: Still no way to view CFString in custom data fomatter, huh?
      • From: Rick Mann <email@hidden>
References: 
 >Still no way to view CFString in custom data fomatter, huh? (From: Rick Mann <email@hidden>)
 >Re: Still no way to view CFString in custom data fomatter, huh? (From: Dmitry Markman <email@hidden>)
 >Re: Still no way to view CFString in custom data fomatter, huh? (From: Rick Mann <email@hidden>)

  • Prev by Date: Re: installing Dev tools on external drive(s)
  • Next by Date: Re: Xcode 2.5 linker undefined symbols for PowerPlant application
  • Previous by thread: Re: Still no way to view CFString in custom data fomatter, huh?
  • Next by thread: Re: Still no way to view CFString in custom data fomatter, huh?
  • Index(es):
    • Date
    • Thread