• 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: LLDB: Printing Unicode in the Console
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: LLDB: Printing Unicode in the Console


  • Subject: Re: LLDB: Printing Unicode in the Console
  • From: Jean-Denis MUYS <email@hidden>
  • Date: Wed, 14 Mar 2012 08:25:16 +0000
  • Thread-topic: LLDB: Printing Unicode in the Console

On 13 mars 2012, at 20:03, Rick Mann wrote:

> Dunno if this would help, but if you add some category methods to NSData to print the data the way you like, you can probably invoke those from LLDB.
>
> On Mar 13, 2012, at 3:06 , Andreas Grosam wrote:
>
>> Is it somehow possible to format and print a byte array or a pointer to bytes (say NSData, or a pointer to void) whose content is an Unicode sequence to the Debugger console?
>>
>> It seems, we can't print anything other than a char* as a zero terminated C-string, and NSString variables formatted as a human readable string.
>>
>> I would like to able to print any byte sequences interpreted as the specified Unicode encoding scheme (UTF-8, UTF-16LE, UTF-16BE, etc.) with an optional length attribute for the number of bytes consumed from the input, or optionally terminated by Unicode NULL.
>>
>> Other encodings would be nice, too. Is it possible to extend LLDB in any fashion?
>>
>> Andreas

Also, the "po" command invokes the object "-(NSString*)description" method. You can of course implement that method for your own objects to print the way you wish. I usually do that a lot (careful with Core Data objects: accessing Core Data attributes fire faults and is therefore not side-effect-free).

I suppose NSData already implements a description method. You can subclass NSData for debugging purposes, but I think it's a class cluster, so this might not be the best solution.

The last option is to method-swizzle the description method in the NSData class. I you conditionally compile that in only in debug builds, that sounds an attractive option.

Jean-Denis


 _______________________________________________
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: LLDB: Printing Unicode in the Console
      • From: Sean McBride <email@hidden>
References: 
 >LLDB: Printing Unicode in the Console (From: Andreas Grosam <email@hidden>)
 >Re: LLDB: Printing Unicode in the Console (From: Rick Mann <email@hidden>)

  • Prev by Date: Code Indexing and .a files?
  • Next by Date: Re: is there a way to replace instances of a string only within selected text?
  • Previous by thread: Re: LLDB: Printing Unicode in the Console
  • Next by thread: Re: LLDB: Printing Unicode in the Console
  • Index(es):
    • Date
    • Thread