[lldb-dev] Custom formatter request

Enrico Granata egranata at apple.com
Mon Dec 10 14:32:45 PST 2012


Hi.
It looks like your task should be relatively easy since you have the full definition of the UniString and the SharedBuffer.
I am assuming you will want to show the string content as your summary (as it happens for std::string and NSString).
If so, how are you going to use the string buffer? Is it going to contain a pointer to the real data?
I am probably slightly confused by your comment next to it.
Could you explain the logic for storing the string data or provide an example of code that handles e.g. the string allocation, or access to it?
Given that understanding, it should be relatively straightforward to accomplish your task.

Enrico Granata
✉ egranata@.com
✆ (408) 972-7683

On Dec 10, 2012, at 7:35 AM, "Somorjai, Akos" <ASomorjai at graphisoft.com> wrote:

> Hello everyone,
> 
> I need a little help with a custom formatter for the class below; I'd appreciate if someone could throw together a skeleton I can start from.
> 
> Thanks,
> 
> Akos
> 
> 
> Here's the class layout:
> 
> class UniString {
> 
> private:
> 	struct SharedBuffer;
> 
> 	SharedBuffer*	content;	// shared buffer storing content of the string
> 
> 		// Implementation classes and structures
> 
> 	struct SharedBuffer {
> 		USize			length;			// length of the string in UniChar::Layout units
> 		USize			capacity;		// capacity of the allocated buffer in UniChar::Layout units
> 		SInt32			refCounter;		// stores number of references to this shared buffer
> 		char			reserved[2];		// padding reserved for the future use
> 		unichar			string[1];			// buffer storing content of the string (extends beyond of the SharedBuffer)
> 
> 		inline SharedBuffer ();
> 		inline SharedBuffer (USize initialLength, USize initialCapacity, Int32 initialRefCounter);
> 	};
>> };
> 
> 
> _______________________________________________
> lldb-dev mailing list
> lldb-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/lldb-dev

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/lldb-dev/attachments/20121210/7cc1d283/attachment.html>


More information about the lldb-dev mailing list