From 5fa8b64ad62d7733e92dca898d321e6d53d7a2e9 Mon Sep 17 00:00:00 2001 From: Pawel Piech Date: Thu, 28 Sep 2006 18:14:14 +0000 Subject: [PATCH] DSF Updates related to adding registers view. --- .../dsf/ui/model/DataViewModelSchemaNode.java | 5 +- .../dd/dsf/ui/model/IViewModelSchemaNode.java | 4 +- .../dd/dsf/ui/model/ViewModelDelta.java | 4 +- .../dd/dsf/ui/model/ViewModelProvider.java | 12 +++- plugins/org.eclipse.dd.dsf/.options | 2 + .../src/org/eclipse/dd/dsf/DsfPlugin.java | 15 ++++- .../dd/dsf/concurrent/DefaultDsfExecutor.java | 55 +++++++++++++++---- .../eclipse/dd/dsf/concurrent/DsfQuery.java | 3 +- .../dd/dsf/concurrent/DsfRunnable.java | 41 ++++++++++---- .../dd/dsf/concurrent/DsfSequence.java | 11 +--- .../concurrent/GetDataDoneWithClientDone.java | 3 + .../eclipse/dd/dsf/debug/IExpressions.java | 2 +- .../org/eclipse/dd/dsf/debug/IModules.java | 5 -- .../src/org/eclipse/dd/dsf/debug/IOS.java | 4 +- .../org/eclipse/dd/dsf/debug/IRegisters.java | 33 +++++------ .../src/org/eclipse/dd/dsf/debug/IStack.java | 4 -- .../org/eclipse/dd/dsf/debug/ISymbols.java | 10 ++-- .../eclipse/dd/dsf/model/DataModelEvent.java | 2 - .../dd/dsf/service/AbstractDsfService.java | 2 - .../dsf/service/DsfServiceEventHandler.java | 2 - .../eclipse/dd/dsf/service/DsfSession.java | 16 ++++-- .../eclipse/dd/dsf/service/IDsfService.java | 6 -- 22 files changed, 142 insertions(+), 99 deletions(-) create mode 100644 plugins/org.eclipse.dd.dsf/.options diff --git a/plugins/org.eclipse.dd.dsf.ui/src/org/eclipse/dd/dsf/ui/model/DataViewModelSchemaNode.java b/plugins/org.eclipse.dd.dsf.ui/src/org/eclipse/dd/dsf/ui/model/DataViewModelSchemaNode.java index 61a8355957c..04a7fed2faf 100644 --- a/plugins/org.eclipse.dd.dsf.ui/src/org/eclipse/dd/dsf/ui/model/DataViewModelSchemaNode.java +++ b/plugins/org.eclipse.dd.dsf.ui/src/org/eclipse/dd/dsf/ui/model/DataViewModelSchemaNode.java @@ -65,7 +65,7 @@ abstract public class DataViewModelSchemaNode implements IViewModelSchemaNode { } public String toString() { - return fParent.toString() + "\n" + fDmc.toString(); + return fParent.toString() + "->" + fDmc.toString(); } } @@ -127,7 +127,7 @@ abstract public class DataViewModelSchemaNode implements IViewModelSchemaNode { fExecutor.execute(done); }}; - // TODO: Note this is pretty inefficient: for one the below loop could + // Note: this is pretty inefficient. For one the below loop could // potentially retrieve the elements for this node several times, but // beyond that it may be possible to optimize this code based on what's // visible in the view. @@ -222,7 +222,6 @@ abstract public class DataViewModelSchemaNode implements IViewModelSchemaNode { } public void sessionDispose() { - // FIXME: should track when disposed and avoid issuing model deltas fServices.dispose(); for (IViewModelSchemaNode childNode : getChildNodes()) { childNode.sessionDispose(); diff --git a/plugins/org.eclipse.dd.dsf.ui/src/org/eclipse/dd/dsf/ui/model/IViewModelSchemaNode.java b/plugins/org.eclipse.dd.dsf.ui/src/org/eclipse/dd/dsf/ui/model/IViewModelSchemaNode.java index 37beb9413ce..3e6679e1b12 100644 --- a/plugins/org.eclipse.dd.dsf.ui/src/org/eclipse/dd/dsf/ui/model/IViewModelSchemaNode.java +++ b/plugins/org.eclipse.dd.dsf.ui/src/org/eclipse/dd/dsf/ui/model/IViewModelSchemaNode.java @@ -45,14 +45,14 @@ public interface IViewModelSchemaNode { * current level. * @param done The data return token. */ - public void getElements(final IViewModelContext parentVmc, GetDataDone done); + public void getElements(IViewModelContext parentVmc, GetDataDone done); /** * Retrieves the label for the given element. * @param vmc Element for which to retrieve label information. * @param result Monitor which accepts the data. */ - public void retrieveLabel(IViewModelContext vmc, final ILabelRequestMonitor result); + public void retrieveLabel(IViewModelContext vmc, ILabelRequestMonitor result); /** * Returns the list of child schema nodes which are configured for this node. diff --git a/plugins/org.eclipse.dd.dsf.ui/src/org/eclipse/dd/dsf/ui/model/ViewModelDelta.java b/plugins/org.eclipse.dd.dsf.ui/src/org/eclipse/dd/dsf/ui/model/ViewModelDelta.java index eb0dbf87004..9451da2e594 100644 --- a/plugins/org.eclipse.dd.dsf.ui/src/org/eclipse/dd/dsf/ui/model/ViewModelDelta.java +++ b/plugins/org.eclipse.dd.dsf.ui/src/org/eclipse/dd/dsf/ui/model/ViewModelDelta.java @@ -18,9 +18,7 @@ import org.eclipse.debug.internal.ui.viewers.provisional.ModelDelta; * This delta class mostly just duplicates the ModelDelta implemention, but * it allows clients to modify the flags after the original object is * constructed. - *

