Hi,
How is the most used way to inspect/debug values in wxWidgets classes such wxArrayString?
There are any SyntheticChildrenProviders to use with LLDB debugger and Codelite IDE? I've searched for it without results, and I've struggled to build one without success...
What's the best free IDE to use in Linux with CLANG compiler and LLDB debugger?
Thanks,
Debug wxWidgets classes
Re: Debug wxWidgets classes
This may not be really related, but FWIW, wxWidgets ships with GDB pretty printer for some of its classes, including wxArrayString (I have never used it):
https://github.com/wxWidgets/wxWidgets/ ... b/print.py
The CodeLite question would probably be better asked on their forum.
https://github.com/wxWidgets/wxWidgets/ ... b/print.py
The CodeLite question would probably be better asked on their forum.
Re: Debug wxWidgets classes
Hi,
CodeLite is very happy to use clang. I've used it for my wx program without problems.
As you've probably discovered, it's also happy to use lldb; but I've found that less reliable compared with gdb. And as you say, it can't 'see' wxArrayString contents.
Gdb can see inside an wxArrayString though: As PB said, it uses a python pretty-printer to do so.
Regards,
David
CodeLite is very happy to use clang. I've used it for my wx program without problems.
As you've probably discovered, it's also happy to use lldb; but I've found that less reliable compared with gdb. And as you say, it can't 'see' wxArrayString contents.
Gdb can see inside an wxArrayString though: As PB said, it uses a python pretty-printer to do so.
Maybe looking at how a gdb pretty-printer does it would help. wxWidgets now supplies one (in misc/gdb/print.py) but CodeLite still provides one from before then; the wxArrayString section is:There are any SyntheticChildrenProviders to use with LLDB debugger and Codelite IDE? I've searched for it without results, and I've struggled to build one without success...
Code: Select all
class wxArrayString:
class _iterator:
def __init__ (self, items, item_count):
self.items = items
self.item_count = item_count
self.count = 0
def __iter__(self):
return self
def next(self):
count = self.count
self.count = self.count + 1
if count >= self.item_count or count > 5000: # Even 5000 gives a noticeable pause
raise StopIteration
try:
# Try the wx >=2.9 way first
elt = '"' + self.items[count]['_M_dataplus']['_M_p'].string() + '"'
except Exception:
# The wx2.8 way
elt = self.items[count]
return ('[%d]' % count, elt)
# Python3 version
def __next__(self):
return self.next()
def __init__(self, val):
self.val = val
def children(self):
return self._iterator(self.val['m_pItems'], self.val['m_nCount'])
def to_string(self):
# Ideal would be to return e.g. "wxArrayInt", but how to find the type?
return "wxArrayString"
def display_hint(self):
return 'array'
David
Re: Debug wxWidgets classes
Thank you both for your answers.
The reason why I mentioned wxArrayString is just because it is only a entry point for my problem. I have a more complex classes that uses wxArrayString and what I need is the ability to "see" while debugging the content of that classes.
The LLDB seems to use a more easy way to accomplish this because if I define a pretty print for a type it will work in every struct/class that uses it and regardless to be a pointer or a reference. If I use GDB and pretty printers I will have to define a printer for which class and redefine all of his members and if is a pointer redefine it as well.
The problem with LLDB SyntheticChildrenProviders is that it will use Python and I'm not comfortable with it and I believe that this need is not only mine and perhaps someone had developed SyntheticChildrenProvider to wxWidgets classes that can share.
Best regards,
The reason why I mentioned wxArrayString is just because it is only a entry point for my problem. I have a more complex classes that uses wxArrayString and what I need is the ability to "see" while debugging the content of that classes.
The LLDB seems to use a more easy way to accomplish this because if I define a pretty print for a type it will work in every struct/class that uses it and regardless to be a pointer or a reference. If I use GDB and pretty printers I will have to define a printer for which class and redefine all of his members and if is a pointer redefine it as well.
The problem with LLDB SyntheticChildrenProviders is that it will use Python and I'm not comfortable with it and I believe that this need is not only mine and perhaps someone had developed SyntheticChildrenProvider to wxWidgets classes that can share.
Best regards,