I hadn't seen that.  That looks pretty useful for things like reintroducing the 
"size" method for std::vectors that hold the size in an easily accessible 
field, or something else like that.  It involves re-implementing the guts of 
the library you are patching up in Python using debugger API's so it isn't 
entirely straight-forward.  Note we already do a similar sort of thing in the 
data formatters to produce nice summaries and "synthetic children" for std & 
Foundation types that can avoid running code.  I think gdb also has some 
formatter infrastructure like this, IIRC, but I haven't used gdb much for a few 
years now.

Anyway, you'd be hard pressed to use something like these Xmethods to do more 
science fiction'y things like "I wish that I had std::vector<T> around for some 
experiment I want to do in the debugger, but the program never used 
std::vector<T>, please make it for me".  Not sure how often you'd really use 
that, but the point is that if we had the C++ modules around, we would get it 
pretty much for free.

Jim


> On Oct 29, 2014, at 10:44 AM, Siva Chandra <sivachan...@google.com> wrote:
> 
> On Wed, Oct 29, 2014 at 10:33 AM,  <jing...@apple.com> wrote:
>> And for instance, if we ever get good support for modules in C++,
>> we could presumably then use that to do things like instantiate template
>> classes for types that weren't instantiated in the current program, and
>> other cool'o things like that which would be hard to do with some
>> hand-built C++ parser, a la gdb.
> 
> GDB's solution for such cases currently is XMethods:
> https://sourceware.org/gdb/current/onlinedocs/gdb/Xmethods-In-Python.html
> 
> There are a bunch of XMethods available for container classes in
> libstdc++: 
> https://gcc.gnu.org/svn/gcc/trunk/libstdc++-v3/python/libstdcxx/v6/xmethods.py


_______________________________________________
lldb-dev mailing list
lldb-dev@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-dev

Reply via email to