kuilpd wrote:

> So the only advantage to making these persistent definitions (or result 
> variables if you want them to be const) is if you wanted to have DIL results 
> available to the expression evaluator. 

Or to use these results for subsequent DIL calls (as per this patch), same 
usage as in the expression evaluator.

> Otherwise you'd be paying the cost of sticking every DIL expression result in 
> target memory and keeping them there forever since you really don't know when 
> you could release them.

We could enable creating them only when used from the console, so that there 
won't be a lot of those variables generated from other calls. Same as when 
`expr` is used in the console.

> Now that the DIL can return new values (e.g. the result of "a + b") we need 
> to make up containers for the results. The most obvious solution to that is 
> ValueObjectConstResult. These expression results are pretty much always going 
> to be const, so that seems the natural container.

> Both result variables and persistent definitions are wrappers around some 
> kind of ValueObject that manage inserting them in memory, and also giving 
> them a real location so that AddressOf works in the target.

DIL already does this, most of the time by using 
`ValueObject::CreateValueObjectFromScalar`. But they're not assigned any real 
address and operator `&` fails on those. I'm not sure if this is a problem, how 
important is that? They can still be used as values in other expressions.

> Also, you'd need to be careful to only do this for definitions, not 
> references to extant things.

I have an idea how to persist only value objects created inside DIL.

All in all, other that the convenience of being able to reuse the results, I 
don't have any motivation to implement this, but at the same time I don't see 
much overhead in the implementation either. If the feature is not useful, then 
I won't look into it further.

https://github.com/llvm/llvm-project/pull/215706
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to