Re: LLDB: Printing Unicode in the Console
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