diff --git a/plugins/org.eclipse.dd.dsf/src/org/eclipse/dd/dsf/debug/IAddress.java b/plugins/org.eclipse.dd.dsf/src/org/eclipse/dd/dsf/debug/IAddress.java new file mode 100644 index 00000000000..4175ec51a21 --- /dev/null +++ b/plugins/org.eclipse.dd.dsf/src/org/eclipse/dd/dsf/debug/IAddress.java @@ -0,0 +1,9 @@ +package org.eclipse.dd.dsf.debug; + +/** + * I was told that BigInteger was not sufficient to represent an address, so + * I created this interface as a place holder for representing an address. + */ +public interface IAddress { + +} diff --git a/plugins/org.eclipse.dd.dsf/src/org/eclipse/dd/dsf/debug/IBackEndProcess.java b/plugins/org.eclipse.dd.dsf/src/org/eclipse/dd/dsf/debug/IBackEndProcess.java new file mode 100644 index 00000000000..49fcf560b4e --- /dev/null +++ b/plugins/org.eclipse.dd.dsf/src/org/eclipse/dd/dsf/debug/IBackEndProcess.java @@ -0,0 +1,37 @@ +package org.eclipse.dd.dsf.debug; + +import org.eclipse.dd.dsf.service.IDsfService; + + +/** + * Service representing an external process that is part of the debugger back + * end implementation. Having this service allows UI and other clients + * access to the java.lang.Process object for monitoring. E.g. for displaying + * in Debug view and channeling I/O to the console view. + */ +public interface IBackEndProcess extends IDsfService { + /** + * Optional property identifying the process among other services. + * Since there could be multiple instances of this service running at the + * same time, a service property is needed to allow clients to distinguish + * between them. + */ + static final String PROCESS_ID = "org.eclipse.dsdp.riverbed.debug.BackendProcess.PROCESS_ID"; + + /** + * Event indicating that the back end process has terminated. + */ + public interface ExitedEvent {} + + /** + * Returns the instance of the java process object representing the back + * end process. + * @return + */ + Process getProcess(); + + /** + * Returns true if back-end process has exited. + */ + boolean isExited(); +} diff --git a/plugins/org.eclipse.dd.dsf/src/org/eclipse/dd/dsf/debug/IBreakpoints.java b/plugins/org.eclipse.dd.dsf/src/org/eclipse/dd/dsf/debug/IBreakpoints.java new file mode 100644 index 00000000000..01ee465b7ab --- /dev/null +++ b/plugins/org.eclipse.dd.dsf/src/org/eclipse/dd/dsf/debug/IBreakpoints.java @@ -0,0 +1,65 @@ +package org.eclipse.dd.dsf.debug; + +import org.eclipse.dd.dsf.concurrent.GetDataDone; +import org.eclipse.dd.dsf.model.IDataModelContext; +import org.eclipse.dd.dsf.model.IDataModelData; +import org.eclipse.dd.dsf.model.IDataModelEvent; +import org.eclipse.dd.dsf.model.IDataModelService; +import org.eclipse.debug.core.model.IBreakpoint; + +/** + * Breakpoint service provides access to information about breakpoints that + * are planted on a target. It's the reposnsibility of the debugger + * implementation to retrieve static breakpoint data from platform APIs and to + * install them on the target. + */ +public interface IBreakpoints extends IDataModelService { + /** + * Data Model Context for a breakpoint objects. Breakpoints service only + * with respect to running processes/threads, therefore the breakpoint + * context will always have an IExecutionDMC as one of its ancestors. + */ + public interface IBreakpointDMC extends IDataModelContext {} + + /** Indicates that the state of given breakpoint has changed. */ + public interface BreakpointChangedEvent extends IDataModelEvent {} + + /** Indicates that given breakpoint was hit, by the given execution context. */ + public interface BreakpointHitEvent extends BreakpointChangedEvent { + IRunControl.IExecutionDMC getExecutionDMC(); + } + + /** Common breakpoint state data. */ + public interface BreakpointData extends IDataModelData { + /** Installed status values of a breakpoint. */ + public enum Status { FILTERED_OUT, INSTALLED, FAILED_TO_INSTALL, PENDING_INSTALL, PENDING_UNINSTALL } + + /** Returns the corresponding platform debug model breakpoint object. */ + IBreakpoint getBreakpoint(); + + /** Returns current installed status of this breakpoint */ + Status getStatus(); + + /** + * Returns error message (if any) with respect to current status of + * the breakpoint. + */ + String getErrorMessage(); + + /** + * Returns a warning message (if any) with respect to current status of + * the breakpoint. + */ + String getWarningMessage(); + } + + /** + * Retrieves all breakpoints for given execution context. + */ + void getBreakpoints(IRunControl.IExecutionDMC execCtx, GetDataDone done); + + /** + * Retrieves all breakpoints for given platform breakpoint object. + */ + void getBreakpoints(IBreakpoint bp, GetDataDone done); +} 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 new file mode 100644 index 00000000000..228912b498c --- /dev/null +++ b/plugins/org.eclipse.dd.dsf/src/org/eclipse/dd/dsf/debug/IExpressions.java @@ -0,0 +1,82 @@ +package org.eclipse.dd.dsf.debug; + +import java.util.Map; + +import org.eclipse.dd.dsf.concurrent.GetDataDone; +import org.eclipse.dd.dsf.model.IDataModelContext; +import org.eclipse.dd.dsf.model.IDataModelData; +import org.eclipse.dd.dsf.model.IDataModelEvent; +import org.eclipse.dd.dsf.model.IDataModelService; + +/** + * Expressions service provides access to the debugger's expression evaluator. + * This service has dependencies on the Modules service, RunControl service, and + * Stack service, as all may be used to provide context for an expression to be + * evaluated. + */ +public interface IExpressions extends IDataModelService { + + /** + * Expression context. Since some expressions have children, expression + * contexts can be have an arbitrary number of parents of type + * ExpressionContext. + */ + public interface IExpressionDMC extends IDataModelContext { + String getExpression(); + } + + /** + * Expression data. It is based pretty closely on what DFW's info-retrieve + * node for expressions. + */ + public interface IExpressionData extends IDataModelData { + String getName(); + public enum BasicType { basic, pointer, array, composite, enumeration, function } + BasicType getBasicType(); + String getTypeName(); + String getEncoding(); + String getTypeId(); + int getBitCount(); + String getNaturalValue(); + String getHexValue(); + String getOctalValue(); + String getBinaryValue(); + String getStringValue(); + IAddress getAddress(); + IRegisters.RegisterDMC getRegister(); + Map getEnumerations(); + } + + /** + * Event indicating that a given expression is changed. If an expression + * is changed, it's implied that all the children of that expression are + * changed too. + */ + public interface IExpressionChangedEvent extends IDataModelEvent {} + + /** + * Returns the context for the specified expression. + * @param symCtx Symbol context in which to evaluate the expression. This parameter is required and cannot be null. + * @param execCtx Optional execution context for the evaluation. Can be null. + * @param frameCtx Optional stack frame context for the evaluation. Can be null. + * @param expression Expression to evaluate. + * @return Expression context. + */ + IExpressionDMC getExpressionContext(IModules.ISymbolDMC symCtx, IRunControl.IExecutionDMC execCtx, IStack.IFrameDMC frameCtx, String expression); + + /** + * Retrieves the sub-expressions of the given expression. + * @param exprCtx Expression context to evaluate. + * @param done The return parameter is an Iterable because it's possible + * that the sub-expressions as members of an array which could be very large. + */ + void getSubExpressions(IExpressionDMC exprCtx, GetDataDone> done); + + /** + * For object oriented languages, this method returns the expressions + * representing base types of the given expression type. + * @param exprContext + * @param done + */ + void getBaseExpressions(IExpressionDMC exprContext, GetDataDone done); +} diff --git a/plugins/org.eclipse.dd.dsf/src/org/eclipse/dd/dsf/debug/IMemory.java b/plugins/org.eclipse.dd.dsf/src/org/eclipse/dd/dsf/debug/IMemory.java new file mode 100644 index 00000000000..eff0c6f1b14 --- /dev/null +++ b/plugins/org.eclipse.dd.dsf/src/org/eclipse/dd/dsf/debug/IMemory.java @@ -0,0 +1,45 @@ +package org.eclipse.dd.dsf.debug; + +import org.eclipse.dd.dsf.concurrent.Done; +import org.eclipse.dd.dsf.service.IDsfService; + +/** + * Service for accessing memory. Memory contexts are not meant to be + * represented in tree or table views, so it doesn't need to implement + * IDataModelService interface. + */ +public interface IMemory extends IDsfService { + + /** + * A context for memory is still needed, for debuggers that can debug + * multiple processes/targets at the same time. + */ + public interface IMemoryContext {} + + /** + * I was told that BigInteger is also too restrictive to represent an + * address, but I'm not really sure what is appropriate for this interface. + */ + public interface IAddress { + /** Returns the memory context that this address belongs to. */ + public IMemoryContext getContext(); + } + + /** Writes the given value to the given memory location. */ + public void setMemory(IMemoryContext memCtx, IAddress addr, + int word_size, byte[] buf, int offs, int size, int mode, Done done); + + /** Reads memory at the given location */ + public void getMemory(IMemoryContext memCtx, IAddress addr, + int word_size, byte[] buf, int offs, int size, int mode, Done done); + + /** + * Fill target memory with given pattern. + * 'size' is number of bytes to fill. + * Parameter 0 of sequent 'done' is assigned with Throwable if + * there was an error. + */ + public void fillMemory(IMemoryContext memCtx, IAddress addr, + int word_size, byte[] value, int size, int mode, Done done); + +} 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 new file mode 100644 index 00000000000..737ff7a54eb --- /dev/null +++ b/plugins/org.eclipse.dd.dsf/src/org/eclipse/dd/dsf/debug/IModules.java @@ -0,0 +1,141 @@ +package org.eclipse.dd.dsf.debug; + +import java.math.BigInteger; + +import org.eclipse.dd.dsf.concurrent.GetDataDone; +import org.eclipse.dd.dsf.model.IDataModelContext; +import org.eclipse.dd.dsf.model.IDataModelData; +import org.eclipse.dd.dsf.model.IDataModelEvent; +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 Riverbed 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 { + + /** + * Symbol context represents the space into which module symbols are loaded. + * Traditionally symbols are loaded in context of a process, but for other + * types of debugging, like kernel or no-OS debugging, it's useful to + * separate the concept of a symbol context from a process. + */ + public interface ISymbolDMC extends IDataModelContext {} + + /** + * Module context represents a single module that is loaded. + */ + public interface IModuleDMC extends IDataModelContext {} + + /** + * Event indicating a change in the symbol information for given context. + */ + public interface ModulesChangedEvent extends IDataModelEvent {} + + /** + * Specific event identifying that a new module was loaded into a + * symbol context. + */ + public interface ModuleLoadedEvent extends ModulesChangedEvent { + /** Returns context of the module that was loaded */ + IModuleDMC getLoadedModuleContext(); + } + + public interface ModuleUnloadedEvent extends ModulesChangedEvent { + /** Returns context of the module that was un-loaded */ + IModuleDMC getUnloadedModuleContext(); + } + + /** + * Object representing a unuqie location in a symbol context, based on + * a module, section, and address offset within the seciton. + */ + public final class ModuleSectionOffset { + private final IModuleDMC fModule; + private final Section fSection; + private final BigInteger fOffset; + + public IModuleDMC getModule() { return fModule; } + public Section getSection() { return fSection; } + public BigInteger getOffset() { return fOffset; } + + public ModuleSectionOffset(IModuleDMC module, Section section, BigInteger offset) { + this.fModule = module; + this.fSection = section; + this.fOffset = offset; + } + + public int hashCode() { + return fModule.hashCode() + fSection.hashCode() + fOffset.intValue(); + } + + public boolean equals(Object o) { + if (!(o instanceof ModuleSectionOffset)) return false; + ModuleSectionOffset mso = (ModuleSectionOffset)o; + return fModule.equals(mso.fModule) && fSection.equals(mso.fSection) && fOffset.equals(mso.fOffset); + } + } + + /** + * Symbol context data includes a mapping between run-time addresses and + * module-section-offset coordinates. + */ + public interface SymbolData extends IDataModelData { + /** Convert link-time address 'addr' to run-time address */ + public long convertToRT(ModuleSectionOffset mso); + + /** Convert run-time address 'addr' to link-time address */ + public ModuleSectionOffset convertFromRT(IAddress addr); + } + + /** Module information. */ + public interface ModuleData extends IDataModelData { + String getName(); + String getFile(); + long getTimeStamp(); + Section[] getSections(); + } + + /** Section information */ + public interface Section { + String getName(); + IAddress getStartAddress(); + BigInteger getCount(); + } + + /** Line information about a particular address */ + public interface LineInfo { + IAddress getAddress(); + String getSourceFile(); + int getStartLine(); + int getStartColumn(); + int getEndLine(); + int getEndColumn(); + } + + /** Address information about a particular file/line */ + public interface AddressRange { + IAddress getStartAddress(); + IAddress getEndAddress(); + } + + /** + * Retreives the list of modules loaded in given symbol context. + */ + void getModules(ISymbolDMC symCtx, GetDataDone done); + + /** + * Calculates the line numbers corresponding to the given address. + */ + void calcLineInfo(ISymbolDMC symCtx, IAddress address, GetDataDone done); + + /** + * Calculates the addresses corresponding to the given source file location. + */ + void calcAddressInfo(ISymbolDMC symCtx, String file, int line, int col, GetDataDone done); + +} diff --git a/plugins/org.eclipse.dd.dsf/src/org/eclipse/dd/dsf/debug/INativeProcesses.java b/plugins/org.eclipse.dd.dsf/src/org/eclipse/dd/dsf/debug/INativeProcesses.java new file mode 100644 index 00000000000..54081096a7b --- /dev/null +++ b/plugins/org.eclipse.dd.dsf/src/org/eclipse/dd/dsf/debug/INativeProcesses.java @@ -0,0 +1,71 @@ +package org.eclipse.dd.dsf.debug; + +import org.eclipse.dd.dsf.concurrent.Done; +import org.eclipse.dd.dsf.concurrent.GetDataDone; +import org.eclipse.dd.dsf.model.IDataModelContext; +import org.eclipse.dd.dsf.model.IDataModelData; +import org.eclipse.dd.dsf.model.IDataModelEvent; +import org.eclipse.dd.dsf.model.IDataModelService; + +/** + * This interface provides access to the native OS's process + * information, manipulation methods, and debugging methods. + * This service provides a relatively simple interface for + * manipulating processes as compared with a full-blown + * remote target debugger. + */ +public interface INativeProcesses extends IDataModelService { + + public interface IThreadDMC extends IDataModelContext {} + public interface IProcessDMC extends IThreadDMC {} + + /** + * Interface for thread and process object data. This data provides a link + * to the lower level debugger services, in form of symbol, memory, and + * execution contexts. + */ + public interface IThreadData extends IDataModelData { + String getName(); + String getId(); + boolean isDebuggerAttached(); + IRunControl.IExecutionDMC getExecutionContext(); + IMemory.IMemoryContext getMemoryContext(); + IModules.ISymbolDMC getSymbolContext(); + } + + /** + * Event indicating that process data has changed. + */ + public interface ProcessChangedEvent extends IDataModelEvent {} + + /** + * Retrieves the current list of processes running on target. + */ + void getRunningProcesses(GetDataDone done); + + /** + * Attaches debugger to the given process. + */ + void attachDebuggerToProcess(IProcessDMC procCtx, Done done); + + /** + * Starts a new process. + * @param file Process image to use for the new process. + * @param done Return token with the process context. + */ + void runNewProcess(String file, GetDataDone done); + + /** + * Starts a new process with debugger attached. + * @param file Process image to use for the new process. + * @param done Return token with the process context. + */ + void debugNewProcess(String file, GetDataDone done); + + /** + * Returns a thread context for given run control execution context. + * @param execCtx Execution context to return thread for. + * @return Corresponding thread context. + */ + IThreadDMC getThreadForExecutionContext(IRunControl.IExecutionDMC execCtx); +} 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 new file mode 100644 index 00000000000..21c153ab2d7 --- /dev/null +++ b/plugins/org.eclipse.dd.dsf/src/org/eclipse/dd/dsf/debug/IOS.java @@ -0,0 +1,93 @@ +package org.eclipse.dd.dsf.debug; + +import org.eclipse.dd.dsf.concurrent.Done; +import org.eclipse.dd.dsf.concurrent.GetDataDone; +import org.eclipse.dd.dsf.model.IDataModelContext; +import org.eclipse.dd.dsf.model.IDataModelData; +import org.eclipse.dd.dsf.model.IDataModelService; + +/** + * Provides generic access to operating system objects and methods to + * 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 { + + /** + * Context object for the whole OS, for debuggers that support + * debugging multiple targets/cores simultaneously. + */ + public interface IOSDMC extends IDataModelContext {} + + /** + * Data object describing OS info + */ + public interface IOSData extends IDataModelData { + String getName(); + String getDescription(); + String getVersion(); + } + + /** + * Context for a OS object type, such as process, kernel task, semaphore, etc. + */ + public interface IObjectTypeDMC extends IDataModelContext {} + + /** + * Description data for a OS object type. + */ + public interface IObjectTypeData extends IDataModelData { + String getName(); + String getDescription(); + String getSingularName(); + String getPluralName(); + boolean hasExecutionContext(); + boolean hasModulesContext(); + boolean hasMemoryContext(); + } + + /** + * OS object context. + */ + public interface IObjectDMC extends IDataModelContext {} + + /** + * Description data for an OS object. + */ + public interface IObjectData extends IDataModelData { + String getName(); + String getID(); + boolean canAttachDebugger(); + boolean isDebuggerAttached(); + IRunControl.IExecutionDMC getExecutionDMC(); + IModules.ISymbolDMC getSymbolDMC(); + IMemory.IMemoryContext getMemoryContext(); + } + + /** + * Retrieves list of OS object types. + * @param os OS context. + * @param parent Optional parent type. + * @param done Return token. + */ + public void getObjectTypes(IOSDMC os, IObjectTypeDMC parent, GetDataDone done); + + /** + * Retrieves list of OS objects for given type. + * @param os OS context. + * @param type The object type. + * @param parent Optional parent of the requested objects. + * @param done Return token. + */ + public void getObjects(IOSDMC os, IObjectTypeDMC type, IObjectDMC parent, GetDataDone done); + + /** + * Attaches the debugger to given OS object context. + */ + public void attachDebuggerToObject(IObjectDMC objectDmc, Done done); +} 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 new file mode 100644 index 00000000000..ab41ad41ecc --- /dev/null +++ b/plugins/org.eclipse.dd.dsf/src/org/eclipse/dd/dsf/debug/IRegisters.java @@ -0,0 +1,104 @@ +package org.eclipse.dd.dsf.debug; + +import org.eclipse.dd.dsf.concurrent.GetDataDone; +import org.eclipse.dd.dsf.model.IDataModelContext; +import org.eclipse.dd.dsf.model.IDataModelData; +import org.eclipse.dd.dsf.model.IDataModelEvent; +import org.eclipse.dd.dsf.model.IDataModelService; + +/** + * Service for accessing register data. + */ +public interface IRegisters extends IDataModelService { + + /** Register group context */ + public interface RegisterGroupDMC extends IDataModelContext {} + + /** + * Register groups only have a name. Sub groups and registered are retrieved + * through the service interface. + */ + public interface RegisterGroupData extends IDataModelData { + public String getName(); + } + + /** Register context */ + public interface RegisterDMC extends IDataModelContext {} + + /** Event indicating register value changed. */ + public interface RegisterChangedEvent extends IDataModelEvent {} + + /** Register information */ + public interface RegisterData extends IDataModelData, NumericalValue { + String getName(); + String getDescription(); + boolean isReadable(); + boolean isReadOnce(); + boolean isWriteable(); + boolean isWriteOnce(); + boolean hasSideEffects(); + boolean isVolatile(); + boolean isFloat(); + } + + /** Bit field context */ + public interface BitFieldDMC 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 { + String getName(); + String getDescription(); + boolean isReadable(); + boolean isReadOnce(); + boolean isWriteable(); + boolean isWriteOnce(); + boolean hasSideEffects(); + boolean isZeroBasedNumbering(); + boolean isZeroBitLeftMost(); + BitGroup[] getBitGroup(); + Mnemonic[] getMnemonics(); + } + + /** Bit group definition */ + public interface BitGroup { + int startBit(); + int bitCount(); + } + + /** Bit field mnemonic */ + public interface Mnemonic extends NumericalValue { + String getShortName(); + String getLongName(); + } + + /** + * Common interface for describing a number value for various register + * data objects + */ + public interface NumericalValue { + String getNaturalValue(); + String getHexValue(); + String getOctalValue(); + String getBinaryValue(); + } + + /** + * Retrieves the list of register groups. + * @param execCtx Execution DMC, this is required. + * @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); + + /** Retrieves list of sub-groups of given register group. */ + void getRegisterSubGroups(RegisterGroupDMC groupCtx, GetDataDone done); + + /** Retrieves registers in given register group. */ + void getRegisters(RegisterGroupDMC groupCtx, GetDataDone done); + + /** Retrieves bit fields for given register */ + void getBitFields(RegisterDMC regCtx, GetDataDone done); +} diff --git a/plugins/org.eclipse.dd.dsf/src/org/eclipse/dd/dsf/debug/IRunControl.java b/plugins/org.eclipse.dd.dsf/src/org/eclipse/dd/dsf/debug/IRunControl.java new file mode 100644 index 00000000000..e68ed472007 --- /dev/null +++ b/plugins/org.eclipse.dd.dsf/src/org/eclipse/dd/dsf/debug/IRunControl.java @@ -0,0 +1,87 @@ +package org.eclipse.dd.dsf.debug; + +import org.eclipse.dd.dsf.concurrent.Done; +import org.eclipse.dd.dsf.concurrent.GetDataDone; +import org.eclipse.dd.dsf.model.IDataModelContext; +import org.eclipse.dd.dsf.model.IDataModelData; +import org.eclipse.dd.dsf.model.IDataModelEvent; +import org.eclipse.dd.dsf.model.IDataModelService; + +/** + * This interface provides access to controlling and monitoring the execution + * state of a process being debugged. This interface does not actually + * provide methods for creating or destroying execution contexts, it doesn't + * even have methods for getting labels. That's because it is expected that + * higher level services, ones that deal with processes, kernels, or target + * features will provide that functionality. + */ +public interface IRunControl extends IDataModelService +{ + + /** + * Execution context is the object on which run control operations can be + * performed. A lot of higher-level services reference this context to build + * functionality on top of it, e.g. stack, expression evaluation, registers, etc. + */ + public interface IExecutionDMC extends IDataModelContext {} + + /** + * Context representing a process, kernel, or some other logical container + * for execution cotnexts, which by itself can perform run-control + * operations. + */ + public interface IContainerDMC extends IExecutionDMC {} + + /** Flag indicating reason context state change. */ + public enum StateChangeReason { USER_REQUEST, STEP, BREAKPOINT, EXCEPTION, CONTAINER }; + + /** + * Events signaling a state changes. + */ + public interface SuspendedEvent extends IDataModelEvent { + StateChangeReason getReason(); + } + public interface ResumedEvent extends IDataModelEvent { + StateChangeReason getReason(); + } + public interface ContainerSuspendedEvent extends IDataModelEvent { + StateChangeReason getReason(); + } + public interface ContainerResumedEvent extends IDataModelEvent { + StateChangeReason getReason(); + } + public interface IStartedEvent extends IDataModelEvent { + IExecutionDMC getExecutionContext(); + } + public interface IExitedEvent extends IDataModelEvent { + IExecutionDMC getExecutionContext(); + } + + /** + * Display information for an execution context. + */ + public interface IExecutionData extends IDataModelData { + boolean isSuspended(); + StateChangeReason getStateChangeReason(); + } + + /** + * Returns execution contexts belonging to the given container context. + */ + public void getExecutionContexts(IContainerDMC c, GetDataDone done); + + /* + * Run control commands. They all require the IExecutionContext object on + * which they perform the operations. + */ + boolean canResume(IExecutionDMC context); + boolean canSuspend(IExecutionDMC context); + boolean isSuspended(IExecutionDMC context); + void resume(IExecutionDMC context, Done done); + void suspend(IExecutionDMC context, Done done); + public enum StepType { STEP_OVER, STEP_INTO, STEP_RETURN }; + boolean isStepping(IExecutionDMC context); + void canStep(IExecutionDMC context); + void step(IExecutionDMC context, StepType stepType, Done done); + void instructionStep(IExecutionDMC context, StepType stepType, Done done); +} diff --git a/plugins/org.eclipse.dd.dsf/src/org/eclipse/dd/dsf/debug/ISourceLookup.java b/plugins/org.eclipse.dd.dsf/src/org/eclipse/dd/dsf/debug/ISourceLookup.java new file mode 100644 index 00000000000..8e37f7b4767 --- /dev/null +++ b/plugins/org.eclipse.dd.dsf/src/org/eclipse/dd/dsf/debug/ISourceLookup.java @@ -0,0 +1,48 @@ +package org.eclipse.dd.dsf.debug; + +import org.eclipse.dd.dsf.concurrent.GetDataDone; +import org.eclipse.dd.dsf.service.IDsfService; +import org.eclipse.debug.core.sourcelookup.ISourceContainer; + +/** + * Service for mapping debugger paths to host paths. This service is needed + * primarily by other services that need to access source-path mappings, such + * as the breakpoints service. For UI components, the platform source lookup + * interfaces could be sufficient. + */ +public interface ISourceLookup extends IDsfService { + + /** + * Context needed for debuggers that debug multiple processes. + */ + public interface ISourceLookupContext {} + + public interface ISourceLookupResult { + Object getSourceObject(); + ISourceContainer getMatchingContainer(); + } + + public interface IDebuggerPathLookupResult { + String getDebuggerPath(); + ISourceContainer getMatchingContainer(); + } + + /** Returns the source lookup context for the given modules context. */ + ISourceLookupContext getContextForSymbolContext(IModules.ISymbolDMC symCtx); + + /** + * Initializes the given context with the given list of source lookup + * containers. + */ + void initializeSourceContainers(ISourceLookupContext ctx, ISourceContainer[] containers); + + /** + * Retrieves the host source object for given debugger path string. + */ + void getSource(ISourceLookupContext srcCtx, String debuggerPath, boolean searchDuplicates, GetDataDone done); + + /** + * Retrieves the debugger path string(s) for given host source object. + */ + void getDebuggerPath(ISourceLookupContext srcCtx, Object source, boolean searchDuplicates, 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 new file mode 100644 index 00000000000..34c0d56ecee --- /dev/null +++ b/plugins/org.eclipse.dd.dsf/src/org/eclipse/dd/dsf/debug/IStack.java @@ -0,0 +1,62 @@ +package org.eclipse.dd.dsf.debug; + +import org.eclipse.dd.dsf.concurrent.GetDataDone; +import org.eclipse.dd.dsf.model.IDataModelContext; +import org.eclipse.dd.dsf.model.IDataModelData; +import org.eclipse.dd.dsf.model.IDataModelService; + +/** + * Stack service provides access to stack information for a + * given execution context. + */ +public interface IStack extends IDataModelService { + + /** + * Context for a specific stack frame. Besides allowing access to stack + * frame data, this context is used by other services that require a stack + * frame for evaluation. + */ + public interface IFrameDMC extends IDataModelContext {} + + /** + * Stack frame information. + */ + public interface IFrameData extends IDataModelData { + IAddress getAddress(); + String getFile(); + int getLine(); + int getColumn(); + } + + /** + * Variable context. This context only provides access to limited + * expression information. For displaying complete information, + * Expressions service should be used. + */ + public interface IVariableDMC extends IDataModelContext {} + + /** + * Stack frame variable information. + */ + public interface VariableData extends IDataModelData { + String getName(); + String getTypeName(); + String getValue(); + } + + /** + * Retrieves list of stack frames for the given execution context. Request + * will fail if the stack frame data is not available. + */ + void getFrames(IRunControl.IExecutionDMC execContext, GetDataDone done); + + /** + * Retrieves variables which were arguments to the stack frame's function. + */ + void getArguments(IFrameDMC frameCtx, GetDataDone done); + + /** + * Retrieves variables local to the stack frame. + */ + void getLocals(IFrameDMC frameCtx, GetDataDone done); +} diff --git a/plugins/org.eclipse.dd.dsf/src/org/eclipse/dd/dsf/debug/IStepQueueManager.java b/plugins/org.eclipse.dd.dsf/src/org/eclipse/dd/dsf/debug/IStepQueueManager.java new file mode 100644 index 00000000000..5c5f04e4ddf --- /dev/null +++ b/plugins/org.eclipse.dd.dsf/src/org/eclipse/dd/dsf/debug/IStepQueueManager.java @@ -0,0 +1,43 @@ +package org.eclipse.dd.dsf.debug; + +import org.eclipse.dd.dsf.service.IDsfService; + +/** + * This service builds on top of standard run control service to provide + * step queuing functionality. Step queuing essentially allows user to press + * and hold the step key and achieve maximum stepping speed. If this service + * is used, other service implementations, such as stack and expressions, can + * use it to avoid requesting data from debugger back end if another step is + * about to be executed. + */ +public interface IStepQueueManager extends IDsfService { + + void setStepQueueDepth(int depth); + int getStepQueueDepth(); + + /** + * Returns the number of step commands that are queued for given execution + * context. + */ + int getPendingStepCount(IRunControl.IExecutionDMC execCtx); + + /** + * Checks whether a step command can be queued up for given context. + */ + void canEnqueueStep(IRunControl.IExecutionDMC execCtx); + + /** + * Adds a step command to the execution queue for given context. + * @param execCtx Execution context that should perform the step. + * @param stepType Type of step to execute. + */ + void enqueueStep(IRunControl.IExecutionDMC execCtx, IRunControl.StepType stepType); + + /** + * Adds an instruction step command to the execution queue for given + * context. + * @param execCtx Execution context that should perform the step. + * @param stepType Type of step to execute. + */ + void enqueueInstructionStep(IRunControl.IExecutionDMC execCtx, IRunControl.StepType stepType); +} 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 new file mode 100644 index 00000000000..c3863dd259a --- /dev/null +++ b/plugins/org.eclipse.dd.dsf/src/org/eclipse/dd/dsf/debug/ISymbols.java @@ -0,0 +1,46 @@ +package org.eclipse.dd.dsf.debug; + +import org.eclipse.dd.dsf.concurrent.GetDataDone; +import org.eclipse.dd.dsf.model.IDataModelContext; +import org.eclipse.dd.dsf.model.IDataModelData; +import org.eclipse.dd.dsf.model.IDataModelEvent; +import org.eclipse.dd.dsf.model.IDataModelService; + +/** + * Service for accessing debugger symbols. This service builds on the Modules + * service, but not all debuggers provide access for parsing symbols so this + * service is separated. + * @see IModules + */ +public interface ISymbols extends IDataModelService { + public interface SymbolObjectDMC extends IDataModelContext {} + + /** + * Data about a debug symbol. + */ + public interface SymbolObjectData extends IDataModelData { + String getName(); + String getTypeName(); + String getFilepath(); + } + + /** + * Indicates that the list of symbol objects is changed. Parsing debug + * symbols can be a long running operation (order of 10's of seconds or + * minues), so it is useful for the service to provide access to the data + * 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 {} + + /** + * Retrieves the list of symbols. + * @param symCtx Symbols context to retrieve symbols for. + * @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); +} diff --git a/plugins/org.eclipse.dd.dsf/src/org/eclipse/dd/dsf/debug/ITargets.java b/plugins/org.eclipse.dd.dsf/src/org/eclipse/dd/dsf/debug/ITargets.java new file mode 100644 index 00000000000..a90c2f68fbc --- /dev/null +++ b/plugins/org.eclipse.dd.dsf/src/org/eclipse/dd/dsf/debug/ITargets.java @@ -0,0 +1,42 @@ +package org.eclipse.dd.dsf.debug; + +import org.eclipse.dd.dsf.concurrent.Done; +import org.eclipse.dd.dsf.concurrent.GetDataDone; +import org.eclipse.dd.dsf.model.IDataModelContext; +import org.eclipse.dd.dsf.model.IDataModelData; +import org.eclipse.dd.dsf.model.IDataModelEvent; +import org.eclipse.dd.dsf.model.IDataModelService; + +/** + * This is just an initial take at the targets interface. + */ +public interface ITargets extends IDataModelService { + + public interface ITargetDMC extends IDataModelContext {} + + public interface ITargetData extends IDataModelData { + String getName(); + boolean isConnected(); + } + + public interface ITargetStateChanged extends IDataModelEvent {} + + public interface ICoreDMC extends IDataModelContext {} + + public interface ICoreData extends IDataModelData { + String getName(); + boolean isConnected(); + IOS.IOSDMC getOSDMC(); + } + + public interface ICoreStateChanged extends IDataModelEvent {} + + public void getTargets(GetDataDone done); + public void getCores(ITargetDMC target, GetDataDone done); + + public void connectTarget(ITargetDMC targetDmc, Done done); + public void disconnectTarget(ITargetDMC targetDmc, Done done); + public void connectCore(ITargetDMC targetDmc, Done done); + public void disconnectCore(ITargetDMC targetDmc, Done done); + +}