- * TODO: This class derives from ModelDelta as opposed to just implementing IModelDelta - * because of a reference in IModelDelta to ModelDelta. Need to file a bug on it. + * * @see IModelDelta#getNodes() */ @SuppressWarnings("restriction") diff --git a/plugins/org.eclipse.dd.dsf.ui/src/org/eclipse/dd/dsf/ui/model/ViewModelProvider.java b/plugins/org.eclipse.dd.dsf.ui/src/org/eclipse/dd/dsf/ui/model/ViewModelProvider.java index 7a054a3457a..a36fccca031 100644 --- a/plugins/org.eclipse.dd.dsf.ui/src/org/eclipse/dd/dsf/ui/model/ViewModelProvider.java +++ b/plugins/org.eclipse.dd.dsf.ui/src/org/eclipse/dd/dsf/ui/model/ViewModelProvider.java @@ -108,6 +108,14 @@ public class ViewModelProvider extends AbstractModelProxy } } + private boolean isOurSchemaNode(IViewModelSchemaNode schemaNode, IViewModelSchemaNode[] nodesToSearch) { + for (IViewModelSchemaNode node : nodesToSearch) { + if (node == schemaNode) return true; + if (isOurSchemaNode(schemaNode, node.getChildNodes())) return true; + } + return false; + } + /** * Performs the query to determine if given VNC is a container. * Note: this method must be called on the provider's dispatch thread. @@ -122,7 +130,7 @@ public class ViewModelProvider extends AbstractModelProxy // collect the list of children. Otherwise, get the child schema nodes // out of VMC's schema node. IViewModelSchemaNode[] childSchemaNodes; - if (vmc == fRootVMC) { + if (vmc == fRootVMC || !isOurSchemaNode(vmc.getSchemaNode(), fRootSchemaNodes)) { childSchemaNodes = fRootSchemaNodes; } else { childSchemaNodes = vmc.getSchemaNode().getChildNodes(); @@ -161,7 +169,7 @@ public class ViewModelProvider extends AbstractModelProxy // Get the child nodes as in isContainer(). IViewModelSchemaNode[] childSchemaNodes; - if (vmc == fRootVMC) { + if (vmc == fRootVMC || !isOurSchemaNode(vmc.getSchemaNode(), fRootSchemaNodes)) { childSchemaNodes = fRootSchemaNodes; } else { childSchemaNodes = vmc.getSchemaNode().getChildNodes(); diff --git a/plugins/org.eclipse.dd.dsf/.options b/plugins/org.eclipse.dd.dsf/.options new file mode 100644 index 00000000000..54b07bac112 --- /dev/null +++ b/plugins/org.eclipse.dd.dsf/.options @@ -0,0 +1,2 @@ +org.eclipse.dd.dsf/debug = false +org.eclipse.dd.dsf/debug/executor = false diff --git a/plugins/org.eclipse.dd.dsf/src/org/eclipse/dd/dsf/DsfPlugin.java b/plugins/org.eclipse.dd.dsf/src/org/eclipse/dd/dsf/DsfPlugin.java index a87ce47e211..7582eb85e83 100644 --- a/plugins/org.eclipse.dd.dsf/src/org/eclipse/dd/dsf/DsfPlugin.java +++ b/plugins/org.eclipse.dd.dsf/src/org/eclipse/dd/dsf/DsfPlugin.java @@ -10,6 +10,7 @@ *******************************************************************************/ package org.eclipse.dd.dsf; +import org.eclipse.core.runtime.Platform; import org.eclipse.core.runtime.Plugin; import org.osgi.framework.BundleContext; @@ -24,8 +25,12 @@ public class DsfPlugin extends Plugin { // The shared instance private static DsfPlugin fgPlugin; + // BundleContext of this plugin private static BundleContext fgBundleContext; + // Debugging flag + public static boolean DEBUG = false; + /** * The constructor */ @@ -40,7 +45,8 @@ public class DsfPlugin extends Plugin { public void start(BundleContext context) throws Exception { fgBundleContext = context; super.start(context); - } + DEBUG = "true".equals(Platform.getDebugOption("org.eclipse.debug.ui/debug")); //$NON-NLS-1$//$NON-NLS-2$ + } /* * (non-Javadoc) @@ -64,5 +70,12 @@ public class DsfPlugin extends Plugin { public static BundleContext getBundleContext() { return fgBundleContext; } + + public static void debug(String message) { + if (DEBUG) { + System.out.println(message); + } + } + } diff --git a/plugins/org.eclipse.dd.dsf/src/org/eclipse/dd/dsf/concurrent/DefaultDsfExecutor.java b/plugins/org.eclipse.dd.dsf/src/org/eclipse/dd/dsf/concurrent/DefaultDsfExecutor.java index 5247c800a17..fd739eaf8fe 100644 --- a/plugins/org.eclipse.dd.dsf/src/org/eclipse/dd/dsf/concurrent/DefaultDsfExecutor.java +++ b/plugins/org.eclipse.dd.dsf/src/org/eclipse/dd/dsf/concurrent/DefaultDsfExecutor.java @@ -10,10 +10,17 @@ *******************************************************************************/ package org.eclipse.dd.dsf.concurrent; +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.PrintStream; +import java.util.concurrent.CancellationException; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.Future; import java.util.concurrent.ScheduledThreadPoolExecutor; import java.util.concurrent.ThreadFactory; import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Platform; import org.eclipse.core.runtime.Status; import org.eclipse.dd.dsf.DsfPlugin; @@ -25,6 +32,14 @@ import org.eclipse.dd.dsf.DsfPlugin; public class DefaultDsfExecutor extends ScheduledThreadPoolExecutor implements DsfExecutor { + // debug tracing flags + public static boolean DEBUG_EXECUTOR = false; + static { + DEBUG_EXECUTOR = DsfPlugin.DEBUG && "true".equals( //$NON-NLS-1$ + Platform.getDebugOption("org.eclipse.dd.dsf/debug/executor")); //$NON-NLS-1$ + } + + static class DsfThreadFactory implements ThreadFactory { Thread fThread; public Thread newThread(Runnable r) { @@ -34,8 +49,6 @@ public class DefaultDsfExecutor extends ScheduledThreadPoolExecutor } } - - public DefaultDsfExecutor() { super(1, new DsfThreadFactory()); } @@ -45,16 +58,36 @@ public class DefaultDsfExecutor extends ScheduledThreadPoolExecutor } @Override - protected void afterExecute(Runnable r, Throwable t) { - // FIXME: Unfortunately this is not enough to catch runnable exceptions, because - // FutureTask implementation swallows exceptions when they're thrown by runnables. - // Need to override the FutureTask class, and the AbstractExecutorService.submit() - // methods in order to provide access to these exceptions. + protected void beforeExecute(Thread t, Runnable r) { + System.out.println(""); + + + } - super.afterExecute(r, t); - if (t != null) { - DsfPlugin.getDefault().getLog().log(new Status( - IStatus.ERROR, DsfPlugin.PLUGIN_ID, -1, "Uncaught exception in dispatch thread.", t)); + @Override + protected void afterExecute(Runnable r, Throwable t) { + if (r instanceof Future) { + Future future = (Future)r; + try { + future.get(); + } catch (InterruptedException e) { // Ignore + } catch (CancellationException e) { // Ignore also + } catch (ExecutionException e) { + if (e.getCause() != null) { + DsfPlugin.getDefault().getLog().log(new Status( + IStatus.ERROR, DsfPlugin.PLUGIN_ID, -1, "Uncaught exception in DSF executor thread", e.getCause())); + if (DEBUG_EXECUTOR) { + ByteArrayOutputStream outStream = new ByteArrayOutputStream(512); + PrintStream printStream = new PrintStream(outStream); + try { + printStream.write("Uncaught exception in session executor thread: ".getBytes()); + } catch (IOException e2) {} + e.getCause().printStackTrace(new PrintStream(outStream)); + DsfPlugin.debug(outStream.toString()); + } + } + } } } + } diff --git a/plugins/org.eclipse.dd.dsf/src/org/eclipse/dd/dsf/concurrent/DsfQuery.java b/plugins/org.eclipse.dd.dsf/src/org/eclipse/dd/dsf/concurrent/DsfQuery.java index 71e9d7ef9dd..bf26e3f77d4 100644 --- a/plugins/org.eclipse.dd.dsf/src/org/eclipse/dd/dsf/concurrent/DsfQuery.java +++ b/plugins/org.eclipse.dd.dsf/src/org/eclipse/dd/dsf/concurrent/DsfQuery.java @@ -25,7 +25,6 @@ import org.eclipse.dd.dsf.DsfPlugin; * data at end of Callable#call method. * * @see java.util.concurrent.Callable - * FIXME: make this class implement the Future interface. */ abstract public class DsfQuery { @@ -66,7 +65,7 @@ abstract public class DsfQuery { if (!fWaiting) { fFuture = fExecutor.submit(new DsfRunnable() { public void run() { - // TODO: not sure if this try-catch is desirable. It might encourage + // Note: not sure if this try-catch is desirable. It might encourage // implementors to not catch its own exceptions. If the query code takes // more than one dispatch, then this code will not be helpful anyway. try { diff --git a/plugins/org.eclipse.dd.dsf/src/org/eclipse/dd/dsf/concurrent/DsfRunnable.java b/plugins/org.eclipse.dd.dsf/src/org/eclipse/dd/dsf/concurrent/DsfRunnable.java index 6318b8a9dcb..47efc51d75b 100644 --- a/plugins/org.eclipse.dd.dsf/src/org/eclipse/dd/dsf/concurrent/DsfRunnable.java +++ b/plugins/org.eclipse.dd.dsf/src/org/eclipse/dd/dsf/concurrent/DsfRunnable.java @@ -14,32 +14,49 @@ package org.eclipse.dd.dsf.concurrent; * A DSF-instrumented alternative to the Runnable interface. *

