[lldb-dev] lldb.frame.EvaluateExpression slows down when called a lot

Scott Knight knightsc at gmail.com
Thu Apr 17 07:57:06 PDT 2014


I was recently using lldb to connect to a debug build of ruby to inspect
the heap. In order to do this I was doing something like this

-----------
heaps_used =
lldb.frame.EvaluateExpression('ruby_current_vm->objspace->heap_pages.used').GetValueAsUnsigned(0)

for i in xrange(heaps_used):
    page =
lldb.frame.EvaluateExpression('*ruby_current_vm->objspace->heap_pages.sorted[%i]'
% i)
-----------

What I noticed was that for each EvaluateExpression a temporary $0, $1, $2,
etc.. variable is created. If I ended up calling my python code multiple
times more and more variables seemed to pile up and every
EvaluateExpression call seemed to take longer and longer.

I tried calling EvaluateExpression how I would call expr from the lldb
command line setting my own variable, so something like

lldb.frame.EvaluateExpression('int $test = 5')

But that seemed to error out. So is there some other way in the API that is
better for accessing global variables that won't slow down. Is this
something actually wrong with the debugger? I can create an actual test
case similar to the test suite in lldb if that would be helpful.

Thanks,
Scott Knight
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/lldb-dev/attachments/20140417/e752fb86/attachment.html>


More information about the lldb-dev mailing list