1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-08-11 02:05:39 +02:00

working on the implementation.

This commit is contained in:
Alain Magloire 2002-08-13 05:26:09 +00:00
parent e55f659950
commit 5c5930d219
40 changed files with 585 additions and 379 deletions

View file

@ -6,22 +6,19 @@
package org.eclipse.cdt.debug.core.cdi;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IStatus;
/**
*
* Represents a failure in the CDI model operations.
*
* @since Jul 9, 2002
*/
public class CDIException extends CoreException
{
/* (non-Javadoc)
* @see org.eclipse.core.runtime.CoreException#CoreException(IStatus)
*/
public CDIException( IStatus status )
{
super( status );
public class CDIException extends Exception {
public CDIException() {
super();
}
public CDIException(String s) {
super(s);
}
}

View file

@ -16,15 +16,6 @@ import org.eclipse.cdt.debug.core.cdi.model.ICDIExpression;
*/
public interface ICDIExpressionManager extends ICDISessionObject
{
/**
* Adds the given expression to the collection of registered
* expressions. This has no effect if the given expression is
* already registered.
*
* @param expression - the expression to add
* @throws CDIException on failure. Reasons include:
*/
void addExpression( ICDIExpression expression ) throws CDIException;
/**
* Removes the given array of expressions from the expression
@ -50,7 +41,7 @@ public interface ICDIExpressionManager extends ICDISessionObject
* @return ICDIExpression an expression specified by the given identifier
* @throws CDIException on failure. Reasons include:
*/
ICDIExpression getExpression( String expressionId ) throws CDIException;
ICDIExpression createExpression( String expressionId ) throws CDIException;
/**
* Returns a collection of all registered expressions, possibly empty.

View file

@ -96,13 +96,6 @@ public interface ICDISession
*/
ICDIRuntimeOptions getRuntimeOptions();
/**
* Returns whether this element is terminated.
*
* @return whether this element is terminated
*/
boolean isTerminated();
/**
* Causes this element to terminate, generating a <code>KIND_TERMINATE</code> event.
*

View file

@ -16,6 +16,6 @@ package org.eclipse.cdt.debug.core.cdi.event;
*
* @since Jul 10, 2002
*/
public interface ICDITerminatedEvent extends ICDIEvent
public interface ICDIDestroyedEvent extends ICDIEvent
{
}

View file

@ -42,4 +42,5 @@ public interface ICDISuspendedEvent extends ICDIEvent
* @return the current stack frame
*/
ICDIStackFrame getStackFrame();
}

View file

@ -6,7 +6,7 @@
package org.eclipse.cdt.debug.core.cdi.model;
import org.eclipse.cdt.debug.core.cdi.CDIException;
/**
* An expression is a snippet of code that can be evaluated to
@ -14,21 +14,5 @@ import org.eclipse.cdt.debug.core.cdi.CDIException;
*
* @since Jul 9, 2002
*/
public interface ICDIExpression extends ICDIObject
{
/**
* Returns this expression's snippet of code.
*
* @return the expression
*/
String getExpressionText();
/**
* Returns the current value of this expression or <code>null</code>
* if this expression does not currently have a value.
*
* @return the current value of this expression
* @throws CDIException if this method fails. Reasons include:
*/
ICDIValue getValue() throws CDIException;
public interface ICDIExpression extends ICDIVariable {
}

View file

@ -13,25 +13,10 @@ package org.eclipse.cdt.debug.core.cdi.model;
*/
public interface ICDIObject
{
/**
* Returns the identifier of this object.
*
* @return the identifier of this object
*/
String getId();
/**
* Returns the target this object is contained in.
*
* @return the target this object is contained in
*/
ICDITarget getCDITarget();
/**
* Returns the parent of this object or <code>null</code> if this
* object is a top level object.
*
* @return the parent of this object
*/
ICDIObject getParent();
ICDITarget getTarget();
}

View file

@ -29,28 +29,12 @@ public interface ICDITarget extends ICDIObject
ICDISession getSession();
/**
* Gets the output stream of the target process.
* Gets the target process.
*
* @return the output stream connected to the normal input of the
* target process.
*/
OutputStream getOutputStream();
/**
* Gets the input stream of the target process.
*
* @return the input stream connected to the normal output of the
* target process.
*/
InputStream getInputStream();
/**
* Gets the error stream of the target process.
*
* @return the input stream connected to the error stream of the
* target process.
*/
InputStream getErrorStream();
Process getProcess();
/**
* Returns the shared libraries loaded in this target.
@ -79,7 +63,7 @@ public interface ICDITarget extends ICDIObject
* @return the thread associated with the given id
* @throws CDIException if this method fails. Reasons include:
*/
ICDIThread getThread( String id ) throws CDIException;
ICDIThread getCurrentThread() throws CDIException;
/**
* Returns a memory block that starts at the specified memory

View file

@ -41,14 +41,6 @@ public interface ICDIVariable extends ICDIObject
*/
ICDIValue getValue() throws CDIException;
/**
* Returns whether this variable's value has changed since the last suspend event.
*
* @return whether this variable's value has changed since the last suspend event
* @throws CDIException if this method fails. Reasons include:
*/
boolean hasValueChanged() throws CDIException;
/**
* Attempts to set the value of this variable to the value of
* the given expression.

View file

@ -32,7 +32,7 @@ import org.eclipse.cdt.debug.core.cdi.event.ICDIRestartedEvent;
import org.eclipse.cdt.debug.core.cdi.event.ICDIResumedEvent;
import org.eclipse.cdt.debug.core.cdi.event.ICDISteppingEvent;
import org.eclipse.cdt.debug.core.cdi.event.ICDISuspendedEvent;
import org.eclipse.cdt.debug.core.cdi.event.ICDITerminatedEvent;
import org.eclipse.cdt.debug.core.cdi.event.ICDIDestroyedEvent;
import org.eclipse.cdt.debug.core.cdi.model.ICDIObject;
import org.eclipse.cdt.debug.core.cdi.model.ICDITarget;
import org.eclipse.cdt.debug.core.cdi.model.ICDIThread;
@ -628,7 +628,7 @@ public class CDebugTarget extends CDebugElement
public void handleDebugEvent( ICDIEvent event )
{
ICDIObject source = event.getSource();
if ( source.getCDITarget().equals( this ) )
if ( source.getTarget().equals( this ) )
{
if ( event instanceof ICDICreatedEvent )
{
@ -658,15 +658,15 @@ public class CDebugTarget extends CDebugElement
handleExitedEvent( (ICDIExitedEvent)event );
}
}
else if ( event instanceof ICDITerminatedEvent )
else if ( event instanceof ICDIDestroyedEvent )
{
if ( source instanceof ICDITarget )
{
handleTerminatedEvent( (ICDITerminatedEvent)event );
handleTerminatedEvent( (ICDIDestroyedEvent)event );
}
else if ( source instanceof ICDIThread )
{
handleThreadTerminatedEvent( (ICDITerminatedEvent)event );
handleThreadTerminatedEvent( (ICDIDestroyedEvent)event );
}
}
else if ( event instanceof ICDIDisconnectedEvent )
@ -998,7 +998,7 @@ public class CDebugTarget extends CDebugElement
fireChangeEvent( DebugEvent.STATE );
}
private void handleTerminatedEvent( ICDITerminatedEvent event )
private void handleTerminatedEvent( ICDIDestroyedEvent event )
{
setCurrentStateId( IState.TERMINATED );
setCurrentStateInfo( null );
@ -1045,7 +1045,7 @@ public class CDebugTarget extends CDebugElement
}
}
private void handleThreadTerminatedEvent( ICDITerminatedEvent event )
private void handleThreadTerminatedEvent( ICDIDestroyedEvent event )
{
ICDIThread cdiThread = (ICDIThread)event.getSource();
CThread thread = findThread( cdiThread );

View file

@ -132,7 +132,7 @@ public class CLocalVariable extends CModificationVariable
public void handleDebugEvent( ICDIEvent event )
{
ICDIObject source = event.getSource();
if ( source.getCDITarget().equals( getCDITarget() ) )
if ( source.getTarget().equals( getCDITarget() ) )
{
if ( event instanceof ICDIChangedEvent )
{

View file

@ -475,8 +475,9 @@ public class CStackFrame extends CDebugElement
*/
protected static boolean equalFrame( ICDIStackFrame frameOne, ICDIStackFrame frameTwo )
{
return ( frameOne.getParent().equals( frameTwo.getParent() ) &&
frameOne.getLocation().equals( frameTwo.getLocation() ) );
//return ( frameOne.getParent().equals( frameTwo.getParent() ) &&
// frameOne.getLocation().equals( frameTwo.getLocation() ) );
return (frameOne.getLocation().equals(frameTwo.getLocation()));
}
protected boolean exists() throws DebugException

View file

@ -27,7 +27,7 @@ import org.eclipse.cdt.debug.core.cdi.event.ICDIEventListener;
import org.eclipse.cdt.debug.core.cdi.event.ICDIResumedEvent;
import org.eclipse.cdt.debug.core.cdi.event.ICDISteppingEvent;
import org.eclipse.cdt.debug.core.cdi.event.ICDISuspendedEvent;
import org.eclipse.cdt.debug.core.cdi.event.ICDITerminatedEvent;
import org.eclipse.cdt.debug.core.cdi.event.ICDIDestroyedEvent;
import org.eclipse.cdt.debug.core.cdi.model.ICDIObject;
import org.eclipse.cdt.debug.core.cdi.model.ICDIStackFrame;
import org.eclipse.cdt.debug.core.cdi.model.ICDIThread;
@ -359,7 +359,7 @@ public class CThread extends CDebugElement
*/
public String getName() throws DebugException
{
return "Thread " + getCDIThread().getId();
return "Thread " + getCDIThread().toString();
}
/* (non-Javadoc)
@ -376,7 +376,7 @@ public class CThread extends CDebugElement
public void handleDebugEvent( ICDIEvent event )
{
ICDIObject source = event.getSource();
if ( source.getCDITarget().equals( getCDITarget() ) )
if ( source.getTarget().equals( getCDITarget() ) )
{
if ( event instanceof ICDISuspendedEvent )
{
@ -392,11 +392,11 @@ public class CThread extends CDebugElement
handleResumedEvent( (ICDIResumedEvent)event );
}
}
else if ( event instanceof ICDITerminatedEvent )
else if ( event instanceof ICDIDestroyedEvent )
{
if ( source instanceof ICDIThread )
{
handleTerminatedEvent( (ICDITerminatedEvent)event );
handleTerminatedEvent( (ICDIDestroyedEvent)event );
}
}
else if ( event instanceof ICDIDisconnectedEvent )
@ -864,7 +864,7 @@ public class CThread extends CDebugElement
fireSuspendEvent( DebugEvent.UNSPECIFIED );
}
private void handleTerminatedEvent( ICDITerminatedEvent event )
private void handleTerminatedEvent( ICDIDestroyedEvent event )
{
setCurrentStateId( IState.TERMINATED );
setCurrentStateInfo( null );

View file

@ -20,7 +20,8 @@ public class GDBDebugger implements ICDebugger {
return MIPlugin.getDefault().createCSession(exe.getLocation().toOSString());
}
catch (IOException e) {
throw new CDIException(new Status(0, MIPlugin.getDefault().getDescriptor().getUniqueIdentifier(), 0, "error", e));
//throw new CDIException(new Status(0, MIPlugin.getDefault().getDescriptor().getUniqueIdentifier(), 0, "error", e));
throw new CDIException("Error initializing");
}
}
@ -29,7 +30,8 @@ public class GDBDebugger implements ICDebugger {
return MIPlugin.getDefault().createCSession(exe.getLocation().toOSString(), pid);
}
catch (IOException e) {
throw new CDIException(new Status(0, MIPlugin.getDefault().getDescriptor().getUniqueIdentifier(), 0, "error", e));
//throw new CDIException(new Status(0, MIPlugin.getDefault().getDescriptor().getUniqueIdentifier(), 0, "error", e));
throw new CDIException("Error initializing");
}
}
@ -38,7 +40,8 @@ public class GDBDebugger implements ICDebugger {
return MIPlugin.getDefault().createCSession(exe.getLocation().toOSString(), corefile.getLocation().toOSString());
}
catch (IOException e) {
throw new CDIException(new Status(0, MIPlugin.getDefault().getDescriptor().getUniqueIdentifier(), 0, "error", e));
//throw new CDIException(new Status(0, MIPlugin.getDefault().getDescriptor().getUniqueIdentifier(), 0, "error", e));
throw new CDIException("Error initializing");
}
}

View file

@ -22,7 +22,8 @@ public class MIProcess extends Process {
public final static int SUSPENDED = 1;
public final static int RUNNING = 2;
public final static int TERMINATED = 3;
public final static int STEPPING = 3;
public final static int TERMINATED = 4;
int state = 0;
MISession session;
@ -130,6 +131,10 @@ public class MIProcess extends Process {
return state == RUNNING;
}
public synchronized boolean isStepping() {
return state == STEPPING;
}
public synchronized boolean isTerminated() {
return state == TERMINATED;
}
@ -142,6 +147,10 @@ public class MIProcess extends Process {
state = RUNNING;
}
public synchronized void setStepping() {
state = STEPPING;
}
public synchronized void setTerminated() {
state = TERMINATED;
notifyAll();

View file

@ -12,12 +12,18 @@ import java.util.ArrayList;
import java.util.List;
import org.eclipse.cdt.debug.mi.core.command.Command;
import org.eclipse.cdt.debug.mi.core.command.MIExecNext;
import org.eclipse.cdt.debug.mi.core.command.MIExecNextInstruction;
import org.eclipse.cdt.debug.mi.core.command.MIExecStep;
import org.eclipse.cdt.debug.mi.core.command.MIExecStepInstruction;
import org.eclipse.cdt.debug.mi.core.command.MIExecUntil;
import org.eclipse.cdt.debug.mi.core.event.EventThread;
import org.eclipse.cdt.debug.mi.core.event.MIBreakpointEvent;
import org.eclipse.cdt.debug.mi.core.event.MIEvent;
import org.eclipse.cdt.debug.mi.core.event.MIExitEvent;
import org.eclipse.cdt.debug.mi.core.event.MIFunctionFinishedEvent;
import org.eclipse.cdt.debug.mi.core.event.MIInferiorExitEvent;
import org.eclipse.cdt.debug.mi.core.event.MIRunningEvent;
import org.eclipse.cdt.debug.mi.core.event.MISignalEvent;
import org.eclipse.cdt.debug.mi.core.event.MIStepEvent;
import org.eclipse.cdt.debug.mi.core.event.MIWatchpointEvent;
@ -102,16 +108,33 @@ public class RxThread extends Thread {
// Notify any command waiting for a ResultRecord.
MIResultRecord rr = response.getMIResultRecord();
if (rr != null) {
int id = rr.geToken();
Command cmd = rxQueue.removeCommand(id);
// Check if the state changed.
String state = rr.getResultClass();
if ("running".equals(state)) {
session.getMIProcess().setRunning();
MIEvent[] events = new MIEvent[1];
// Check the type of command
// if it was a step instruction set state stepping
if (cmd instanceof MIExecNext ||
cmd instanceof MIExecNextInstruction ||
cmd instanceof MIExecStep ||
cmd instanceof MIExecStepInstruction ||
cmd instanceof MIExecUntil) {
session.getMIProcess().setStepping();
events[0] = new MIRunningEvent(true);
} else {
session.getMIProcess().setRunning();
events[0] = new MIRunningEvent();
}
Thread eventTread = new EventThread(session, events);
eventTread.start();
} else if ("exit".equals(state)) {
session.getMIProcess().setTerminated();
}
int id = rr.geToken();
Command cmd = rxQueue.removeCommand(id);
// Notify the waiting command.
if (cmd != null) {
synchronized (cmd) {
cmd.setMIOutput(response);
@ -292,6 +315,9 @@ public class RxThread extends Thread {
} else if ("exited-normally".equals(reason)) {
session.getMIProcess().setTerminated();
event = new MIInferiorExitEvent();
} else if ("exited-signalled".equals(reason)) {
session.getMIProcess().setTerminated();
event = new MIInferiorExitEvent();
}
return event;
}

View file

@ -15,11 +15,12 @@ import org.eclipse.cdt.debug.mi.core.output.MIArg;
* To enable and disable the creation of type comments go to
* Window>Preferences>Java>Code Generation.
*/
public class Argument implements ICDIArgument {
public class Argument extends CObject implements ICDIArgument {
MIArg arg;
public Argument(MIArg a) {
public Argument(CTarget target, MIArg a) {
super(target);
arg = a;
}
@ -34,7 +35,7 @@ public class Argument implements ICDIArgument {
* @see org.eclipse.cdt.debug.core.cdi.model.ICDIVariable#getValue()
*/
public ICDIValue getValue() throws CDIException {
return new Value(arg.getValue());
return new Value(getCTarget(), arg.getValue());
}
/**
@ -56,27 +57,6 @@ public class Argument implements ICDIArgument {
public void setValue(String expression) throws CDIException {
}
/**
* @see org.eclipse.cdt.debug.core.cdi.model.ICDIObject#getCDITarget()
*/
public ICDITarget getCDITarget() {
return null;
}
/**
* @see org.eclipse.cdt.debug.core.cdi.model.ICDIObject#getId()
*/
public String getId() {
return null;
}
/**
* @see org.eclipse.cdt.debug.core.cdi.model.ICDIObject#getParent()
*/
public ICDIObject getParent() {
return null;
}
/**
* @see org.eclipse.cdt.debug.core.cdi.model.ICDIVariable#getTypeName()
*/

View file

@ -65,7 +65,7 @@ public class BreakpointManager extends SessionObject implements ICDIBreakpointMa
&& breakList.contains(breakpoints[i])) {
numbers[i] = ((Breakpoint)breakpoints[i]).getMIBreakPoint().getNumber();
} else {
//throw new CDIException();
throw new CDIException("Not a CDT breakpoint");
}
}
CSession s = getCSession();
@ -75,10 +75,10 @@ public class BreakpointManager extends SessionObject implements ICDIBreakpointMa
s.getMISession().postCommand(breakDelete);
MIInfo info = breakDelete.getMIInfo();
if (info == null) {
//throw new CDIException();
throw new CDIException("Timedout");
}
} catch (MIException e) {
// throw new CDIException(e);
throw new CDIException(e.toString());
}
for (int i = 0; i < breakpoints.length; i++) {
breakList.remove(breakpoints[i]);
@ -90,7 +90,7 @@ public class BreakpointManager extends SessionObject implements ICDIBreakpointMa
if (breakpoint instanceof Breakpoint && breakList.contains(breakpoint)) {
number = ((Breakpoint)breakpoint).getMIBreakPoint().getNumber();
} else {
//throw new CDIException();
throw new CDIException("Not a CDT breakpoint");
}
CSession s = getCSession();
CommandFactory factory = s.getMISession().getCommandFactory();
@ -99,10 +99,10 @@ public class BreakpointManager extends SessionObject implements ICDIBreakpointMa
s.getMISession().postCommand(breakEnable);
MIInfo info = breakEnable.getMIInfo();
if (info == null) {
//throw new CDIException();
throw new CDIException("Timedout");
}
} catch (MIException e) {
// throw new CDIException(e);
throw new CDIException(e.toString());
}
((Breakpoint)breakpoint).getMIBreakPoint().setEnabled(true);
}
@ -112,7 +112,7 @@ public class BreakpointManager extends SessionObject implements ICDIBreakpointMa
if (breakpoint instanceof Breakpoint && breakList.contains(breakpoint)) {
number = ((Breakpoint)breakpoint).getMIBreakPoint().getNumber();
} else {
// throw new CDIException();
throw new CDIException("Not a CDT breakpoint");
}
CSession s = getCSession();
CommandFactory factory = s.getMISession().getCommandFactory();
@ -121,10 +121,10 @@ public class BreakpointManager extends SessionObject implements ICDIBreakpointMa
s.getMISession().postCommand(breakDisable);
MIInfo info = breakDisable.getMIInfo();
if (info == null) {
//throw new CDIException();
throw new CDIException("Timeout");
}
} catch (MIException e) {
// throw new CDIException(e);
throw new CDIException(e.toString());
}
((Breakpoint)breakpoint).getMIBreakPoint().setEnabled(false);
}
@ -141,8 +141,7 @@ public class BreakpointManager extends SessionObject implements ICDIBreakpointMa
*/
public ICDICatchpoint setCatchpoint(int type, ICDICatchEvent event, String expression,
ICDICondition condition) throws CDIException {
// throw new CDIException();
return null;
throw new CDIException("Not Supported");
}
/**
@ -184,14 +183,14 @@ public class BreakpointManager extends SessionObject implements ICDIBreakpointMa
s.getMISession().postCommand(breakInsert);
MIBreakInsertInfo info = breakInsert.getMIBreakInsertInfo();
if (info == null) {
//throw new CDIException();
throw new CDIException("Timedout");
}
points = info.getBreakPoints();
if (points == null || points.length == 0) {
//throw new CDIException();
throw new CDIException("Error parsing");
}
} catch (MIException e) {
// throw new CDIException(e);
throw new CDIException(e.toString());
}
Breakpoint bkpt= new Breakpoint(this, points[0]);
@ -215,14 +214,14 @@ public class BreakpointManager extends SessionObject implements ICDIBreakpointMa
s.getMISession().postCommand(breakWatch);
MIBreakWatchInfo info = breakWatch.getMIBreakWatchInfo();
if (info == null) {
//throw new CDIException();
throw new CDIException("Timedout");
}
points = info.getBreakPoints();
if (points == null || points.length == 0) {
//throw new CDIException();
throw new CDIException("Parsing Error");
}
} catch (MIException e) {
// throw new CDIException(e);
throw new CDIException(e.toString());
}
Breakpoint bkpt= new Breakpoint(this, points[0]);

View file

@ -0,0 +1,33 @@
package org.eclipse.cdt.debug.mi.core.cdi;
import org.eclipse.cdt.debug.core.cdi.model.ICDIObject;
import org.eclipse.cdt.debug.core.cdi.model.ICDITarget;
/**
* @author alain
*
* To change this generated comment edit the template variable "typecomment":
* Window>Preferences>Java>Templates.
* To enable and disable the creation of type comments go to
* Window>Preferences>Java>Code Generation.
*/
public class CObject implements ICDIObject {
CTarget target;
public CObject(CTarget t) {
target = t;
}
/**
* @see org.eclipse.cdt.debug.core.cdi.model.ICDIObject#getTarget()
*/
public ICDITarget getTarget() {
return target;
}
public CTarget getCTarget() {
return target;
}
}

View file

@ -16,6 +16,7 @@ import org.eclipse.cdt.debug.core.cdi.ICDIExpressionManager;
import org.eclipse.cdt.debug.core.cdi.ICDIMemoryManager;
import org.eclipse.cdt.debug.core.cdi.ICDIRuntimeOptions;
import org.eclipse.cdt.debug.core.cdi.ICDISession;
import org.eclipse.cdt.debug.core.cdi.ICDISessionObject;
import org.eclipse.cdt.debug.core.cdi.ICDISignalManager;
import org.eclipse.cdt.debug.core.cdi.ICDISourceManager;
import org.eclipse.cdt.debug.core.cdi.model.ICDITarget;
@ -24,7 +25,7 @@ import org.eclipse.cdt.debug.mi.core.MISession;
/**
* @see org.eclipse.cdt.debug.core.cdi.ICDISession
*/
public class CSession implements ICDISession {
public class CSession implements ICDISession, ICDISessionObject {
Properties props;
MISession session;
@ -52,6 +53,14 @@ public class CSession implements ICDISession {
return session;
}
ICDITarget getTarget() {
return ctarget;
}
CTarget getCTarget() {
return ctarget;
}
/**
* @see org.eclipse.cdt.debug.core.cdi.ICDISession#getAttribute(String)
*/
@ -108,17 +117,6 @@ public class CSession implements ICDISession {
return new ICDITarget[]{ctarget};
}
public ICDITarget getCTarget() {
return ctarget;
}
/**
* @see org.eclipse.cdt.debug.core.cdi.ICDISession#isTerminated()
*/
public boolean isTerminated() {
return session.isTerminated();
}
/**
* @see org.eclipse.cdt.debug.core.cdi.ICDISession#setAttribute(String, String)
*/
@ -146,4 +144,12 @@ public class CSession implements ICDISession {
public ICDIRuntimeOptions getRuntimeOptions() {
return new RuntimeOptions();
}
/**
* @see org.eclipse.cdt.debug.core.cdi.ICDISessionObject#getSession()
*/
public ICDISession getSession() {
return this;
}
}

View file

@ -9,6 +9,7 @@ import java.io.InputStream;
import java.io.OutputStream;
import org.eclipse.cdt.debug.core.cdi.CDIException;
import org.eclipse.cdt.debug.core.cdi.ICDISession;
import org.eclipse.cdt.debug.core.cdi.model.ICDIExpression;
import org.eclipse.cdt.debug.core.cdi.model.ICDIGlobalVariable;
import org.eclipse.cdt.debug.core.cdi.model.ICDIMemoryBlock;
@ -21,6 +22,7 @@ import org.eclipse.cdt.debug.core.cdi.model.ICDIValue;
import org.eclipse.cdt.debug.mi.core.MIException;
import org.eclipse.cdt.debug.mi.core.MISession;
import org.eclipse.cdt.debug.mi.core.command.CommandFactory;
import org.eclipse.cdt.debug.mi.core.command.MIDataEvaluateExpression;
import org.eclipse.cdt.debug.mi.core.command.MIExecContinue;
import org.eclipse.cdt.debug.mi.core.command.MIExecFinish;
import org.eclipse.cdt.debug.mi.core.command.MIExecInterrupt;
@ -30,6 +32,7 @@ import org.eclipse.cdt.debug.mi.core.command.MIExecRun;
import org.eclipse.cdt.debug.mi.core.command.MIExecStep;
import org.eclipse.cdt.debug.mi.core.command.MIExecStepInstruction;
import org.eclipse.cdt.debug.mi.core.command.MITargetDetach;
import org.eclipse.cdt.debug.mi.core.output.MIDataEvaluateExpressionInfo;
import org.eclipse.cdt.debug.mi.core.output.MIInfo;
/**
@ -40,60 +43,51 @@ import org.eclipse.cdt.debug.mi.core.output.MIInfo;
* To enable and disable the creation of type comments go to
* Window>Preferences>Java>Code Generation.
*/
public class CTarget extends SessionObject implements ICDITarget {
public class CTarget implements ICDITarget {
public CTarget(CSession session) {
super(session);
CSession session;
public CTarget(CSession s) {
session = s;
}
CSession getCSession() {
return session;
}
/**
* @see org.eclipse.cdt.debug.core.cdi.model.ICDITarget#disconnect()
*/
public void disconnect() throws CDIException {
MISession mi = getCSession().getMISession();
MISession mi = session.getMISession();
CommandFactory factory = mi.getCommandFactory();
MITargetDetach detach = factory.createMITargetDetach();
try {
mi.postCommand(detach);
MIInfo info = detach.getMIInfo();
if (info == null) {
// throw new CDIException();
throw new CDIException("Timedout");
}
} catch (MIException e) {
//throw new CDIException(e);
throw new CDIException(e.toString());
}
}
/**
* @see org.eclipse.cdt.debug.core.cdi.model.ICDITarget#evaluateExpression(ICDIExpression)
*/
public void evaluateExpression(ICDIExpression expression)
throws CDIException {
}
/**
* @see org.eclipse.cdt.debug.core.cdi.model.ICDITarget#evaluateExpression(String)
*/
public ICDIExpression evaluateExpression(String expressionText)
throws CDIException {
return null;
}
/**
* @see org.eclipse.cdt.debug.core.cdi.model.ICDITarget#finish()
*/
public void finish() throws CDIException {
MISession mi = getCSession().getMISession();
MISession mi = session.getMISession();
CommandFactory factory = mi.getCommandFactory();
MIExecFinish finish = factory.createMIExecFinish();
try {
mi.postCommand(finish);
MIInfo info = finish.getMIInfo();
if (info == null) {
// throw new CDIException();
throw new CDIException("Timedout");
}
} catch (MIException e) {
//throw new CDIException(e);
throw new CDIException(e.toString());
}
}
@ -106,24 +100,10 @@ public class CTarget extends SessionObject implements ICDITarget {
}
/**
* @see org.eclipse.cdt.debug.core.cdi.model.ICDITarget#getErrorStream()
* @see org.eclipse.cdt.debug.core.cdi.model.ICDITarget#getProcess()
*/
public InputStream getErrorStream() {
return getCSession().getMISession().getMIProcess().getErrorStream();
}
/**
* @see org.eclipse.cdt.debug.core.cdi.model.ICDITarget#getInputStream()
*/
public InputStream getInputStream() {
return getCSession().getMISession().getMIProcess().getInputStream();
}
/**
* @see org.eclipse.cdt.debug.core.cdi.model.ICDITarget#getOutputStream()
*/
public OutputStream getOutputStream() {
return getCSession().getMISession().getMIProcess().getOutputStream();
public Process getProcess() {
return session.getMISession().getMIProcess();
}
/**
@ -150,7 +130,7 @@ public class CTarget extends SessionObject implements ICDITarget {
/**
* @see org.eclipse.cdt.debug.core.cdi.model.ICDITarget#getThread(String)
*/
public ICDIThread getThread(String id) throws CDIException {
public ICDIThread getCurrentThread() throws CDIException {
return null;
}
@ -158,7 +138,7 @@ public class CTarget extends SessionObject implements ICDITarget {
* @see org.eclipse.cdt.debug.core.cdi.model.ICDITarget#getThreads()
*/
public ICDIThread[] getThreads() throws CDIException {
return null;
return new ICDIThread[0];
}
/**
@ -172,38 +152,38 @@ public class CTarget extends SessionObject implements ICDITarget {
* @see org.eclipse.cdt.debug.core.cdi.model.ICDITarget#isStepping()
*/
public boolean isStepping() {
return getCSession().getMISession().getMIProcess().isRunning();
return session.getMISession().getMIProcess().isRunning();
}
/**
* @see org.eclipse.cdt.debug.core.cdi.model.ICDITarget#isSuspended()
*/
public boolean isSuspended() {
return getCSession().getMISession().getMIProcess().isSuspended();
return session.getMISession().getMIProcess().isSuspended();
}
/**
* @see org.eclipse.cdt.debug.core.cdi.model.ICDITarget#isTerminated()
*/
public boolean isTerminated() {
return getCSession().getMISession().getMIProcess().isTerminated();
return session.getMISession().getMIProcess().isTerminated();
}
/**
* @see org.eclipse.cdt.debug.core.cdi.model.ICDITarget#restart()
*/
public void restart() throws CDIException {
MISession mi = getCSession().getMISession();
MISession mi = session.getMISession();
CommandFactory factory = mi.getCommandFactory();
MIExecRun run = factory.createMIExecRun(new String[0]);
try {
mi.postCommand(run);
MIInfo info = run.getMIInfo();
if (info == null) {
// throw new CDIException();
throw new CDIException("Timedout");
}
} catch (MIException e) {
//throw new CDIException(e);
throw new CDIException(e.toString());
}
}
@ -211,7 +191,7 @@ public class CTarget extends SessionObject implements ICDITarget {
* @see org.eclipse.cdt.debug.core.cdi.model.ICDITarget#resume()
*/
public void resume() throws CDIException {
MISession mi = getCSession().getMISession();
MISession mi = session.getMISession();
if (mi.getMIProcess().isSuspended()) {
CommandFactory factory = mi.getCommandFactory();
MIExecContinue cont = factory.createMIExecContinue();
@ -219,10 +199,10 @@ public class CTarget extends SessionObject implements ICDITarget {
mi.postCommand(cont);
MIInfo info = cont.getMIInfo();
if (info == null) {
// throw new CDIException();
throw new CDIException("Timedout");
}
} catch (MIException e) {
//throw new CDIException(e);
throw new CDIException(e.toString());
}
} else {
restart();
@ -233,17 +213,17 @@ public class CTarget extends SessionObject implements ICDITarget {
* @see org.eclipse.cdt.debug.core.cdi.model.ICDITarget#stepInto()
*/
public void stepInto() throws CDIException {
MISession mi = getCSession().getMISession();
MISession mi = session.getMISession();
CommandFactory factory = mi.getCommandFactory();
MIExecStep step = factory.createMIExecStep();
try {
mi.postCommand(step);
MIInfo info = step.getMIInfo();
if (info == null) {
// throw new CDIException();
throw new CDIException("Timedout");
}
} catch (MIException e) {
//throw new CDIException(e);
throw new CDIException(e.toString());
}
}
@ -251,17 +231,17 @@ public class CTarget extends SessionObject implements ICDITarget {
* @see org.eclipse.cdt.debug.core.cdi.model.ICDITarget#stepIntoInstruction()
*/
public void stepIntoInstruction() throws CDIException {
MISession mi = getCSession().getMISession();
MISession mi = session.getMISession();
CommandFactory factory = mi.getCommandFactory();
MIExecStepInstruction stepi = factory.createMIExecStepInstruction();
try {
mi.postCommand(stepi);
MIInfo info = stepi.getMIInfo();
if (info == null) {
// throw new CDIException();
throw new CDIException("Timedout");
}
} catch (MIException e) {
//throw new CDIException(e);
throw new CDIException(e.toString());
}
}
@ -269,17 +249,17 @@ public class CTarget extends SessionObject implements ICDITarget {
* @see org.eclipse.cdt.debug.core.cdi.model.ICDITarget#stepOver()
*/
public void stepOver() throws CDIException {
MISession mi = getCSession().getMISession();
MISession mi = session.getMISession();
CommandFactory factory = mi.getCommandFactory();
MIExecNext next = factory.createMIExecNext();
try {
mi.postCommand(next);
MIInfo info = next.getMIInfo();
if (info == null) {
// throw new CDIException();
throw new CDIException("Timedout");
}
} catch (MIException e) {
//throw new CDIException(e);
throw new CDIException(e.toString());
}
}
@ -287,17 +267,17 @@ public class CTarget extends SessionObject implements ICDITarget {
* @see org.eclipse.cdt.debug.core.cdi.model.ICDITarget#stepOverInstruction()
*/
public void stepOverInstruction() throws CDIException {
MISession mi = getCSession().getMISession();
MISession mi = session.getMISession();
CommandFactory factory = mi.getCommandFactory();
MIExecNextInstruction nexti = factory.createMIExecNextInstruction();
try {
mi.postCommand(nexti);
MIInfo info = nexti.getMIInfo();
if (info == null) {
// throw new CDIException();
throw new CDIException("Timedout");
}
} catch (MIException e) {
//throw new CDIException(e);
throw new CDIException(e.toString());
}
}
@ -305,17 +285,17 @@ public class CTarget extends SessionObject implements ICDITarget {
* @see org.eclipse.cdt.debug.core.cdi.model.ICDITarget#suspend()
*/
public void suspend() throws CDIException {
MISession mi = getCSession().getMISession();
MISession mi = session.getMISession();
CommandFactory factory = mi.getCommandFactory();
MIExecInterrupt interrupt = factory.createMIExecInterrupt();
try {
mi.postCommand(interrupt);
MIInfo info = interrupt.getMIInfo();
if (info == null) {
// throw new CDIException();
throw new CDIException("Timedout");
}
} catch (MIException e) {
//throw new CDIException(e);
throw new CDIException(e.toString());
}
}
@ -323,36 +303,37 @@ public class CTarget extends SessionObject implements ICDITarget {
* @see org.eclipse.cdt.debug.core.cdi.model.ICDITarget#terminate()
*/
public void terminate() throws CDIException {
getCSession().getMISession().getMIProcess().destroy();
session.getMISession().getMIProcess().destroy();
}
/**
* @see org.eclipse.cdt.debug.core.cdi.model.ICDIObject#getCDITarget()
* @see org.eclipse.cdt.debug.core.cdi.model.ICDIObject#getTarget()
*/
public ICDITarget getCDITarget() {
public ICDITarget getTarget() {
return this;
}
/**
* @see org.eclipse.cdt.debug.core.cdi.model.ICDIObject#getId()
*/
public String getId() {
return null;
}
/**
* @see org.eclipse.cdt.debug.core.cdi.model.ICDIObject#getParent()
*/
public ICDIObject getParent() {
return null;
}
/**
* @see org.eclipse.cdt.debug.core.cdi.model.ICDITarget#evaluateExpressionToString(String)
*/
public String evaluateExpressionToString(String expressionText)
throws CDIException {
return null;
MISession mi = session.getMISession();
CommandFactory factory = mi.getCommandFactory();
MIDataEvaluateExpression evaluate =
factory.createMIDataEvaluateExpression(expressionText);
try {
mi.postCommand(evaluate);
MIDataEvaluateExpressionInfo info =
evaluate.getMIDataEvaluateExpressionInfo();
if (info == null) {
throw new CDIException("Timedout");
}
return info.getExpression();
} catch (MIException e) {
throw new CDIException(e.toString());
}
}
/**
@ -363,4 +344,11 @@ public class CTarget extends SessionObject implements ICDITarget {
return null;
}
/**
* @see org.eclipse.cdt.debug.core.cdi.model.ICDITarget#getSession()
*/
public ICDISession getSession() {
return session;
}
}

View file

@ -0,0 +1,117 @@
package org.eclipse.cdt.debug.mi.core.cdi;
import org.eclipse.cdt.debug.core.cdi.CDIException;
import org.eclipse.cdt.debug.core.cdi.model.ICDIStackFrame;
import org.eclipse.cdt.debug.core.cdi.model.ICDIThread;
import org.eclipse.cdt.debug.mi.core.MIException;
import org.eclipse.cdt.debug.mi.core.MISession;
import org.eclipse.cdt.debug.mi.core.command.CommandFactory;
import org.eclipse.cdt.debug.mi.core.command.MIStackListFrames;
import org.eclipse.cdt.debug.mi.core.output.MIFrame;
import org.eclipse.cdt.debug.mi.core.output.MIStackListFramesInfo;
/**
* @author alain
*
* To change this generated comment edit the template variable "typecomment":
* Window>Preferences>Java>Templates.
* To enable and disable the creation of type comments go to
* Window>Preferences>Java>Code Generation.
*/
public class CThread extends CObject implements ICDIThread {
String id = "";
public CThread(CTarget target, String threadId) {
super(target);
id = threadId;
}
/**
* @see org.eclipse.cdt.debug.core.cdi.model.ICDIThread#finish()
*/
public void finish() throws CDIException {
getTarget().finish();
}
/**
* @see org.eclipse.cdt.debug.core.cdi.model.ICDIThread#getStackFrames()
*/
public ICDIStackFrame[] getStackFrames() throws CDIException {
MISession mi = getCTarget().getCSession().getMISession();
CommandFactory factory = mi.getCommandFactory();
MIStackListFrames frames = factory.createMIStackListFrames();
try {
mi.postCommand(frames);
MIStackListFramesInfo info = frames.getMIStackListFramesInfo();
if (info == null) {
throw new CDIException("Timedout");
}
MIFrame[] miFrames = info.getMIFrames();
ICDIStackFrame[] stack = new ICDIStackFrame[miFrames.length];
for (int i = 0; i < stack.length; i++) {
stack[i] = new StackFrame(getCTarget(), miFrames[i]);
}
return stack;
} catch (MIException e) {
throw new CDIException(e.toString());
}
}
/**
* @see org.eclipse.cdt.debug.core.cdi.model.ICDIThread#isStepping()
*/
public boolean isStepping() {
return getTarget().isStepping();
}
/**
* @see org.eclipse.cdt.debug.core.cdi.model.ICDIThread#isSuspended()
*/
public boolean isSuspended() {
return getTarget().isSuspended();
}
/**
* @see org.eclipse.cdt.debug.core.cdi.model.ICDIThread#resume()
*/
public void resume() throws CDIException {
getTarget().resume();
}
/**
* @see org.eclipse.cdt.debug.core.cdi.model.ICDIThread#stepInto()
*/
public void stepInto() throws CDIException {
getTarget().stepInto();
}
/**
* @see org.eclipse.cdt.debug.core.cdi.model.ICDIThread#stepIntoInstruction()
*/
public void stepIntoInstruction() throws CDIException {
getTarget().stepIntoInstruction();
}
/**
* @see org.eclipse.cdt.debug.core.cdi.model.ICDIThread#stepOver()
*/
public void stepOver() throws CDIException {
getTarget().stepOver();
}
/**
* @see org.eclipse.cdt.debug.core.cdi.model.ICDIThread#stepOverInstruction()
*/
public void stepOverInstruction() throws CDIException {
getTarget().stepOverInstruction();
}
/**
* @see org.eclipse.cdt.debug.core.cdi.model.ICDIThread#suspend()
*/
public void suspend() throws CDIException {
getTarget().suspend();
}
}

View file

@ -0,0 +1,18 @@
package org.eclipse.cdt.debug.mi.core.cdi;
import org.eclipse.cdt.debug.core.cdi.ICDIEndSteppingRange;
/**
* @author alain
*
* To change this generated comment edit the template variable "typecomment":
* Window>Preferences>Java>Templates.
* To enable and disable the creation of type comments go to
* Window>Preferences>Java>Code Generation.
*/
public class EndSteppingRange extends SessionObject implements ICDIEndSteppingRange {
public EndSteppingRange(CSession session) {
super(session);
}
}

View file

@ -7,6 +7,7 @@ import org.eclipse.cdt.debug.mi.core.event.MIExitEvent;
import org.eclipse.cdt.debug.mi.core.event.MIFunctionFinishedEvent;
import org.eclipse.cdt.debug.mi.core.event.MIInferiorExitEvent;
import org.eclipse.cdt.debug.mi.core.event.MILocationReachedEvent;
import org.eclipse.cdt.debug.mi.core.event.MIRunningEvent;
import org.eclipse.cdt.debug.mi.core.event.MISignalEvent;
import org.eclipse.cdt.debug.mi.core.event.MIStepEvent;
import org.eclipse.cdt.debug.mi.core.event.MIWatchpointEvent;
@ -21,16 +22,24 @@ import org.eclipse.cdt.debug.mi.core.event.MIWatchpointEvent;
*/
public class EventAdapter {
public static ICDIEvent getCEvent(final CSession session, final MIEvent miEvent) {
public static ICDIEvent getCDIEvent(CSession session, MIEvent miEvent) {
if (miEvent instanceof MIBreakpointEvent) {
return new SuspendedEvent(session, (MIBreakpointEvent)miEvent);
return new SuspendedEvent(session, miEvent);
} else if (miEvent instanceof MIInferiorExitEvent) {
} else if (miEvent instanceof MIExitEvent) {
} else if (miEvent instanceof MIFunctionFinishedEvent) {
} else if (miEvent instanceof MILocationReachedEvent) {
} else if (miEvent instanceof MISignalEvent) {
} else if (miEvent instanceof MIStepEvent) {
return new SuspendedEvent(session, miEvent);
} else if (miEvent instanceof MIWatchpointEvent) {
} else if (miEvent instanceof MIRunningEvent) {
MIRunningEvent running = (MIRunningEvent)miEvent;
if (running.isStepping()) {
return new SteppingEvent(session, miEvent);
} else {
return new ResumedEvent(session, miEvent);
}
}
return null;
}

View file

@ -12,6 +12,7 @@ import java.util.Observable;
import java.util.Observer;
import org.eclipse.cdt.debug.core.cdi.ICDIEventManager;
import org.eclipse.cdt.debug.core.cdi.event.ICDIEvent;
import org.eclipse.cdt.debug.core.cdi.event.ICDIEventListener;
import org.eclipse.cdt.debug.mi.core.MISession;
import org.eclipse.cdt.debug.mi.core.event.MIEvent;
@ -36,7 +37,8 @@ public class EventManager extends SessionObject implements ICDIEventManager {
public void update(Observable o, Object args) {
MIEvent[] events = (MIEvent[])args;
for (int i = 0; i < events.length; i++) {
// listener.handleDebugEvent(new CEventAdapter(events[i]));
ICDIEvent cdiEvent = EventAdapter.getCDIEvent(getCSession(), events[i]);
listener.handleDebugEvent(cdiEvent);
}
}
}

View file

@ -14,41 +14,43 @@ import org.eclipse.cdt.debug.core.cdi.model.ICDIValue;
* To enable and disable the creation of type comments go to
* Window>Preferences>Java>Code Generation.
*/
public class Expression implements ICDIExpression {
public class Expression extends CObject implements ICDIExpression {
public Expression(CTarget target) {
super(target);
}
/**
* @see org.eclipse.cdt.debug.core.cdi.model.ICDIExpression#getExpressionText()
* @see org.eclipse.cdt.debug.core.cdi.model.ICDIVariable#getName()
*/
public String getExpressionText() {
public String getName() throws CDIException {
return null;
}
/**
* @see org.eclipse.cdt.debug.core.cdi.model.ICDIExpression#getValue()
* @see org.eclipse.cdt.debug.core.cdi.model.ICDIVariable#getTypeName()
*/
public String getTypeName() throws CDIException {
return null;
}
/**
* @see org.eclipse.cdt.debug.core.cdi.model.ICDIVariable#getValue()
*/
public ICDIValue getValue() throws CDIException {
return null;
}
/**
* @see org.eclipse.cdt.debug.core.cdi.model.ICDIObject#getCDITarget()
* @see org.eclipse.cdt.debug.core.cdi.model.ICDIVariable#setValue(ICDIValue)
*/
public ICDITarget getCDITarget() {
return null;
public void setValue(ICDIValue value) throws CDIException {
}
/**
* @see org.eclipse.cdt.debug.core.cdi.model.ICDIObject#getId()
* @see org.eclipse.cdt.debug.core.cdi.model.ICDIVariable#setValue(String)
*/
public String getId() {
return null;
}
/**
* @see org.eclipse.cdt.debug.core.cdi.model.ICDIObject#getParent()
*/
public ICDIObject getParent() {
return null;
public void setValue(String expression) throws CDIException {
}
}

View file

@ -24,12 +24,6 @@ public class ExpressionManager extends SessionObject implements ICDIExpressionMa
super(session);
}
/**
* @see org.eclipse.cdt.debug.core.cdi.ICDIExpressionManager#addExpression(ICDIExpression)
*/
public void addExpression(ICDIExpression expression) throws CDIException {
}
/**
* @see org.eclipse.cdt.debug.core.cdi.ICDIExpressionManager#getExpression(String)
*/
@ -58,4 +52,12 @@ public class ExpressionManager extends SessionObject implements ICDIExpressionMa
throws CDIException {
}
/**
* @see org.eclipse.cdt.debug.core.cdi.ICDIExpressionManager#createExpression(String)
*/
public ICDIExpression createExpression(String expressionId)
throws CDIException {
return null;
}
}

View file

@ -0,0 +1,32 @@
package org.eclipse.cdt.debug.mi.core.cdi;
import org.eclipse.cdt.debug.core.cdi.event.ICDIResumedEvent;
import org.eclipse.cdt.debug.core.cdi.model.ICDIObject;
import org.eclipse.cdt.debug.mi.core.event.MIEvent;
/**
* @author alain
*
* To change this generated comment edit the template variable "typecomment":
* Window>Preferences>Java>Templates.
* To enable and disable the creation of type comments go to
* Window>Preferences>Java>Code Generation.
*/
public class ResumedEvent implements ICDIResumedEvent {
CSession session;
MIEvent event;
public ResumedEvent(CSession s, MIEvent e) {
session = s;
event = e;
}
/**
* @see org.eclipse.cdt.debug.core.cdi.event.ICDIEvent#getSource()
*/
public ICDIObject getSource() {
return session.getTarget();
}
}

View file

@ -23,13 +23,12 @@ import org.eclipse.cdt.debug.mi.core.output.MIStackListLocalsInfo;
* To enable and disable the creation of type comments go to
* Window>Preferences>Java>Code Generation.
*/
public class StackFrame implements ICDIStackFrame {
public class StackFrame extends CObject implements ICDIStackFrame {
CSession session;
MIFrame frame;
public StackFrame(CSession s, MIFrame f) {
session = s;
public StackFrame(CTarget target, MIFrame f) {
super(target);
frame = f;
}
@ -37,12 +36,15 @@ public class StackFrame implements ICDIStackFrame {
* @see org.eclipse.cdt.debug.core.cdi.model.ICDIStackFrame#getArguments()
*/
public ICDIArgument[] getArguments() throws CDIException {
MIArg[] args = frame.getArgs();
ICDIArgument[] cargs = new ICDIArgument[args.length];
for (int i = 0; i < cargs.length; i++) {
cargs[i] = new Argument(args[i]);
if (frame != null) {
MIArg[] args = frame.getArgs();
ICDIArgument[] cargs = new ICDIArgument[args.length];
for (int i = 0; i < cargs.length; i++) {
cargs[i] = new Argument(getCTarget(), args[i]);
}
return cargs;
}
return cargs;
return new ICDIArgument[0];
}
/**
@ -51,7 +53,7 @@ public class StackFrame implements ICDIStackFrame {
public ICDIVariable[] getLocalVariables() throws CDIException {
MIArg[] args = null;
ICDIVariable[] variables = null;
MISession mi = session.getMISession();
MISession mi = getCTarget().getCSession().getMISession();
CommandFactory factory = mi.getCommandFactory();
MIStackListLocals locals = factory.createMIStackListLocals(true);
try {
@ -68,7 +70,7 @@ public class StackFrame implements ICDIStackFrame {
if (args != null) {
variables = new ICDIVariable[args.length];
for (int i = 0; i < variables.length; i++) {
variables[i] = new Variable(args[i]);
variables[i] = new Variable(getCTarget(), args[i]);
}
} else {
variables = new ICDIVariable[0];
@ -80,28 +82,11 @@ public class StackFrame implements ICDIStackFrame {
* @see org.eclipse.cdt.debug.core.cdi.model.ICDIStackFrame#getLocation()
*/
public ICDILocation getLocation() {
return new Location(frame.getFile(), frame.getFunction(),
frame.getLine(), frame.getAddress());
if (frame != null) {
return new Location(frame.getFile(), frame.getFunction(),
frame.getLine(), frame.getAddress());
}
return new Location("", "", 0, 0);
}
/**
* @see org.eclipse.cdt.debug.core.cdi.model.ICDIObject#getCDITarget()
*/
public ICDITarget getCDITarget() {
return session.getCTarget();
}
/**
* @see org.eclipse.cdt.debug.core.cdi.model.ICDIObject#getId()
*/
public String getId() {
return null;
}
/**
* @see org.eclipse.cdt.debug.core.cdi.model.ICDIObject#getParent()
*/
public ICDIObject getParent() {
return null;
}
}

View file

@ -0,0 +1,39 @@
package org.eclipse.cdt.debug.mi.core.cdi;
import org.eclipse.cdt.debug.core.cdi.event.ICDISteppingEvent;
import org.eclipse.cdt.debug.core.cdi.model.ICDIObject;
import org.eclipse.cdt.debug.mi.core.event.MIEvent;
/**
* @author alain
*
* To change this generated comment edit the template variable "typecomment":
* Window>Preferences>Java>Templates.
* To enable and disable the creation of type comments go to
* Window>Preferences>Java>Code Generation.
*/
public class SteppingEvent implements ICDISteppingEvent {
CSession session;
MIEvent event;
public SteppingEvent(CSession s, MIEvent e) {
session = s;
event = e;
}
/**
* @see org.eclipse.cdt.debug.core.cdi.event.ICDISteppingEvent#getType()
*/
public int getType() {
return 0;
}
/**
* @see org.eclipse.cdt.debug.core.cdi.event.ICDIEvent#getSource()
*/
public ICDIObject getSource() {
return session.getTarget();
}
}

View file

@ -1,52 +1,73 @@
package org.eclipse.cdt.debug.mi.core.cdi;
import org.eclipse.cdt.debug.core.cdi.ICDILocation;
import org.eclipse.cdt.debug.core.cdi.CDIException;
import org.eclipse.cdt.debug.core.cdi.ICDIBreakpoint;
import org.eclipse.cdt.debug.core.cdi.ICDIBreakpointManager;
import org.eclipse.cdt.debug.core.cdi.ICDISessionObject;
import org.eclipse.cdt.debug.core.cdi.event.ICDIEvent;
import org.eclipse.cdt.debug.core.cdi.event.ICDISuspendedEvent;
import org.eclipse.cdt.debug.core.cdi.model.ICDIArgument;
import org.eclipse.cdt.debug.core.cdi.model.ICDIObject;
import org.eclipse.cdt.debug.core.cdi.model.ICDIStackFrame;
import org.eclipse.cdt.debug.core.cdi.model.ICDITarget;
import org.eclipse.cdt.debug.core.cdi.model.ICDIVariable;
import org.eclipse.cdt.debug.mi.core.event.MIBreakpointEvent;
import org.eclipse.cdt.debug.mi.core.event.MIEvent;
import org.eclipse.cdt.debug.mi.core.event.MIExitEvent;
import org.eclipse.cdt.debug.mi.core.event.MIFunctionFinishedEvent;
import org.eclipse.cdt.debug.mi.core.event.MILocationReachedEvent;
import org.eclipse.cdt.debug.mi.core.event.MISignalEvent;
import org.eclipse.cdt.debug.mi.core.event.MIStepEvent;
import org.eclipse.cdt.debug.mi.core.event.MIWatchpointEvent;
import org.eclipse.cdt.debug.mi.core.output.MIBreakPoint;
/**
* @author alain
*
* To change this generated comment edit the template variable "typecomment":
* Window>Preferences>Java>Templates.
* To enable and disable the creation of type comments go to
* Window>Preferences>Java>Code Generation.
*/
public class SuspendedEvent implements ICDISuspendedEvent {
MIBreakpointEvent event;
MIEvent event;
CSession session;
public SuspendedEvent(CSession s, MIBreakpointEvent e) {
public SuspendedEvent(CSession s, MIEvent e) {
session = s;
event = e;
}
public ICDISessionObject getReason() {
return new SessionObject(session);
}
public ICDIStackFrame getStackFrame() {
return new StackFrame(session, event.getMIFrame());
if (event instanceof MIBreakpointEvent) {
MIBreakpointEvent breakEvent = (MIBreakpointEvent)event;
int number = breakEvent.getNumber();
ICDIBreakpointManager mgr = session.getBreakpointManager();
try {
ICDIBreakpoint[] bkpts= mgr.getBreakpoints();
for (int i = 0; i < bkpts.length; i++) {
if (bkpts[i] instanceof Breakpoint) {
Breakpoint point = (Breakpoint)bkpts[i];
MIBreakPoint miBreak = point.getMIBreakPoint();
if (miBreak.getNumber() == number) {
return point;
}
}
}
} catch (CDIException e) {
}
} else if (event instanceof MIStepEvent) {
return new EndSteppingRange(session);
}
return session;
}
/**
* @see org.eclipse.cdt.debug.core.cdi.event.ICDIEvent#getSource()
*/
public ICDIObject getSource() {
return new CThread(session.getCTarget(), "");
}
/**
* @see org.eclipse.cdt.debug.core.cdi.event.ICDISuspendedEvent#getStackFrame()
*/
public ICDIStackFrame getStackFrame() {
if (event instanceof MIBreakpointEvent) {
MIBreakpointEvent breakEvent = (MIBreakpointEvent)event;
return new StackFrame(session.getCTarget(), breakEvent.getMIFrame());
} else if (event instanceof MIStepEvent) {
MIStepEvent stepEvent = (MIStepEvent)event;
return new StackFrame(session.getCTarget(), stepEvent.getMIFrame());
}
return null;
}

View file

@ -14,11 +14,12 @@ import org.eclipse.cdt.debug.core.cdi.model.ICDIVariable;
* To enable and disable the creation of type comments go to
* Window>Preferences>Java>Code Generation.
*/
public class Value implements ICDIValue {
public class Value extends CObject implements ICDIValue {
String val = "";
public Value(String s) {
public Value(CTarget target, String s) {
super(target);
val = s;
}
@ -43,24 +44,4 @@ public class Value implements ICDIValue {
return new ICDIVariable[0];
}
/**
* @see org.eclipse.cdt.debug.core.cdi.model.ICDIObject#getCDITarget()
*/
public ICDITarget getCDITarget() {
return null;
}
/**
* @see org.eclipse.cdt.debug.core.cdi.model.ICDIObject#getId()
*/
public String getId() {
return null;
}
/**
* @see org.eclipse.cdt.debug.core.cdi.model.ICDIObject#getParent()
*/
public ICDIObject getParent() {
return null;
}
}

View file

@ -15,11 +15,12 @@ import org.eclipse.cdt.debug.mi.core.output.MIArg;
* To enable and disable the creation of type comments go to
* Window>Preferences>Java>Code Generation.
*/
public class Variable implements ICDIVariable {
public class Variable extends CObject implements ICDIVariable {
MIArg arg;
public Variable(MIArg a) {
public Variable(CTarget target, MIArg a) {
super(target);
arg = a;
}
/**
@ -62,25 +63,4 @@ public class Variable implements ICDIVariable {
public void setValue(String expression) throws CDIException {
}
/**
* @see org.eclipse.cdt.debug.core.cdi.model.ICDIObject#getCDITarget()
*/
public ICDITarget getCDITarget() {
return null;
}
/**
* @see org.eclipse.cdt.debug.core.cdi.model.ICDIObject#getId()
*/
public String getId() {
return null;
}
/**
* @see org.eclipse.cdt.debug.core.cdi.model.ICDIObject#getParent()
*/
public ICDIObject getParent() {
return null;
}
}

View file

@ -178,6 +178,10 @@ public class CommandFactory {
return new MIStackListArguments(showValue, lowFrame, highFrame);
}
public MIStackListFrames createMIStackListFrames() {
return new MIStackListFrames();
}
public MIStackListFrames createMIStackListFrames(int lowFrame, int highFrame) {
return new MIStackListFrames(lowFrame, highFrame);
}

View file

@ -26,6 +26,10 @@ public class MIDataEvaluateExpression extends MICommand
super("-data-evaluate-expression", new String[]{expr});
}
public MIDataEvaluateExpressionInfo getMIDataEvaluateExpressionInfo() throws MIException {
return (MIDataEvaluateExpressionInfo)getMIInfo();
}
public MIInfo getMIInfo() throws MIException {
MIInfo info = null;
MIOutput out = getMIOutput();

View file

@ -51,6 +51,10 @@ public class MIStackListFrames extends MICommand
Integer.toString(high)});
}
public MIStackListFramesInfo getMIStackListFramesInfo() throws MIException {
return (MIStackListFramesInfo)getMIInfo();
}
public MIInfo getMIInfo() throws MIException {
MIInfo info = null;
MIOutput out = getMIOutput();

View file

@ -31,7 +31,7 @@ public class MIBreakpointEvent extends MIEvent {
parse();
}
public int getBreakNumber() {
public int getNumber() {
return bkptno;
}

View file

@ -0,0 +1,34 @@
package org.eclipse.cdt.debug.mi.core.event;
import org.eclipse.cdt.debug.mi.core.output.MIConst;
import org.eclipse.cdt.debug.mi.core.output.MIExecAsyncOutput;
import org.eclipse.cdt.debug.mi.core.output.MIFrame;
import org.eclipse.cdt.debug.mi.core.output.MIResult;
import org.eclipse.cdt.debug.mi.core.output.MIResultRecord;
import org.eclipse.cdt.debug.mi.core.output.MITuple;
import org.eclipse.cdt.debug.mi.core.output.MIValue;
/**
*
* ^running
*/
public class MIRunningEvent extends MIEvent {
boolean isStep;
public MIRunningEvent() {
this(false);
}
public MIRunningEvent(boolean step) {
isStep = step;
}
public boolean isStepping() {
return isStep;
}
public String toString() {
return "Running";
}
}

View file

@ -34,7 +34,7 @@ public class MIStepEvent extends MIEvent {
return threadId;
}
public MIFrame getFrame() {
public MIFrame getMIFrame() {
return frame;
}

View file

@ -19,7 +19,7 @@ public class MIStackListFramesInfo extends MIInfo {
super(out);
}
public MIFrame[] getFrames() {
public MIFrame[] getMIFrames() {
if (frames == null) {
parse();
}