Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [dsdp-dd-dev] RE: register event generation

Title: Hello
Hi Veenu,
I have to agree with Randy on the interface change, i.e. we should keep the context argument as a single generic context: IDMContext<?>.  But I realize that this creates a conflict for the MIRegisters service, where the relationship between register contexts (below)  is a little different than what Randy described for our debugger:

Group DMC <-  Container DMC
Register DMC <- Group DMC, Execution DMC <- Container DMC

To get around this problem I propose that we start using a new, composite context object in the layout nodes, which would simply represent all the DMCs which are found in the TreePath of the update that is being evaluated.  It would then be up to the service implementation to search the context for all the bits of information that are needed.  I attached an example implementation of a CompositeDMC that we could use.


Rohrbach, Randy wrote:
   This would be incorrect. I assume you are adding the groupDmc so as to be able to find the
   group the register is in.
   The regDmc should have as its parent a dmc which is of type IRegisterGroupDMContext.
   This is done when you construct the register DMC.
   If you follow your flow then you would have to add a group context and a register context to
   the function.
   So here are the relationships as I create them in my commercial
   For Group DMC
         GroupDMC <-- ExecutionDMC <-- SymbolDmc
   For Register DMC
         RegDMC <-- GroupDMC <-- ExecutionDMC <-- SymbolDmc
   For BitFieldDMC
         BitFieldDMC <-- RegDMC <-- GroupDMC <-- ExecutionDMC <-- SymbolDmc
   So in the case you mentioned in that routine I get the Group DMC from the Register DMC by doing
   the following
             MIRegisterGroupDMC groupDmc = DMContexts.getAncestorOfType(registerDmc, MIRegisterGroupDMC.class);
    where MIRegisterGroupDMC is a class which implements IRegisterGroupDMContext :
            public static class MIRegisterGroupDMC extends AbstractDMContext<IRegisterGroupDMData> implements IRegisterGroupDMContext {
    If you want please call me and I will be glad to go over this with you 781-364-2226.

From: Veenu Verma [mailto:veenu.verma@xxxxxxxxxxxx]
Sent: Friday, October 05, 2007 10:50 AM
To: Rohrbach, Randy
Subject: RE: register event generation

Hi Randy
Thanx for the code. It's working with the event.
For writing register I had to make a small change in IRegisters interface for writeRegister method.
void writeRegister(IRegisterGroupDMContext groupDmc, IDMContext<?> regCtx, String regValue, String formatId, RequestMonitor rm);
Do you have any comments on this ? I plan to check in the changes
/ Veenu

From: Rohrbach, Randy [mailto:randy.rohrbach@xxxxxxxxxxxxx]
Sent: Wednesday, October 03, 2007 5:50 PM
To: Veenu Verma
Subject: register event generation

   Attached is the code in out commercial register service for generating events.

_______________________________________________ dsdp-dd-dev mailing list dsdp-dd-dev@xxxxxxxxxxx

 * Copyright (c) 2007 Wind River Systems and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * Contributors:
 *     Wind River Systems - initial API and implementation

import java.util.ArrayList;
import java.util.List;

import org.eclipse.dd.dsf.datamodel.IDMContext;
import org.eclipse.dd.dsf.datamodel.IDMData;
import org.eclipse.jface.viewers.TreePath;

public class CompositeDMContext implements IDMContext<IDMData> {
    private final Object fViewerInputObject;
    private final TreePath fTreePath;
    private IDMContext<?>[] fParents;

     * Main constructor provides all data needed to implement the IModelContext
     * interface.
    public CompositeDMContext(Object viewerInputObject, TreePath treePath) {
        fViewerInputObject = viewerInputObject;
        fTreePath = treePath;
        assert getElement() instanceof DMVMContext;

    public String getSessionId() { 
        return getElement().getDMC().getSessionId();
    public String getServiceFilter() { 
        return getElement().getDMC().getServiceFilter(); 
    public IDMContext<?>[] getParents() {
        if (fParents == null) {
            List<IDMContext<?>> parentsList = new ArrayList<IDMContext<?>>(fTreePath.getSegmentCount() + 1);
            for (int i = fTreePath.getSegmentCount() - 1; i >=0 ; i--) {
                if (fTreePath.getSegment(i) instanceof DMVMContext) {
                    parentsList.add( ((DMVMContext)fTreePath.getSegment(i)).getDMC() );
            if (fViewerInputObject instanceof DMVMContext) {
                parentsList.add( ((DMVMContext)fViewerInputObject).getDMC() );
            fParents = parentsList.toArray(new IDMContext<?>[parentsList.size()]);
        return fParents; 
    public Object getAdapter(Class adapterType) {
        return getElement().getAdapter(adapterType);

    public boolean equals(Object obj) {
        return obj instanceof CompositeDMContext && 
               ((CompositeDMContext)obj).fTreePath.equals(fTreePath) &&

    public int hashCode() {
        return fTreePath.hashCode() + fViewerInputObject.hashCode();

    private DMVMContext getElement() {
        return (DMVMContext)(fTreePath.getSegmentCount() != 0 ? fTreePath.getLastSegment() : fViewerInputObject);

Back to the top