Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [cdt-dev] DSF/GDB: context types required to create an expression

On 06/21/2010 03:50 PM, Mikhail Khodjaiants wrote:
To me it seems that you'll have more flexibility if you keep the fact that the registers use expressions underneath as an implementation detail and not expose it in any API.

You're right, I can do it without exposing as an API.
Of course it may make sense to expose the underlying expression it if there's a good use case for it in the client.

In this case I can pass IRegisterDMContext as a parent to MIExpressionDMC.

I see, though I'm not entirely clear on why you need the register as a parent context of the expression. The parent relationship in contexts is mainly intended to allow you to implement equals() and hashCode() of contexts properly. So for example, frame 0 of one thread is different than frame 0 of another thread. In case of register service using the expression service, a "#pc" expression created by the registers service should be the same as a "#pc" expression typed in by the user in the expressions view, and the same as "#pc" evaluated by some other client (like the disassembly view). This will allow the expressions service to user the same cach value of "#pc" for all the clients.

Which means the disassembly view has to create an expression for #pc with the same context as if it was created by the register service. If disassembly "knows" that pc is a register name, it can use the register service to evaluate it not the expression service directly.
Maybe "#pc" was not the best example :-) I just meant to say that as far as the parent context, what is important is the context which will affect the expression value. The elements of client context which don't affect the value or which are encoded into the expression itself should not be included in the parent context.

I think it makes most sense for the expression service itself to examine the context passed into createExpression() and determine the appropriate parent context for the expression. So the client, such as the disassembly view, or the registers service, could simply pass its current context to the expression service (register group or what not included) and the expression service will create the correct expression DMC.


I have also noticed that IExpressionDMData interface has getRegister() method. What's the purpose of it? To identify expressions created for registers?

cdt-dev mailing list

Back to the top