qt - Can LLDB data formatters call methods? -


i'm debugging qt application using lldb. @ breakpoint can write

(lldb) p myqstring.toutf8().data() 

and see string contained within myqstring, data() returns char*. able write

(lldb) p myqstring 

and same output. didn't work me:

(lldb) type summary add --summary-string "${var.toutf8().data()}" qstring 

is possible write simple formatter this, or need know internals of qstring , write python script?

alternatively, there way should using lldb view qstrings way?

the following work

  first register summary command: debugger.handlecommand('type summary add -f  set_sblldbbp.qstring_summary "qstring"')  here implementation  def make_string_from_pointer_with_offset(f,offs,l):     strval = 'u"'     try:         data_array = f.getpointeedata(0, l).uint16         x in range(offs, l):             v = data_array[x]             if v == 0:                 break             strval += unichr(v)     except:         pass     strval = strval + '"'     return strval.encode('utf-8')   #qt5 def qstring_summary(value, unused):     try:         d = value.getchildmemberwithname('d')         #have divide 2 (size of unsigned short = 2)         offset = d.getchildmemberwithname('offset').getvalueasunsigned() / 2         size = get_max_size(value)         return make_string_from_pointer_with_offset(d, offset, size)     except:         print '?????????????????????????'         return value  def get_max_size(value):     _max_size_ = none     try:         debugger = value.gettarget().getdebugger()         _max_size_ = int(lldb.sbdebugger.getinternalvariablevalue('target.max-string-summary-length', debugger.getinstancename()).getstringatindex(0))     except:         _max_size_ = 512     return _max_size_  

Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -