[
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 21/06/2010 5:44 PM, Pawel Piech wrote:
On 06/21/2010 12:16 PM, Mikhail Khodjaiants wrote:
It seems the following is a better option, but I haven't tried it yet.
public interface IGDBRegisters extends IRegisters {
public interface IGDBRegisterDMContext extends IRegisterDMContext {
IExpressionDMContext getExpressionDMC();
}
public interface IGDBRegisterDMData extends IRegisterDMData {
IExpressionDMData getExpressionData();
}
}
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.
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.
I have also noticed that IExpressionDMData interface has getRegister()
method. What's the purpose of it? To identify expressions created for
registers?
Thanks,
Mikhail