Modified Value.cpp to share the code that gets the values as bytes (Value::GetValueAsData()) so now Value::ResolveValue() doesn't do its own thing by reading memory directly.

Also modified the Value class so that you can evaluate expressions without a process, yet with some sections loaded in the target. This allows casting pointers that are in data sections to types and being able to evaluate expressions in the data. For example:

(lldb) target create a.out
(lldb) target modules load --file a.out --slide 0
... find address of something in data ...
(lldb) script
expr_opts = lldb.SBExpressionOptions()
v = lldb.target.EvaluateExpression('(foo *)0x1230000', expr_opts)
print v
vv = lldb.value(v)
print v.pt.x

Above we were able to cast a pointer to an address which was in a.out's data
section and print out entire structures and navigate to the child ivars of the expression.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@172227 91177308-0d34-0410-b5e6-96231b3b80d8
1 file changed