[lldb-dev] LLDB equivalent of GDB's '@' operator in Xcode 4.1

Enrico Granata granata.enrico at gmail.com
Mon Aug 15 23:44:56 PDT 2011


Hi,

currently one way to obtain the result you want in LLDB is to exploit summaries

For example,
> (lldb) frame variable
> (int *) x = 0x00000001001008e0

Let's say that x is a pointer to 10 integers. To show the values:
> (lldb) type summary add -f ${var[0-9]} "int *"
> (lldb) frame variable
> (int *) x = 0x00000001001008e0 [0,1,2,3,4,5,6,7,8,9]

Of course, you want to delete the summary after showing the variable, because not all int* are actually 10-element arrays.

Unfortunately, at present, trying this fails:
> (lldb) frame variable x[0-9]
> error: bitfield range 0-9 is not valid for "(int *) x"

Some code infrastructure is in place to have the above work, but currently not all the pieces are linked to one another and some "glue code" is missing, so the debugger is unable to infer that the above probably meant "show x[0] thru x[9]", instead of "try to read bits 0 thru 9 of x" (but x is a non-scalar, so that raises an error)

If you are interested in looking at the details, StackFrame::GetValueForVariableExpressionPath and ValueObject::GetValueForExpressionPath are the places to look for implementation details and ideas.

Hope the above helps you.

Sincerely,
Enrico Granata

On Aug 15, 2011, at 10:25 PM, Martin Pavlovsky wrote:

> Hi,
> 
> I would like to view an array of elements pointed to by a pointer. In GDB this can be done by treating the pointed memory as an artificial array of a given length using the operator '@' as
> 
> *pointer @ length
> 
> where length is the number of elements I want to view.
> 
> The above syntax does not work in LLDB supplied with Xcode 4.1. Is there any way how to accomplish the above in LLDB?
> 
> Kind Regards,
> Martin Pavlovsky _______________________________________________
> lldb-dev mailing list
> lldb-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/lldb-dev


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/lldb-dev/attachments/20110815/df4c95f6/attachment.html>


More information about the lldb-dev mailing list