Re: [lldb-dev] Converting a pointer to python string in a formatter

2018-03-19 Thread Greg Clayton via lldb-dev
> On Mar 14, 2018, at 8:22 PM, Florin Trofin via lldb-dev > wrote: > > Hi, > > I came across the formatter example in unicode_strings.py where in > utf16_summary() I see this code: > > string_data = value.process.ReadMemory(pointer, length, error) > # utf8 is safe to emit as-is on OSX > ret

[lldb-dev] Converting a pointer to python string in a formatter

2018-03-14 Thread Florin Trofin via lldb-dev
Hi, I came across the formatter example in unicode_strings.py where in utf16_summary() I see this code: string_data = value.process.ReadMemory(pointer, length, error) # utf8 is safe to emit as-is on OSX return '"%s"' % (string_data.decode('utf-16').encode('utf-8')) I am trying to replicate that