* While it is perfectly fine for clients to call the DSF executor with - * an object only implementing the Runnable interface, the DsfRunnable is a - * place holder for future tracing enhancments for DSF. + * an object only implementing the Runnable interface, the DsfRunnable + * contains fields and methods that used for debugging and tracing when + * tracing is enabled. */ abstract public class DsfRunnable implements Runnable { private StackTraceElement [] fStackTrace = null; + private Runnable fSubmittedBy = null; public DsfRunnable() { // Use assertion flag (-ea) to jre to avoid affecting performance when not debugging. boolean assertsEnabled = false; assert assertsEnabled = true; - if (assertsEnabled) { + if (assertsEnabled || DefaultDsfExecutor.DEBUG_EXECUTOR) { fStackTrace = Thread.currentThread().getStackTrace(); } } public String toString () { - // If assertions are not turned on. - if (fStackTrace == null) return super.toString(); - StringBuilder builder = new StringBuilder() ; - // ommit the first elements in the stack trace - for ( int i= 3 ; i < fStackTrace.length; i++ ) { - builder.append ( "\tat " ) ; - builder.append ( fStackTrace [ i ] .toString ()) ; - builder.append ( "\n" ) ; + // If assertions are not turned on. + builder.append(super.toString()); + if (fStackTrace != null) { + builder.append ( "\n\tCreated at" ) ; + + // ommit the first elements in the stack trace + for (int i = 3; i < fStackTrace.length && i < 13; i++) { + if (i > 3) builder.append ( "\tat " ) ; + builder.append( fStackTrace [ i ] .toString ()) ; + builder.append( "\n" ) ; + } + if (fStackTrace.length > 13) { + builder.append("\t at ..."); + } } - return builder.toString () ; + if (fSubmittedBy != null) { + builder.append("Submitted by \n"); + builder.append(fSubmittedBy.toString()); + } + + return builder.toString(); } + + void setSubmittedBy(Runnable runnable) { + fSubmittedBy = runnable; + } } diff --git a/plugins/org.eclipse.dd.dsf/src/org/eclipse/dd/dsf/concurrent/DsfSequence.java b/plugins/org.eclipse.dd.dsf/src/org/eclipse/dd/dsf/concurrent/DsfSequence.java index 47c752d0af7..3de19cd88ae 100644 --- a/plugins/org.eclipse.dd.dsf/src/org/eclipse/dd/dsf/concurrent/DsfSequence.java +++ b/plugins/org.eclipse.dd.dsf/src/org/eclipse/dd/dsf/concurrent/DsfSequence.java @@ -38,18 +38,11 @@ import org.eclipse.dd.dsf.DsfPlugin; * if progress reporting, cancellability, and roll-back ability is required, it * has to be re-implemented every time. The Sequence class tries to address * this problem by containing this pattern in a single class. - * - *
TODO: should a sequence be re-entrant. I.e. should the arguments be - * passed in through a map, and the return values returned back in the done? - *
FIXME: convert to implement Future interface */ abstract public class DsfSequence { /** * The abstract class that each step has to implement - *
FIXME: convert execute() and rollBacl() to take "done" as an argument. - * This way we can make step a static class, and make its paradigm - * more consistent with rest of DSF. */ abstract public class Step { public void execute() { stepFinished(); } @@ -165,9 +158,7 @@ abstract public class DsfSequence { invokeLater(); try { wait(); - } catch (InterruptedException e) { - // TODO: error handling? - } + } catch (InterruptedException e) {} } private void doInvoke() { diff --git a/plugins/org.eclipse.dd.dsf/src/org/eclipse/dd/dsf/concurrent/GetDataDoneWithClientDone.java b/plugins/org.eclipse.dd.dsf/src/org/eclipse/dd/dsf/concurrent/GetDataDoneWithClientDone.java index 0affa1ff7ae..a05877f1168 100644 --- a/plugins/org.eclipse.dd.dsf/src/org/eclipse/dd/dsf/concurrent/GetDataDoneWithClientDone.java +++ b/plugins/org.eclipse.dd.dsf/src/org/eclipse/dd/dsf/concurrent/GetDataDoneWithClientDone.java @@ -16,6 +16,9 @@ import org.eclipse.core.runtime.IStatus; * Convenience extension to GetDataDone, which handles posting of the client's * Done upon the completion of this GetDataDone. * @param Class type of data. + * @deprecated This class has been replaced with the + * {@link Done#propagateErrorToClient(DsfExecutor, Done, int, String)} + * method. */ public abstract class GetDataDoneWithClientDone extends GetDataDone { private DsfExecutor fExecutor; diff --git a/plugins/org.eclipse.dd.dsf/src/org/eclipse/dd/dsf/debug/IExpressions.java b/plugins/org.eclipse.dd.dsf/src/org/eclipse/dd/dsf/debug/IExpressions.java index 6d32378f8b9..74969e81202 100644 --- a/plugins/org.eclipse.dd.dsf/src/org/eclipse/dd/dsf/debug/IExpressions.java +++ b/plugins/org.eclipse.dd.dsf/src/org/eclipse/dd/dsf/debug/IExpressions.java @@ -53,7 +53,7 @@ public interface IExpressions extends IDataModelService { String getBinaryValue(); String getStringValue(); IAddress getAddress(); - IRegisters.RegisterDMC getRegister(); + IRegisters.IRegisterDMC getRegister(); Map getEnumerations(); } diff --git a/plugins/org.eclipse.dd.dsf/src/org/eclipse/dd/dsf/debug/IModules.java b/plugins/org.eclipse.dd.dsf/src/org/eclipse/dd/dsf/debug/IModules.java index 9d30a3e7f46..caa2cb80667 100644 --- a/plugins/org.eclipse.dd.dsf/src/org/eclipse/dd/dsf/debug/IModules.java +++ b/plugins/org.eclipse.dd.dsf/src/org/eclipse/dd/dsf/debug/IModules.java @@ -21,11 +21,6 @@ import org.eclipse.dd.dsf.model.IDataModelService; /** * Debugger service representing module handling logic of a debugger. - *
- * TODO: I meant this as a replacement for Application service as well as the - * registry API in DSF 1. But I still don't fully understand the format - * of the symbol data that is stored in the registry, so that needs to be added - * to this interface. */ public interface IModules extends IDataModelService { diff --git a/plugins/org.eclipse.dd.dsf/src/org/eclipse/dd/dsf/debug/IOS.java b/plugins/org.eclipse.dd.dsf/src/org/eclipse/dd/dsf/debug/IOS.java index 2e3af9bd707..4862e922375 100644 --- a/plugins/org.eclipse.dd.dsf/src/org/eclipse/dd/dsf/debug/IOS.java +++ b/plugins/org.eclipse.dd.dsf/src/org/eclipse/dd/dsf/debug/IOS.java @@ -21,9 +21,7 @@ import org.eclipse.dd.dsf.model.IDataModelService; * manipulate those objects. This is a much more extensive interface than * the NativeProcesses service but for simple debugging, it serves the same * purpose: to list/create/terminate processes and attach debugger to them. - *

- * TODO: need methods for performing actions on objects (create, terminate, - * etc). + * * @see INativeProcesses */ public interface IOS extends IDataModelService { diff --git a/plugins/org.eclipse.dd.dsf/src/org/eclipse/dd/dsf/debug/IRegisters.java b/plugins/org.eclipse.dd.dsf/src/org/eclipse/dd/dsf/debug/IRegisters.java index 586add23540..de9409a5260 100644 --- a/plugins/org.eclipse.dd.dsf/src/org/eclipse/dd/dsf/debug/IRegisters.java +++ b/plugins/org.eclipse.dd.dsf/src/org/eclipse/dd/dsf/debug/IRegisters.java @@ -22,24 +22,25 @@ import org.eclipse.dd.dsf.model.IDataModelService; public interface IRegisters extends IDataModelService { /** Register group context */ - public interface RegisterGroupDMC extends IDataModelContext {} + public interface IRegisterGroupDMC extends IDataModelContext {} /** * Register groups only have a name. Sub groups and registered are retrieved * through the service interface. */ - public interface RegisterGroupData extends IDataModelData { + public interface IRegisterGroupData extends IDataModelData { public String getName(); + public String getDescription(); } /** Register context */ - public interface RegisterDMC extends IDataModelContext {} + public interface IRegisterDMC extends IDataModelContext {} /** Event indicating register value changed. */ - public interface RegisterChangedEvent extends IDataModelEvent {} + public interface IRegisterChangedEvent extends IDataModelEvent {} /** Register information */ - public interface RegisterData extends IDataModelData, NumericalValue { + public interface IRegisterData extends IDataModelData, INumericalValue { String getName(); String getDescription(); boolean isReadable(); @@ -52,13 +53,13 @@ public interface IRegisters extends IDataModelService { } /** Bit field context */ - public interface BitFieldDMC extends IDataModelContext {} + public interface IBitFieldDMC extends IDataModelContext {} /** * Bitfield data, big groups and mnemonics are retrieved at the same * time as rest of bit field data */ - public interface BitFieldData extends IDataModelData, NumericalValue { + public interface IBitFieldData extends IDataModelData, INumericalValue { String getName(); String getDescription(); boolean isReadable(); @@ -68,18 +69,18 @@ public interface IRegisters extends IDataModelService { boolean hasSideEffects(); boolean isZeroBasedNumbering(); boolean isZeroBitLeftMost(); - BitGroup[] getBitGroup(); - Mnemonic[] getMnemonics(); + IBitGroup[] getBitGroup(); + IMnemonic[] getMnemonics(); } /** Bit group definition */ - public interface BitGroup { + public interface IBitGroup { int startBit(); int bitCount(); } /** Bit field mnemonic */ - public interface Mnemonic extends NumericalValue { + public interface IMnemonic extends INumericalValue { String getShortName(); String getLongName(); } @@ -88,7 +89,7 @@ public interface IRegisters extends IDataModelService { * Common interface for describing a number value for various register * data objects */ - public interface NumericalValue { + public interface INumericalValue { String getNaturalValue(); String getHexValue(); String getOctalValue(); @@ -101,14 +102,14 @@ public interface IRegisters extends IDataModelService { * @param frameCtx Stack frame DMC, this is optional and may be null. * @param done Return token. */ - void getRegisterGroups(IRunControl.IExecutionDMC execCtx, IStack.IFrameDMC frameCtx, GetDataDone done); + void getRegisterGroups(IRunControl.IExecutionDMC execCtx, IStack.IFrameDMC frameCtx, GetDataDone done); /** Retrieves list of sub-groups of given register group. */ - void getRegisterSubGroups(RegisterGroupDMC groupCtx, GetDataDone done); + void getRegisterSubGroups(IRegisterGroupDMC groupCtx, GetDataDone done); /** Retrieves registers in given register group. */ - void getRegisters(RegisterGroupDMC groupCtx, GetDataDone done); + void getRegisters(IRegisterGroupDMC groupCtx, GetDataDone done); /** Retrieves bit fields for given register */ - void getBitFields(RegisterDMC regCtx, GetDataDone done); + void getBitFields(IRegisterDMC regCtx, GetDataDone done); } diff --git a/plugins/org.eclipse.dd.dsf/src/org/eclipse/dd/dsf/debug/IStack.java b/plugins/org.eclipse.dd.dsf/src/org/eclipse/dd/dsf/debug/IStack.java index b2598629896..13936f96425 100644 --- a/plugins/org.eclipse.dd.dsf/src/org/eclipse/dd/dsf/debug/IStack.java +++ b/plugins/org.eclipse.dd.dsf/src/org/eclipse/dd/dsf/debug/IStack.java @@ -58,10 +58,6 @@ public interface IStack extends IDataModelService { /** * Returns whether the stack frames can be retrieved for given thread. - *
- * TODO: I'm not sure if this method should be async. It assumes that the - * implementation can determine if stack is available based on process - * state information. */ boolean isStackAvailable(IRunControl.IExecutionDMC execContext); diff --git a/plugins/org.eclipse.dd.dsf/src/org/eclipse/dd/dsf/debug/ISymbols.java b/plugins/org.eclipse.dd.dsf/src/org/eclipse/dd/dsf/debug/ISymbols.java index 95c82ca6e06..be5d03437a4 100644 --- a/plugins/org.eclipse.dd.dsf/src/org/eclipse/dd/dsf/debug/ISymbols.java +++ b/plugins/org.eclipse.dd.dsf/src/org/eclipse/dd/dsf/debug/ISymbols.java @@ -23,12 +23,12 @@ import org.eclipse.dd.dsf.model.IDataModelService; * @see IModules */ public interface ISymbols extends IDataModelService { - public interface SymbolObjectDMC extends IDataModelContext {} + public interface ISymbolObjectDMC extends IDataModelContext {} /** * Data about a debug symbol. */ - public interface SymbolObjectData extends IDataModelData { + public interface ISymbolObjectData extends IDataModelData { String getName(); String getTypeName(); String getFilepath(); @@ -41,10 +41,8 @@ public interface ISymbols extends IDataModelService { * even while it's still parsing. This event may be issued periodically * by the service to indicate that a section of debug symbols has been * parsed. - * TODO: This is not an IModelEvent because the context of this event is - * the whole service. This needs to be fixed. */ - public interface SymbolDataChanged extends IDataModelEvent {} + public interface ISymbolDataChanged extends IDataModelEvent {} /** * Retrieves the list of symbols. @@ -52,5 +50,5 @@ public interface ISymbols extends IDataModelService { * @param done Return token. The return value is an iterator (rather than * array) since there could be a very large number of symbols returned. */ - public void getSymbols(IModules.ISymbolDMC symCtx, GetDataDone> done); + public void getSymbols(IModules.ISymbolDMC symCtx, GetDataDone> done); } diff --git a/plugins/org.eclipse.dd.dsf/src/org/eclipse/dd/dsf/model/DataModelEvent.java b/plugins/org.eclipse.dd.dsf/src/org/eclipse/dd/dsf/model/DataModelEvent.java index 7a41740ea07..681b62defae 100644 --- a/plugins/org.eclipse.dd.dsf/src/org/eclipse/dd/dsf/model/DataModelEvent.java +++ b/plugins/org.eclipse.dd.dsf/src/org/eclipse/dd/dsf/model/DataModelEvent.java @@ -12,8 +12,6 @@ package org.eclipse.dd.dsf.model; /** * Base implementation of the IDataModelContext interface. - *

- * TODO: consider merging the event interface with this class. */ public class DataModelEvent implements IDataModelEvent { diff --git a/plugins/org.eclipse.dd.dsf/src/org/eclipse/dd/dsf/service/AbstractDsfService.java b/plugins/org.eclipse.dd.dsf/src/org/eclipse/dd/dsf/service/AbstractDsfService.java index 98c674b9f39..90bdc508b5a 100644 --- a/plugins/org.eclipse.dd.dsf/src/org/eclipse/dd/dsf/service/AbstractDsfService.java +++ b/plugins/org.eclipse.dd.dsf/src/org/eclipse/dd/dsf/service/AbstractDsfService.java @@ -87,8 +87,6 @@ abstract public class AbstractDsfService /** * Registers this service. - *
FIXME: Move registering call to default initialize()/shutdown(). Add a new - * protected method calcProperties() to get the initial list of properties. */ @SuppressWarnings("unchecked") protected void register(String[] classes, Dictionary properties) { diff --git a/plugins/org.eclipse.dd.dsf/src/org/eclipse/dd/dsf/service/DsfServiceEventHandler.java b/plugins/org.eclipse.dd.dsf/src/org/eclipse/dd/dsf/service/DsfServiceEventHandler.java index d82886fae2f..c66f71c29c5 100644 --- a/plugins/org.eclipse.dd.dsf/src/org/eclipse/dd/dsf/service/DsfServiceEventHandler.java +++ b/plugins/org.eclipse.dd.dsf/src/org/eclipse/dd/dsf/service/DsfServiceEventHandler.java @@ -34,8 +34,6 @@ import java.lang.annotation.Target; * will be called every time one of the sub-class events is invoked. * If a listener declares a handler for an event AND a superclass of that event, * both handlers will be invoked when the event is dispatched. - * - *
TODO: Handling of second argument is not yet implemented. */ @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.METHOD) diff --git a/plugins/org.eclipse.dd.dsf/src/org/eclipse/dd/dsf/service/DsfSession.java b/plugins/org.eclipse.dd.dsf/src/org/eclipse/dd/dsf/service/DsfSession.java index 019cb5b8b2e..7f5b867504d 100644 --- a/plugins/org.eclipse.dd.dsf/src/org/eclipse/dd/dsf/service/DsfSession.java +++ b/plugins/org.eclipse.dd.dsf/src/org/eclipse/dd/dsf/service/DsfSession.java @@ -136,11 +136,12 @@ public class DsfSession * thread, but the session-started listeners will be called using the session's * executor. * @param executor The DSF executor to use for this session. + * @param ownerId ID (plugin ID preferably) of the owner of this session * @return instance object of the new session */ - public static DsfSession startSession(DsfExecutor executor) { + public static DsfSession startSession(DsfExecutor executor, String ownerId) { synchronized(fgActiveSessions) { - final DsfSession newSession = new DsfSession(executor, Integer.toString(fgSessionIdCounter++)); + final DsfSession newSession = new DsfSession(executor, ownerId, Integer.toString(fgSessionIdCounter++)); fgActiveSessions.add(newSession); executor.submit( new DsfRunnable() { public void run() { SessionStartedListener[] listeners = fSessionStartedListeners.toArray( @@ -191,6 +192,9 @@ public class DsfSession public int hashCode() { return fListener.hashCode(); } } + /** ID (plugin ID preferably) of the owner of this session */ + private String fOwnerId; + /** Session ID of this session. */ private String fId; @@ -210,6 +214,8 @@ public class DsfSession */ private Map fAdapters = Collections.synchronizedMap(new HashMap()); + /** Returns the owner ID of this session */ + public String getOwnerId() { return fOwnerId; } /** Returns the ID of this session */ public String getId() { return fId; } @@ -256,10 +262,7 @@ public class DsfSession */ public void dispatchEvent(final Object event, final Dictionary serviceProperties) { getExecutor().submit(new DsfRunnable() { public void run() { - // TED added FIXME otherwise no way to detect!!! - try { doDispatchEvent(event, serviceProperties); - } catch(Throwable e) { e.printStackTrace(); } }}); } @@ -387,8 +390,9 @@ public class DsfSession /** * Class to be instanciated only using startSession() */ - private DsfSession(DsfExecutor executor, String id) { + private DsfSession(DsfExecutor executor, String ownerId, String id) { fId = id; + fOwnerId = ownerId; fExecutor = executor; } diff --git a/plugins/org.eclipse.dd.dsf/src/org/eclipse/dd/dsf/service/IDsfService.java b/plugins/org.eclipse.dd.dsf/src/org/eclipse/dd/dsf/service/IDsfService.java index b834d757dba..b7f06f75db7 100644 --- a/plugins/org.eclipse.dd.dsf/src/org/eclipse/dd/dsf/service/IDsfService.java +++ b/plugins/org.eclipse.dd.dsf/src/org/eclipse/dd/dsf/service/IDsfService.java @@ -32,8 +32,6 @@ import org.eclipse.dd.dsf.concurrent.DsfExecutor; * service exposes a method that is to be called on non-dispatch thread, it should * be documented so. * - * TODO: Add IStatus error code constants for common service related failures. - * * @see org.osgi.framework.BundleContext#registerService(String[], Object, Dictionary) */ public interface IDsfService { @@ -52,10 +50,6 @@ public interface IDsfService { /** * Returns the map of properties that this service was registered with. - *
- * TODO: is returning the properties and service filter redundant? Should - * getServiceFilter() be removed from the interface since it can be generated - * from the properties? */ Dictionary getProperties();