mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-23 22:52:11 +02:00
More Events are pass to the CDI layer.
This commit is contained in:
parent
1a362a1398
commit
8b52ecdb22
23 changed files with 381 additions and 216 deletions
|
@ -95,7 +95,11 @@ public class MIPlugin extends Plugin {
|
|||
public static void debugLog(String message) {
|
||||
// if ( getDefault().isDebugging() ) {
|
||||
// getDefault().getLog().log(StatusUtil.newStatus(Status.ERROR, message, null));
|
||||
System.err.println(message);
|
||||
if (message.endsWith("\n")) {
|
||||
System.err.print(message);
|
||||
} else {
|
||||
System.err.println(message);
|
||||
}
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,6 +12,7 @@ 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.MIExecFinish;
|
||||
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;
|
||||
|
@ -23,9 +24,10 @@ 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.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.MISteppingRangeEvent;
|
||||
import org.eclipse.cdt.debug.mi.core.event.MIWatchpointEvent;
|
||||
import org.eclipse.cdt.debug.mi.core.output.MIAsyncRecord;
|
||||
import org.eclipse.cdt.debug.mi.core.output.MIConsoleStreamOutput;
|
||||
|
@ -115,22 +117,27 @@ MIPlugin.getDefault().debugLog(line);
|
|||
// Check if the state changed.
|
||||
String state = rr.getResultClass();
|
||||
if ("running".equals(state)) {
|
||||
MIEvent[] events = new MIEvent[1];
|
||||
int type = 0;
|
||||
// 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);
|
||||
if (cmd instanceof MIExecNext) {
|
||||
type = MIRunningEvent.NEXT;
|
||||
} else if (cmd instanceof MIExecNextInstruction) {
|
||||
type = MIRunningEvent.NEXTI;
|
||||
} else if (cmd instanceof MIExecStep) {
|
||||
type = MIRunningEvent.STEP;
|
||||
} else if (cmd instanceof MIExecStepInstruction) {
|
||||
type = MIRunningEvent.STEPI;
|
||||
} else if (cmd instanceof MIExecUntil) {
|
||||
type = MIRunningEvent.UNTIL;
|
||||
} else if (cmd instanceof MIExecFinish) {
|
||||
type = MIRunningEvent.FINISH;
|
||||
} else {
|
||||
session.getMIProcess().setRunning();
|
||||
events[0] = new MIRunningEvent();
|
||||
type = MIRunningEvent.CONTINUE;
|
||||
}
|
||||
Thread eventTread = new EventThread(session, events);
|
||||
eventTread.start();
|
||||
session.getMIProcess().setRunning();
|
||||
MIEvent event = new MIRunningEvent(type);
|
||||
fireEvents(new MIEvent[]{event});
|
||||
} else if ("exit".equals(state)) {
|
||||
session.getMIProcess().setTerminated();
|
||||
}
|
||||
|
@ -155,10 +162,7 @@ MIPlugin.getDefault().debugLog(line);
|
|||
}
|
||||
|
||||
MIEvent[] events = (MIEvent[])list.toArray(new MIEvent[list.size()]);
|
||||
if (events.length > 0) {
|
||||
Thread eventTread = new EventThread(session, events);
|
||||
eventTread.start();
|
||||
}
|
||||
fireEvents(events);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -291,9 +295,9 @@ MIPlugin.getDefault().debugLog(line);
|
|||
}
|
||||
} else if ("end-stepping-range".equals(reason)) {
|
||||
if (exec != null) {
|
||||
event = new MIStepEvent(exec);
|
||||
event = new MISteppingRangeEvent(exec);
|
||||
} else if (rr != null) {
|
||||
event = new MIStepEvent(rr);
|
||||
event = new MISteppingRangeEvent(rr);
|
||||
}
|
||||
} else if ("signal-received".equals(reason)) {
|
||||
if (exec != null) {
|
||||
|
@ -303,9 +307,9 @@ MIPlugin.getDefault().debugLog(line);
|
|||
}
|
||||
} else if ("location-reached".equals(reason)) {
|
||||
if (exec != null) {
|
||||
event = new MISignalEvent(exec);
|
||||
event = new MILocationReachedEvent(exec);
|
||||
} else if (rr != null) {
|
||||
event = new MISignalEvent(rr);
|
||||
event = new MILocationReachedEvent(rr);
|
||||
}
|
||||
} else if ("function-finished".equals(reason)) {
|
||||
if (exec != null) {
|
||||
|
@ -322,4 +326,11 @@ MIPlugin.getDefault().debugLog(line);
|
|||
}
|
||||
return event;
|
||||
}
|
||||
|
||||
public void fireEvents(MIEvent[] events) {
|
||||
if (events.length > 0) {
|
||||
Thread eventTread = new EventThread(session, events);
|
||||
eventTread.start();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,25 +1,14 @@
|
|||
package org.eclipse.cdt.debug.mi.core.cdi;
|
||||
|
||||
import org.eclipse.cdt.debug.core.cdi.CDIException;
|
||||
import org.eclipse.cdt.debug.core.cdi.ICDICatchEvent;
|
||||
import org.eclipse.cdt.debug.core.cdi.ICDICatchpoint;
|
||||
import org.eclipse.cdt.debug.core.cdi.ICDICondition;
|
||||
import org.eclipse.cdt.debug.core.cdi.ICDILocation;
|
||||
import org.eclipse.cdt.debug.core.cdi.ICDILocationBreakpoint;
|
||||
import org.eclipse.cdt.debug.core.cdi.ICDIWatchpoint;
|
||||
import org.eclipse.cdt.debug.core.cdi.model.ICDIInstruction;
|
||||
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 Breakpoint extends SessionObject implements ICDILocationBreakpoint,
|
||||
ICDICatchpoint, ICDIWatchpoint {
|
||||
public class Breakpoint extends SessionObject implements ICDILocationBreakpoint {
|
||||
|
||||
ICDILocation location;
|
||||
ICDICondition condition;
|
||||
|
@ -33,7 +22,7 @@ public class Breakpoint extends SessionObject implements ICDILocationBreakpoint,
|
|||
}
|
||||
|
||||
MIBreakPoint getMIBreakPoint() {
|
||||
return miBreakPoint;
|
||||
return miBreakPoint;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -41,20 +30,8 @@ public class Breakpoint extends SessionObject implements ICDILocationBreakpoint,
|
|||
*/
|
||||
public ICDICondition getCondition() throws CDIException {
|
||||
if (condition == null) {
|
||||
condition = new ICDICondition () {
|
||||
/**
|
||||
* @see org.eclipse.cdt.debug.core.cdi.ICDICondition#getIgnoreCount()
|
||||
*/
|
||||
public int getIgnoreCount() {
|
||||
return miBreakPoint.getIgnoreCount();
|
||||
}
|
||||
/**
|
||||
* @see org.eclipse.cdt.debug.core.cdi.ICDICondition#getExpression()
|
||||
*/
|
||||
public String getExpression() {
|
||||
return miBreakPoint.getWhat();
|
||||
}
|
||||
};
|
||||
condition = new Condition(miBreakPoint.getIgnoreCount(),
|
||||
miBreakPoint.getWhat());
|
||||
}
|
||||
return condition;
|
||||
}
|
||||
|
@ -110,77 +87,11 @@ public class Breakpoint extends SessionObject implements ICDILocationBreakpoint,
|
|||
*/
|
||||
public ICDILocation getLocation() throws CDIException {
|
||||
if (location == null) {
|
||||
location = new ICDILocation () {
|
||||
/**
|
||||
* @see org.eclipse.cdt.debug.core.cdi.ICDILocation#getAddress()
|
||||
*/
|
||||
public long getAddress() {
|
||||
return miBreakPoint.getAddress();
|
||||
}
|
||||
/**
|
||||
* @see org.eclipse.cdt.debug.core.cdi.ICDILocation#getFile()
|
||||
*/
|
||||
public String getFile() {
|
||||
return miBreakPoint.getFile();
|
||||
}
|
||||
/**
|
||||
* @see org.eclipse.cdt.debug.core.cdi.ICDILocation#getFunction()
|
||||
*/
|
||||
public String getFunction() {
|
||||
return miBreakPoint.getFunction();
|
||||
}
|
||||
/**
|
||||
* @see org.eclipse.cdt.debug.core.cdi.ICDILocation#getLineNumber()
|
||||
*/
|
||||
public int getLineNumber() {
|
||||
return miBreakPoint.getLine();
|
||||
}
|
||||
/**
|
||||
* @see org.eclipse.cdt.debug.core.cdi.ICDILocation#getInstructions(int)
|
||||
*/
|
||||
public ICDIInstruction[] getInstructions(int maxCount)
|
||||
throws CDIException {
|
||||
return new ICDIInstruction[0];
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.eclipse.cdt.debug.core.cdi.ICDILocation#getInstructions()
|
||||
*/
|
||||
public ICDIInstruction[] getInstructions() throws CDIException {
|
||||
return new ICDIInstruction[0];
|
||||
}
|
||||
|
||||
};
|
||||
location = new Location (miBreakPoint.getFile(),
|
||||
miBreakPoint.getFunction(),
|
||||
miBreakPoint.getLine(),
|
||||
miBreakPoint.getAddress());
|
||||
}
|
||||
return location;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.eclipse.cdt.debug.core.cdi.ICDICatchpoint#getEvent()
|
||||
*/
|
||||
public ICDICatchEvent getEvent() throws CDIException {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.eclipse.cdt.debug.core.cdi.ICDIWatchpoint#getWatchExpression()
|
||||
*/
|
||||
public String getWatchExpression() throws CDIException {
|
||||
return miBreakPoint.getWhat();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.eclipse.cdt.debug.core.cdi.ICDIWatchpoint#isReadType()
|
||||
*/
|
||||
public boolean isReadType() {
|
||||
return miBreakPoint.isReadWatchpoint();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.eclipse.cdt.debug.core.cdi.ICDIWatchpoint#isWriteType()
|
||||
*/
|
||||
public boolean isWriteType() {
|
||||
return miBreakPoint.isAccessWatchpoint();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -224,7 +224,7 @@ public class BreakpointManager extends SessionObject implements ICDIBreakpointMa
|
|||
throw new CDIException(e.toString());
|
||||
}
|
||||
|
||||
Breakpoint bkpt= new Breakpoint(this, points[0]);
|
||||
Watchpoint bkpt= new Watchpoint(this, points[0]);
|
||||
breakList.add(bkpt);
|
||||
return bkpt;
|
||||
}
|
||||
|
|
|
@ -5,15 +5,13 @@
|
|||
*/
|
||||
package org.eclipse.cdt.debug.mi.core.cdi;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
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;
|
||||
import org.eclipse.cdt.debug.core.cdi.model.ICDIObject;
|
||||
import org.eclipse.cdt.debug.core.cdi.model.ICDIRegisterGroup;
|
||||
import org.eclipse.cdt.debug.core.cdi.model.ICDISharedLibrary;
|
||||
import org.eclipse.cdt.debug.core.cdi.model.ICDITarget;
|
||||
|
@ -36,25 +34,33 @@ import org.eclipse.cdt.debug.mi.core.output.MIDataEvaluateExpressionInfo;
|
|||
import org.eclipse.cdt.debug.mi.core.output.MIInfo;
|
||||
|
||||
/**
|
||||
* @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 CTarget implements ICDITarget {
|
||||
|
||||
List threadList;
|
||||
CSession session;
|
||||
|
||||
public CTarget(CSession s) {
|
||||
session = s;
|
||||
threadList = new ArrayList(1);
|
||||
}
|
||||
|
||||
CSession getCSession() {
|
||||
return session;
|
||||
}
|
||||
|
||||
void addCThread(CThread cthread) {
|
||||
threadList.add(cthread);
|
||||
}
|
||||
|
||||
void removeCThread(CThread cthread) {
|
||||
threadList.remove(cthread);
|
||||
}
|
||||
|
||||
CThread[] getCThreads() {
|
||||
return (CThread[])threadList.toArray(new CThread[threadList.size()]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.eclipse.cdt.debug.core.cdi.model.ICDITarget#disconnect()
|
||||
*/
|
||||
|
|
|
@ -20,13 +20,21 @@ import org.eclipse.cdt.debug.mi.core.output.MIStackListFramesInfo;
|
|||
*/
|
||||
public class CThread extends CObject implements ICDIThread {
|
||||
|
||||
String id = "";
|
||||
int id = 0;
|
||||
|
||||
public CThread(CTarget target, String threadId) {
|
||||
public CThread(CTarget target, int threadId) {
|
||||
super(target);
|
||||
id = threadId;
|
||||
}
|
||||
|
||||
int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return "thread-" + Integer.toString(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.eclipse.cdt.debug.core.cdi.model.ICDIThread#finish()
|
||||
*/
|
||||
|
@ -58,13 +66,14 @@ public class CThread extends CObject implements ICDIThread {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* @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()
|
||||
*/
|
||||
|
|
|
@ -0,0 +1,22 @@
|
|||
package org.eclipse.cdt.debug.mi.core.cdi;
|
||||
|
||||
import org.eclipse.cdt.debug.core.cdi.CDIException;
|
||||
import org.eclipse.cdt.debug.core.cdi.ICDICatchEvent;
|
||||
import org.eclipse.cdt.debug.core.cdi.ICDICatchpoint;
|
||||
import org.eclipse.cdt.debug.mi.core.output.MIBreakPoint;
|
||||
|
||||
/**
|
||||
*/
|
||||
public class Catchpoint extends Breakpoint implements ICDICatchpoint {
|
||||
|
||||
public Catchpoint(BreakpointManager m, MIBreakPoint miBreak) {
|
||||
super(m, miBreak);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.eclipse.cdt.debug.core.cdi.ICDICatchpoint#getEvent()
|
||||
*/
|
||||
public ICDICatchEvent getEvent() throws CDIException {
|
||||
return null;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,30 @@
|
|||
package org.eclipse.cdt.debug.mi.core.cdi;
|
||||
|
||||
import org.eclipse.cdt.debug.core.cdi.ICDICondition;
|
||||
|
||||
/**
|
||||
*/
|
||||
public class Condition implements ICDICondition {
|
||||
|
||||
int ignoreCount;
|
||||
String expression;
|
||||
|
||||
public Condition(int ignore, String exp) {
|
||||
ignoreCount = ignore;
|
||||
expression = exp;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.eclipse.cdt.debug.core.cdi.ICDICondition#getIgnoreCount()
|
||||
*/
|
||||
public int getIgnoreCount() {
|
||||
return ignoreCount;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.eclipse.cdt.debug.core.cdi.ICDICondition#getExpression()
|
||||
*/
|
||||
public String getExpression() {
|
||||
return expression;
|
||||
}
|
||||
}
|
|
@ -1,8 +1,8 @@
|
|||
package org.eclipse.cdt.debug.mi.core.cdi;
|
||||
|
||||
import org.eclipse.cdt.debug.core.cdi.event.ICDISteppingEvent;
|
||||
import org.eclipse.cdt.debug.core.cdi.event.ICDIDestroyedEvent;
|
||||
import org.eclipse.cdt.debug.core.cdi.model.ICDIObject;
|
||||
import org.eclipse.cdt.debug.mi.core.event.MIEvent;
|
||||
import org.eclipse.cdt.debug.mi.core.event.MIExitEvent;
|
||||
|
||||
/**
|
||||
* @author alain
|
||||
|
@ -12,28 +12,21 @@ import org.eclipse.cdt.debug.mi.core.event.MIEvent;
|
|||
* To enable and disable the creation of type comments go to
|
||||
* Window>Preferences>Java>Code Generation.
|
||||
*/
|
||||
public class SteppingEvent implements ICDISteppingEvent {
|
||||
public class DestroyedEvent implements ICDIDestroyedEvent {
|
||||
|
||||
MIExitEvent event;
|
||||
CSession session;
|
||||
MIEvent event;
|
||||
|
||||
public SteppingEvent(CSession s, MIEvent e) {
|
||||
public DestroyedEvent(CSession s, MIExitEvent 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();
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
|
@ -3,12 +3,6 @@ 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 {
|
||||
|
||||
|
|
|
@ -9,37 +9,27 @@ 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.MISteppingRangeEvent;
|
||||
import org.eclipse.cdt.debug.mi.core.event.MIWatchpointEvent;
|
||||
|
||||
/**
|
||||
* @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 EventAdapter {
|
||||
|
||||
public static ICDIEvent getCDIEvent(CSession session, MIEvent miEvent) {
|
||||
if (miEvent instanceof MIBreakpointEvent) {
|
||||
if (miEvent instanceof MIBreakpointEvent
|
||||
|| miEvent instanceof MIFunctionFinishedEvent
|
||||
|| miEvent instanceof MILocationReachedEvent
|
||||
|| miEvent instanceof MISignalEvent
|
||||
|| miEvent instanceof MISteppingRangeEvent
|
||||
|| miEvent instanceof MIWatchpointEvent) {
|
||||
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 new ResumedEvent(session, (MIRunningEvent)miEvent);
|
||||
} else if (miEvent instanceof MIInferiorExitEvent) {
|
||||
return new ExitedEvent(session, (MIInferiorExitEvent)miEvent);
|
||||
} else if (miEvent instanceof MIExitEvent) {
|
||||
return new DestroyedEvent(session, (MIExitEvent)miEvent);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,20 @@
|
|||
package org.eclipse.cdt.debug.mi.core.cdi;
|
||||
|
||||
import org.eclipse.cdt.debug.core.cdi.ICDIExitInfo;
|
||||
|
||||
/**.
|
||||
*/
|
||||
public class ExitInfo extends SessionObject implements ICDIExitInfo {
|
||||
|
||||
public ExitInfo(CSession session) {
|
||||
super(session);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.eclipse.cdt.debug.core.cdi.ICDIExitInfo#getCode()
|
||||
*/
|
||||
public int getCode() {
|
||||
return getCSession().getCTarget().getProcess().exitValue();
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,40 @@
|
|||
package org.eclipse.cdt.debug.mi.core.cdi;
|
||||
|
||||
import org.eclipse.cdt.debug.core.cdi.ICDIExitInfo;
|
||||
import org.eclipse.cdt.debug.core.cdi.event.ICDIExitedEvent;
|
||||
import org.eclipse.cdt.debug.core.cdi.model.ICDIObject;
|
||||
import org.eclipse.cdt.debug.mi.core.event.MIInferiorExitEvent;
|
||||
|
||||
/**
|
||||
* @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 ExitedEvent implements ICDIExitedEvent {
|
||||
|
||||
MIInferiorExitEvent event;
|
||||
CSession session;
|
||||
|
||||
public ExitedEvent(CSession s, MIInferiorExitEvent e) {
|
||||
session = s;
|
||||
event = e;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.eclipse.cdt.debug.core.cdi.event.ICDIExitedEvent#getExitInfo()
|
||||
*/
|
||||
public ICDIExitInfo getExitInfo() {
|
||||
return new ExitInfo(session);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.eclipse.cdt.debug.core.cdi.event.ICDIEvent#getSource()
|
||||
*/
|
||||
public ICDIObject getSource() {
|
||||
return session.getTarget();
|
||||
}
|
||||
|
||||
}
|
|
@ -6,6 +6,7 @@
|
|||
package org.eclipse.cdt.debug.mi.core.cdi;
|
||||
|
||||
import org.eclipse.cdt.debug.core.cdi.CDIException;
|
||||
import org.eclipse.cdt.debug.core.cdi.ICDICondition;
|
||||
import org.eclipse.cdt.debug.core.cdi.ICDIExpressionManager;
|
||||
import org.eclipse.cdt.debug.core.cdi.ICDISession;
|
||||
import org.eclipse.cdt.debug.core.cdi.model.ICDIExpression;
|
||||
|
@ -60,4 +61,11 @@ public class ExpressionManager extends SessionObject implements ICDIExpressionMa
|
|||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.eclipse.cdt.debug.core.cdi.ICDIExpressionManager#createCondition(int, String)
|
||||
*/
|
||||
public ICDICondition createCondition(int ignoreCount, String expression) {
|
||||
return new Condition(ignoreCount, expression);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -19,6 +19,10 @@ public class Location implements ICDILocation {
|
|||
String function = "";
|
||||
int line;
|
||||
|
||||
public Location(String f, String fnct, int l) {
|
||||
this(f, fnct, l, 0);
|
||||
}
|
||||
|
||||
public Location(String f, String fnct, int l, long a) {
|
||||
file = f;
|
||||
function = fnct;
|
||||
|
|
|
@ -3,21 +3,16 @@ 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;
|
||||
import org.eclipse.cdt.debug.mi.core.event.MIRunningEvent;
|
||||
|
||||
/**
|
||||
* @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;
|
||||
MIRunningEvent event;
|
||||
|
||||
public ResumedEvent(CSession s, MIEvent e) {
|
||||
public ResumedEvent(CSession s, MIRunningEvent e) {
|
||||
session = s;
|
||||
event = e;
|
||||
}
|
||||
|
@ -29,4 +24,12 @@ public class ResumedEvent implements ICDIResumedEvent {
|
|||
return session.getTarget();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.eclipse.cdt.debug.core.cdi.event.ICDIResumedEvent#getType()
|
||||
*/
|
||||
public int getType() {
|
||||
MIRunningEvent running = (MIRunningEvent)event;
|
||||
return running.getType();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,36 @@
|
|||
package org.eclipse.cdt.debug.mi.core.cdi;
|
||||
|
||||
import org.eclipse.cdt.debug.core.cdi.ICDISignal;
|
||||
import org.eclipse.cdt.debug.mi.core.event.MISignalEvent;
|
||||
|
||||
/**
|
||||
* @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 Signal extends SessionObject implements ICDISignal {
|
||||
|
||||
MISignalEvent event;
|
||||
public Signal(CSession session, MISignalEvent e) {
|
||||
super(session);
|
||||
event = e;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.eclipse.cdt.debug.core.cdi.ICDISignal#getMeaning()
|
||||
*/
|
||||
public String getMeaning() {
|
||||
return event.getMeaning();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.eclipse.cdt.debug.core.cdi.ICDISignal#getName()
|
||||
*/
|
||||
public String getName() {
|
||||
return event.getName();
|
||||
}
|
||||
|
||||
}
|
|
@ -8,6 +8,7 @@ package org.eclipse.cdt.debug.mi.core.cdi;
|
|||
import java.io.File;
|
||||
|
||||
import org.eclipse.cdt.debug.core.cdi.CDIException;
|
||||
import org.eclipse.cdt.debug.core.cdi.ICDILocation;
|
||||
import org.eclipse.cdt.debug.core.cdi.ICDISession;
|
||||
import org.eclipse.cdt.debug.core.cdi.ICDISourceManager;
|
||||
|
||||
|
@ -44,4 +45,11 @@ public class SourceManager extends SessionObject implements ICDISourceManager {
|
|||
public void set(File[] directories) throws CDIException {
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.eclipse.cdt.debug.core.cdi.ICDISourceManager#createLocation(String, String, int)
|
||||
*/
|
||||
public ICDILocation createLocation(String file, String function, int line) {
|
||||
return new Location(file, function, line);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -6,10 +6,13 @@ import org.eclipse.cdt.debug.core.cdi.ICDIBreakpointManager;
|
|||
import org.eclipse.cdt.debug.core.cdi.ICDISessionObject;
|
||||
import org.eclipse.cdt.debug.core.cdi.event.ICDISuspendedEvent;
|
||||
import org.eclipse.cdt.debug.core.cdi.model.ICDIObject;
|
||||
import org.eclipse.cdt.debug.core.cdi.model.ICDIStackFrame;
|
||||
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.MIStepEvent;
|
||||
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.MISteppingRangeEvent;
|
||||
import org.eclipse.cdt.debug.mi.core.event.MIWatchpointEvent;
|
||||
import org.eclipse.cdt.debug.mi.core.output.MIBreakPoint;
|
||||
|
||||
/**
|
||||
|
@ -24,13 +27,14 @@ public class SuspendedEvent implements ICDISuspendedEvent {
|
|||
session = s;
|
||||
event = e;
|
||||
}
|
||||
|
||||
|
||||
public ICDISessionObject getReason() {
|
||||
if (event instanceof MIBreakpointEvent) {
|
||||
if (event instanceof MIBreakpointEvent || event instanceof MIWatchpointEvent) {
|
||||
MIBreakpointEvent breakEvent = (MIBreakpointEvent)event;
|
||||
int number = breakEvent.getNumber();
|
||||
ICDIBreakpointManager mgr = session.getBreakpointManager();
|
||||
// Ask the breakpoint manager the array of ICDIBreakpoint(s)
|
||||
// We need to return the same object as the reason.
|
||||
try {
|
||||
ICDIBreakpoint[] bkpts= mgr.getBreakpoints();
|
||||
for (int i = 0; i < bkpts.length; i++) {
|
||||
|
@ -44,7 +48,13 @@ public class SuspendedEvent implements ICDISuspendedEvent {
|
|||
}
|
||||
} catch (CDIException e) {
|
||||
}
|
||||
} else if (event instanceof MIStepEvent) {
|
||||
} else if (event instanceof MISteppingRangeEvent) {
|
||||
return new EndSteppingRange(session);
|
||||
} else if (event instanceof MISignalEvent) {
|
||||
return new Signal(session, (MISignalEvent)event);
|
||||
} else if (event instanceof MILocationReachedEvent) {
|
||||
return new EndSteppingRange(session);
|
||||
} else if (event instanceof MIFunctionFinishedEvent) {
|
||||
return new EndSteppingRange(session);
|
||||
}
|
||||
return session;
|
||||
|
@ -54,21 +64,41 @@ public class SuspendedEvent implements ICDISuspendedEvent {
|
|||
* @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() {
|
||||
CTarget target = session.getCTarget();
|
||||
int threadId = 0;
|
||||
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());
|
||||
threadId = breakEvent.getThreadId();
|
||||
} else if (event instanceof MIWatchpointEvent) {
|
||||
MIWatchpointEvent watchEvent = (MIWatchpointEvent)event;
|
||||
threadId = watchEvent.getThreadId();
|
||||
} else if (event instanceof MISteppingRangeEvent) {
|
||||
MISteppingRangeEvent rangeEvent = (MISteppingRangeEvent)event;
|
||||
threadId = rangeEvent.getThreadId();
|
||||
} else if (event instanceof MISignalEvent) {
|
||||
MISignalEvent sigEvent = (MISignalEvent)event;
|
||||
threadId = sigEvent.getThreadId();
|
||||
} else if (event instanceof MILocationReachedEvent) {
|
||||
MILocationReachedEvent locEvent = (MILocationReachedEvent)event;
|
||||
threadId = locEvent.getThreadId();
|
||||
} else if (event instanceof MIFunctionFinishedEvent) {
|
||||
MIFunctionFinishedEvent funcEvent = (MIFunctionFinishedEvent)event;
|
||||
threadId = funcEvent.getThreadId();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
// If it came from a thread return it as the source.
|
||||
if (threadId > 0) {
|
||||
CThread[] cthreads = target.getCThreads();
|
||||
for (int i = 0; i < cthreads.length; i++) {
|
||||
if (cthreads[i].getId() == threadId) {
|
||||
return cthreads[i];
|
||||
}
|
||||
}
|
||||
// Not found?? new thread created?
|
||||
CThread cthread = new CThread(session.getCTarget(), threadId);
|
||||
target.addCThread(cthread);
|
||||
return cthread;
|
||||
}
|
||||
return target;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,42 @@
|
|||
package org.eclipse.cdt.debug.mi.core.cdi;
|
||||
|
||||
import org.eclipse.cdt.debug.core.cdi.CDIException;
|
||||
import org.eclipse.cdt.debug.core.cdi.ICDIWatchpoint;
|
||||
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 Watchpoint extends Breakpoint implements ICDIWatchpoint {
|
||||
|
||||
public Watchpoint(BreakpointManager m, MIBreakPoint miBreak) {
|
||||
super(m, miBreak);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.eclipse.cdt.debug.core.cdi.ICDIWatchpoint#getWatchExpression()
|
||||
*/
|
||||
public String getWatchExpression() throws CDIException {
|
||||
return getMIBreakPoint().getWhat();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.eclipse.cdt.debug.core.cdi.ICDIWatchpoint#isReadType()
|
||||
*/
|
||||
public boolean isReadType() {
|
||||
return getMIBreakPoint().isReadWatchpoint();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.eclipse.cdt.debug.core.cdi.ICDIWatchpoint#isWriteType()
|
||||
*/
|
||||
public boolean isWriteType() {
|
||||
return getMIBreakPoint().isAccessWatchpoint();
|
||||
}
|
||||
|
||||
}
|
|
@ -14,18 +14,22 @@ import org.eclipse.cdt.debug.mi.core.output.MIValue;
|
|||
*/
|
||||
public class MIRunningEvent extends MIEvent {
|
||||
|
||||
boolean isStep;
|
||||
public static final int CONTINUE = 1;
|
||||
public static final int NEXT = 1;
|
||||
public static final int NEXTI = 2;
|
||||
public static final int STEP = 3;
|
||||
public static final int STEPI = 4;
|
||||
public static final int FINISH = 5;
|
||||
public static final int UNTIL = 6;
|
||||
|
||||
public MIRunningEvent() {
|
||||
this(false);
|
||||
int type;
|
||||
|
||||
public MIRunningEvent(int t) {
|
||||
type = t;
|
||||
}
|
||||
|
||||
public MIRunningEvent(boolean step) {
|
||||
isStep = step;
|
||||
}
|
||||
|
||||
public boolean isStepping() {
|
||||
return isStep;
|
||||
public int getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
|
|
|
@ -32,11 +32,11 @@ public class MISignalEvent extends MIEvent {
|
|||
parse();
|
||||
}
|
||||
|
||||
public String getSignalName() {
|
||||
public String getName() {
|
||||
return sigName;
|
||||
}
|
||||
|
||||
public String getSignalMeaning() {
|
||||
public String getMeaning() {
|
||||
return sigMeaning;
|
||||
}
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ import org.eclipse.cdt.debug.mi.core.output.MIValue;
|
|||
*
|
||||
* *stopped,reason="end-stepping-range",thread-id="0",frame={addr="0x08048538",func="main",args=[{name="argc",value="1"},{name="argv",value="0xbffff18c"}],file="hello.c",line="13"}
|
||||
*/
|
||||
public class MIStepEvent extends MIEvent {
|
||||
public class MISteppingRangeEvent extends MIEvent {
|
||||
|
||||
int threadId;
|
||||
MIFrame frame;
|
||||
|
@ -20,12 +20,12 @@ public class MIStepEvent extends MIEvent {
|
|||
MIExecAsyncOutput exec;
|
||||
MIResultRecord rr;
|
||||
|
||||
public MIStepEvent(MIExecAsyncOutput record) {
|
||||
public MISteppingRangeEvent(MIExecAsyncOutput record) {
|
||||
exec = record;
|
||||
parse();
|
||||
}
|
||||
|
||||
public MIStepEvent(MIResultRecord record) {
|
||||
public MISteppingRangeEvent(MIResultRecord record) {
|
||||
rr = record;
|
||||
parse();
|
||||
}
|
Loading…
Add table
Reference in a new issue