mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
BreakPoint changed to Breakpoint
This commit is contained in:
parent
51bb0fb29c
commit
b8e4508478
19 changed files with 152 additions and 117 deletions
|
@ -6,7 +6,7 @@
|
|||
package org.eclipse.cdt.debug.mi.core;
|
||||
|
||||
import org.eclipse.cdt.debug.mi.core.command.CLICommand;
|
||||
import org.eclipse.cdt.debug.mi.core.event.MIBreakPointChangedEvent;
|
||||
import org.eclipse.cdt.debug.mi.core.event.MIBreakpointChangedEvent;
|
||||
import org.eclipse.cdt.debug.mi.core.event.MIEvent;
|
||||
import org.eclipse.cdt.debug.mi.core.event.MIRunningEvent;
|
||||
|
||||
|
@ -44,10 +44,12 @@ public class CLIProcessor {
|
|||
session.getMIInferior().setRunning();
|
||||
MIEvent event = new MIRunningEvent(cmd.getToken(), type);
|
||||
session.fireEvent(event);
|
||||
} else if (isSettingBreakpoint(operation)) {
|
||||
session.fireEvent(new MIBreakPointChangedEvent(0));
|
||||
} else if (isSettingWatchpoint(operation)) {
|
||||
} else if (isDeletingBreakpoint(operation)) {
|
||||
} else if (isSettingBreakpoint(operation) ||
|
||||
isSettingWatchpoint(operation) ||
|
||||
isDeletingBreakpoint(operation)) {
|
||||
// We know something change, we just do not know what.
|
||||
// So the easiest way is to let the top layer handle it.
|
||||
session.fireEvent(new MIBreakpointChangedEvent(0));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@ 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.MIBreakpointEvent;
|
||||
import org.eclipse.cdt.debug.mi.core.event.MIBreakpointHitEvent;
|
||||
import org.eclipse.cdt.debug.mi.core.event.MIErrorEvent;
|
||||
import org.eclipse.cdt.debug.mi.core.event.MIEvent;
|
||||
import org.eclipse.cdt.debug.mi.core.event.MIFunctionFinishedEvent;
|
||||
|
@ -324,9 +324,9 @@ public class RxThread extends Thread {
|
|||
MIEvent event = null;
|
||||
if ("breakpoint-hit".equals(reason)) {
|
||||
if (exec != null) {
|
||||
event = new MIBreakpointEvent(exec);
|
||||
event = new MIBreakpointHitEvent(exec);
|
||||
} else if (rr != null) {
|
||||
event = new MIBreakpointEvent(rr);
|
||||
event = new MIBreakpointHitEvent(rr);
|
||||
}
|
||||
session.getMIInferior().setSuspended();
|
||||
} else if ("watchpoint-trigger".equals(reason) ||
|
||||
|
|
|
@ -8,7 +8,7 @@ import org.eclipse.cdt.debug.core.cdi.CDIException;
|
|||
import org.eclipse.cdt.debug.core.cdi.ICDICondition;
|
||||
import org.eclipse.cdt.debug.core.cdi.ICDILocation;
|
||||
import org.eclipse.cdt.debug.core.cdi.model.ICDILocationBreakpoint;
|
||||
import org.eclipse.cdt.debug.mi.core.output.MIBreakPoint;
|
||||
import org.eclipse.cdt.debug.mi.core.output.MIBreakpoint;
|
||||
|
||||
/**
|
||||
*/
|
||||
|
@ -16,17 +16,17 @@ public class Breakpoint extends CObject implements ICDILocationBreakpoint {
|
|||
|
||||
ICDILocation location;
|
||||
ICDICondition condition;
|
||||
MIBreakPoint miBreakPoint;
|
||||
MIBreakpoint miBreakpoint;
|
||||
BreakpointManager mgr;
|
||||
|
||||
public Breakpoint(BreakpointManager m, MIBreakPoint miBreak) {
|
||||
public Breakpoint(BreakpointManager m, MIBreakpoint miBreak) {
|
||||
super(m.getCSession().getCTarget());
|
||||
miBreakPoint = miBreak;
|
||||
miBreakpoint = miBreak;
|
||||
mgr = m;
|
||||
}
|
||||
|
||||
MIBreakPoint getMIBreakPoint() {
|
||||
return miBreakPoint;
|
||||
MIBreakpoint getMIBreakpoint() {
|
||||
return miBreakpoint;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -34,8 +34,8 @@ public class Breakpoint extends CObject implements ICDILocationBreakpoint {
|
|||
*/
|
||||
public ICDICondition getCondition() throws CDIException {
|
||||
if (condition == null) {
|
||||
condition = new Condition(miBreakPoint.getIgnoreCount(),
|
||||
miBreakPoint.getWhat());
|
||||
condition = new Condition(miBreakpoint.getIgnoreCount(),
|
||||
miBreakpoint.getWhat());
|
||||
}
|
||||
return condition;
|
||||
}
|
||||
|
@ -44,28 +44,28 @@ public class Breakpoint extends CObject implements ICDILocationBreakpoint {
|
|||
* @see org.eclipse.cdt.debug.core.cdi.ICDIBreakpoint#getThreadId()
|
||||
*/
|
||||
public String getThreadId() throws CDIException {
|
||||
return miBreakPoint.getThreadId();
|
||||
return miBreakpoint.getThreadId();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.eclipse.cdt.debug.core.cdi.ICDIBreakpoint#isEnabled()
|
||||
*/
|
||||
public boolean isEnabled() throws CDIException {
|
||||
return miBreakPoint.isEnabled();
|
||||
return miBreakpoint.isEnabled();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.eclipse.cdt.debug.core.cdi.ICDIBreakpoint#isHardware()
|
||||
*/
|
||||
public boolean isHardware() {
|
||||
return miBreakPoint.isHardware();
|
||||
return miBreakpoint.isHardware();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.eclipse.cdt.debug.core.cdi.ICDIBreakpoint#isTemporary()
|
||||
*/
|
||||
public boolean isTemporary() {
|
||||
return miBreakPoint.isTemporary();
|
||||
return miBreakpoint.isTemporary();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -94,10 +94,10 @@ public class Breakpoint extends CObject implements ICDILocationBreakpoint {
|
|||
*/
|
||||
public ICDILocation getLocation() throws CDIException {
|
||||
if (location == null) {
|
||||
location = new Location (miBreakPoint.getFile(),
|
||||
miBreakPoint.getFunction(),
|
||||
miBreakPoint.getLine(),
|
||||
miBreakPoint.getAddress());
|
||||
location = new Location (miBreakpoint.getFile(),
|
||||
miBreakpoint.getFunction(),
|
||||
miBreakpoint.getLine(),
|
||||
miBreakpoint.getAddress());
|
||||
}
|
||||
return location;
|
||||
}
|
||||
|
|
|
@ -7,15 +7,15 @@ package org.eclipse.cdt.debug.mi.core.cdi;
|
|||
|
||||
import org.eclipse.cdt.debug.core.cdi.ICDIBreakpointHit;
|
||||
import org.eclipse.cdt.debug.core.cdi.model.ICDIBreakpoint;
|
||||
import org.eclipse.cdt.debug.mi.core.event.MIBreakpointEvent;
|
||||
import org.eclipse.cdt.debug.mi.core.event.MIBreakpointHitEvent;
|
||||
|
||||
/**
|
||||
*/
|
||||
public class BreakpointHit extends SessionObject implements ICDIBreakpointHit {
|
||||
|
||||
MIBreakpointEvent breakEvent;
|
||||
MIBreakpointHitEvent breakEvent;
|
||||
|
||||
public BreakpointHit(CSession session, MIBreakpointEvent e) {
|
||||
public BreakpointHit(CSession session, MIBreakpointHitEvent e) {
|
||||
super(session);
|
||||
breakEvent = e;
|
||||
}
|
||||
|
|
|
@ -28,18 +28,18 @@ import org.eclipse.cdt.debug.mi.core.command.MIBreakEnable;
|
|||
import org.eclipse.cdt.debug.mi.core.command.MIBreakInsert;
|
||||
import org.eclipse.cdt.debug.mi.core.command.MIBreakList;
|
||||
import org.eclipse.cdt.debug.mi.core.command.MIBreakWatch;
|
||||
import org.eclipse.cdt.debug.mi.core.event.MIBreakPointChangedEvent;
|
||||
import org.eclipse.cdt.debug.mi.core.event.MIBreakPointCreatedEvent;
|
||||
import org.eclipse.cdt.debug.mi.core.event.MIBreakPointDeletedEvent;
|
||||
import org.eclipse.cdt.debug.mi.core.event.MIBreakpointChangedEvent;
|
||||
import org.eclipse.cdt.debug.mi.core.event.MIBreakpointCreatedEvent;
|
||||
import org.eclipse.cdt.debug.mi.core.event.MIBreakpointDeletedEvent;
|
||||
import org.eclipse.cdt.debug.mi.core.event.MIEvent;
|
||||
import org.eclipse.cdt.debug.mi.core.output.MIBreakInsertInfo;
|
||||
import org.eclipse.cdt.debug.mi.core.output.MIBreakListInfo;
|
||||
import org.eclipse.cdt.debug.mi.core.output.MIBreakPoint;
|
||||
import org.eclipse.cdt.debug.mi.core.output.MIBreakpoint;
|
||||
import org.eclipse.cdt.debug.mi.core.output.MIBreakWatchInfo;
|
||||
import org.eclipse.cdt.debug.mi.core.output.MIInfo;
|
||||
|
||||
/**
|
||||
*
|
||||
* Breakpoint Manager for the CDI interface.
|
||||
*/
|
||||
public class BreakpointManager extends SessionObject implements ICDIBreakpointManager {
|
||||
|
||||
|
@ -54,7 +54,7 @@ public class BreakpointManager extends SessionObject implements ICDIBreakpointMa
|
|||
allowInterrupt = true;
|
||||
}
|
||||
|
||||
public MIBreakPoint[] getMIBreakpoints() throws CDIException {
|
||||
public MIBreakpoint[] getMIBreakpoints() throws CDIException {
|
||||
CSession s = getCSession();
|
||||
CommandFactory factory = s.getMISession().getCommandFactory();
|
||||
MIBreakList breakpointList = factory.createMIBreakList();
|
||||
|
@ -64,35 +64,39 @@ public class BreakpointManager extends SessionObject implements ICDIBreakpointMa
|
|||
if (info == null) {
|
||||
throw new CDIException("No answer");
|
||||
}
|
||||
return info.getBreakPoints();
|
||||
return info.getMIBreakpoints();
|
||||
} catch (MIException e) {
|
||||
throw new MI2CDIException(e);
|
||||
}
|
||||
}
|
||||
|
||||
void update() throws CDIException {
|
||||
MIBreakPoint[] newMIBreakPoints = getMIBreakpoints();
|
||||
List eventList = new ArrayList(newMIBreakPoints.length);
|
||||
for (int i = 0; i < newMIBreakPoints.length; i++) {
|
||||
int no = newMIBreakPoints[i].getNumber();
|
||||
MIBreakpoint[] newMIBreakpoints = getMIBreakpoints();
|
||||
List eventList = new ArrayList(newMIBreakpoints.length);
|
||||
for (int i = 0; i < newMIBreakpoints.length; i++) {
|
||||
int no = newMIBreakpoints[i].getNumber();
|
||||
if (containsBreakpoint(no)) {
|
||||
if (hasBreakpointChanged(newMIBreakPoints[i])) {
|
||||
if (hasBreakpointChanged(newMIBreakpoints[i])) {
|
||||
// Fire ChangedEvent
|
||||
eventList.add(new MIBreakPointChangedEvent(no));
|
||||
eventList.add(new MIBreakpointChangedEvent(no));
|
||||
}
|
||||
} else {
|
||||
// add the new breakpoint and fire create event
|
||||
breakList.add(new Breakpoint(this, newMIBreakPoints[i]));
|
||||
eventList.add(new MIBreakPointCreatedEvent(no));
|
||||
// add the new breakpoint and fire CreatedEvent
|
||||
if (newMIBreakpoints[i].isWatchpoint()) {
|
||||
breakList.add(new Watchpoint(this, newMIBreakpoints[i]));
|
||||
} else {
|
||||
breakList.add(new Breakpoint(this, newMIBreakpoints[i]));
|
||||
}
|
||||
eventList.add(new MIBreakpointCreatedEvent(no));
|
||||
}
|
||||
}
|
||||
// Check if any breakpoint was removed.
|
||||
Breakpoint[] oldBreakpoints = listBreakpoints();
|
||||
for (int i = 0; i < oldBreakpoints.length; i++) {
|
||||
boolean found = false;
|
||||
int no = oldBreakpoints[i].getMIBreakPoint().getNumber();
|
||||
for (int j = 0; j < newMIBreakPoints.length; j++) {
|
||||
if (no == newMIBreakPoints[i].getNumber()) {
|
||||
int no = oldBreakpoints[i].getMIBreakpoint().getNumber();
|
||||
for (int j = 0; j < newMIBreakpoints.length; j++) {
|
||||
if (no == newMIBreakpoints[i].getNumber()) {
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
|
@ -101,7 +105,7 @@ public class BreakpointManager extends SessionObject implements ICDIBreakpointMa
|
|||
// Fire destroyed Events.
|
||||
breakList.remove(oldBreakpoints[i]);
|
||||
delList.add(oldBreakpoints[i]);
|
||||
eventList.add(new MIBreakPointDeletedEvent(no));
|
||||
eventList.add(new MIBreakpointDeletedEvent(no));
|
||||
}
|
||||
}
|
||||
MISession mi = getCSession().getMISession();
|
||||
|
@ -113,7 +117,7 @@ public class BreakpointManager extends SessionObject implements ICDIBreakpointMa
|
|||
return (getBreakpoint(number) != null);
|
||||
}
|
||||
|
||||
boolean hasBreakpointChanged(MIBreakPoint miBreakPoint) {
|
||||
boolean hasBreakpointChanged(MIBreakpoint miBreakpoint) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -122,7 +126,7 @@ public class BreakpointManager extends SessionObject implements ICDIBreakpointMa
|
|||
for (int i = 0; i < bkpts.length; i++) {
|
||||
if (bkpts[i] instanceof Breakpoint) {
|
||||
Breakpoint point = (Breakpoint) bkpts[i];
|
||||
MIBreakPoint miBreak = point.getMIBreakPoint();
|
||||
MIBreakpoint miBreak = point.getMIBreakpoint();
|
||||
if (miBreak.getNumber() == number) {
|
||||
return point;
|
||||
}
|
||||
|
@ -194,7 +198,7 @@ public class BreakpointManager extends SessionObject implements ICDIBreakpointMa
|
|||
if (breakpoints[i] instanceof Breakpoint
|
||||
&& breakList.contains(breakpoints[i])) {
|
||||
numbers[i] =
|
||||
((Breakpoint) breakpoints[i]).getMIBreakPoint().getNumber();
|
||||
((Breakpoint) breakpoints[i]).getMIBreakpoint().getNumber();
|
||||
} else {
|
||||
throw new CDIException("Not a CDT breakpoint");
|
||||
}
|
||||
|
@ -218,8 +222,8 @@ public class BreakpointManager extends SessionObject implements ICDIBreakpointMa
|
|||
for (int i = 0; i < breakpoints.length; i++) {
|
||||
breakList.remove(breakpoints[i]);
|
||||
delList.add(breakpoints[i]);
|
||||
int no = ((Breakpoint)breakpoints[i]).getMIBreakPoint().getNumber();
|
||||
eventList.add(new MIBreakPointDeletedEvent(no));
|
||||
int no = ((Breakpoint)breakpoints[i]).getMIBreakpoint().getNumber();
|
||||
eventList.add(new MIBreakpointDeletedEvent(no));
|
||||
}
|
||||
MISession mi = s.getMISession();
|
||||
MIEvent[] events = (MIEvent[])eventList.toArray(new MIEvent[0]);
|
||||
|
@ -230,7 +234,7 @@ public class BreakpointManager extends SessionObject implements ICDIBreakpointMa
|
|||
Breakpoint point = null;
|
||||
Breakpoint[] points = (Breakpoint[])delList.toArray(new Breakpoint[delList.size()]);
|
||||
for (int i = 0; i < points.length; i++) {
|
||||
if (points[i].getMIBreakPoint().getNumber() == no) {
|
||||
if (points[i].getMIBreakpoint().getNumber() == no) {
|
||||
delList.remove(points[i]);
|
||||
point = points[i];
|
||||
break;
|
||||
|
@ -243,7 +247,7 @@ public class BreakpointManager extends SessionObject implements ICDIBreakpointMa
|
|||
int number = 0;
|
||||
if (breakpoint instanceof Breakpoint
|
||||
&& breakList.contains(breakpoint)) {
|
||||
number = ((Breakpoint) breakpoint).getMIBreakPoint().getNumber();
|
||||
number = ((Breakpoint) breakpoint).getMIBreakpoint().getNumber();
|
||||
} else {
|
||||
throw new CDIException("Not a CDT breakpoint");
|
||||
}
|
||||
|
@ -264,14 +268,14 @@ public class BreakpointManager extends SessionObject implements ICDIBreakpointMa
|
|||
// Resume the program and enable events.
|
||||
resumeInferior(state);
|
||||
}
|
||||
((Breakpoint) breakpoint).getMIBreakPoint().setEnabled(true);
|
||||
((Breakpoint) breakpoint).getMIBreakpoint().setEnabled(true);
|
||||
}
|
||||
|
||||
public void disableBreakpoint(ICDIBreakpoint breakpoint) throws CDIException {
|
||||
int number = 0;
|
||||
if (breakpoint instanceof Breakpoint
|
||||
&& breakList.contains(breakpoint)) {
|
||||
number = ((Breakpoint) breakpoint).getMIBreakPoint().getNumber();
|
||||
number = ((Breakpoint) breakpoint).getMIBreakpoint().getNumber();
|
||||
} else {
|
||||
throw new CDIException("Not a CDT breakpoint");
|
||||
}
|
||||
|
@ -291,14 +295,14 @@ public class BreakpointManager extends SessionObject implements ICDIBreakpointMa
|
|||
} finally {
|
||||
resumeInferior(state);
|
||||
}
|
||||
((Breakpoint) breakpoint).getMIBreakPoint().setEnabled(false);
|
||||
((Breakpoint) breakpoint).getMIBreakpoint().setEnabled(false);
|
||||
}
|
||||
|
||||
public void setCondition(ICDIBreakpoint breakpoint, ICDICondition condition) throws CDIException {
|
||||
int number = 0;
|
||||
if (breakpoint instanceof Breakpoint
|
||||
&& breakList.contains(breakpoint)) {
|
||||
number = ((Breakpoint) breakpoint).getMIBreakPoint().getNumber();
|
||||
number = ((Breakpoint) breakpoint).getMIBreakpoint().getNumber();
|
||||
} else {
|
||||
throw new CDIException("Not a CDT breakpoint");
|
||||
}
|
||||
|
@ -360,7 +364,7 @@ public class BreakpointManager extends SessionObject implements ICDIBreakpointMa
|
|||
// if (info == null) {
|
||||
// throw new CDIException("No answer");
|
||||
// }
|
||||
// MIBreakPoint[] miPoints = info.getBreakPoints();
|
||||
// MIBreakpoint[] mipoints = info.getBreakpoints();
|
||||
// for (int i = 0; i < miPoints.length; i++) {
|
||||
// if (!containsBreakpoint(miPoints[i].getNumber())) {
|
||||
// // FIXME: Generate a Create/Change Event??
|
||||
|
@ -423,14 +427,14 @@ public class BreakpointManager extends SessionObject implements ICDIBreakpointMa
|
|||
MIBreakInsert breakInsert =
|
||||
factory.createMIBreakInsert( temporary, hardware, exprCond,
|
||||
ignoreCount, line.toString());
|
||||
MIBreakPoint[] points = null;
|
||||
MIBreakpoint[] points = null;
|
||||
try {
|
||||
s.getMISession().postCommand(breakInsert);
|
||||
MIBreakInsertInfo info = breakInsert.getMIBreakInsertInfo();
|
||||
if (info == null) {
|
||||
throw new CDIException("No answer");
|
||||
}
|
||||
points = info.getBreakPoints();
|
||||
points = info.getMIBreakpoints();
|
||||
if (points == null || points.length == 0) {
|
||||
throw new CDIException("Error parsing");
|
||||
}
|
||||
|
@ -441,6 +445,10 @@ public class BreakpointManager extends SessionObject implements ICDIBreakpointMa
|
|||
}
|
||||
Breakpoint bkpt = new Breakpoint(this, points[0]);
|
||||
breakList.add(bkpt);
|
||||
|
||||
// Fire a created Event.
|
||||
MISession mi = s.getMISession();
|
||||
mi.fireEvent(new MIBreakpointCreatedEvent(bkpt.getMIBreakpoint().getNumber()));
|
||||
return bkpt;
|
||||
}
|
||||
|
||||
|
@ -458,11 +466,11 @@ public class BreakpointManager extends SessionObject implements ICDIBreakpointMa
|
|||
CommandFactory factory = s.getMISession().getCommandFactory();
|
||||
MIBreakWatch breakWatch =
|
||||
factory.createMIBreakWatch(access, read, expression);
|
||||
MIBreakPoint[] points = null;
|
||||
MIBreakpoint[] points = null;
|
||||
try {
|
||||
s.getMISession().postCommand(breakWatch);
|
||||
MIBreakWatchInfo info = breakWatch.getMIBreakWatchInfo();
|
||||
points = info.getBreakPoints();
|
||||
points = info.getMIBreakpoints();
|
||||
if (info == null) {
|
||||
throw new CDIException("No answer");
|
||||
}
|
||||
|
@ -476,8 +484,13 @@ public class BreakpointManager extends SessionObject implements ICDIBreakpointMa
|
|||
}
|
||||
Watchpoint bkpt = new Watchpoint(this, points[0]);
|
||||
breakList.add(bkpt);
|
||||
|
||||
// Fire a created Event.
|
||||
MISession mi = s.getMISession();
|
||||
mi.fireEvent(new MIBreakpointCreatedEvent(bkpt.getMIBreakpoint().getNumber()));
|
||||
return bkpt;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.eclipse.cdt.debug.core.cdi.ICDIBreakpointManager#createCondition(int, String)
|
||||
*/
|
||||
|
@ -499,5 +512,4 @@ public class BreakpointManager extends SessionObject implements ICDIBreakpointMa
|
|||
return new Location(address);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -7,13 +7,13 @@ 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.model.ICDICatchpoint;
|
||||
import org.eclipse.cdt.debug.mi.core.output.MIBreakPoint;
|
||||
import org.eclipse.cdt.debug.mi.core.output.MIBreakpoint;
|
||||
|
||||
/**
|
||||
*/
|
||||
public class Catchpoint extends Breakpoint implements ICDICatchpoint {
|
||||
|
||||
public Catchpoint(BreakpointManager m, MIBreakPoint miBreak) {
|
||||
public Catchpoint(BreakpointManager m, MIBreakpoint miBreak) {
|
||||
super(m, miBreak);
|
||||
}
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ import org.eclipse.cdt.debug.core.cdi.CDIException;
|
|||
import org.eclipse.cdt.debug.core.cdi.event.ICDIChangedEvent;
|
||||
import org.eclipse.cdt.debug.core.cdi.model.ICDIBreakpoint;
|
||||
import org.eclipse.cdt.debug.core.cdi.model.ICDIObject;
|
||||
import org.eclipse.cdt.debug.mi.core.event.MIBreakPointChangedEvent;
|
||||
import org.eclipse.cdt.debug.mi.core.event.MIBreakpointChangedEvent;
|
||||
import org.eclipse.cdt.debug.mi.core.event.MIRegisterChangedEvent;
|
||||
import org.eclipse.cdt.debug.mi.core.event.MIVarChangedEvent;
|
||||
|
||||
|
@ -47,7 +47,7 @@ public class ChangedEvent implements ICDIChangedEvent {
|
|||
}
|
||||
}
|
||||
|
||||
public ChangedEvent(CSession s, MIBreakPointChangedEvent bpoint) {
|
||||
public ChangedEvent(CSession s, MIBreakpointChangedEvent bpoint) {
|
||||
session = s;
|
||||
BreakpointManager mgr = (BreakpointManager)session.getBreakpointManager();
|
||||
int number = bpoint.getNumber();
|
||||
|
|
|
@ -7,7 +7,7 @@ package org.eclipse.cdt.debug.mi.core.cdi;
|
|||
import org.eclipse.cdt.debug.core.cdi.event.ICDICreatedEvent;
|
||||
import org.eclipse.cdt.debug.core.cdi.model.ICDIBreakpoint;
|
||||
import org.eclipse.cdt.debug.core.cdi.model.ICDIObject;
|
||||
import org.eclipse.cdt.debug.mi.core.event.MIBreakPointCreatedEvent;
|
||||
import org.eclipse.cdt.debug.mi.core.event.MIBreakpointCreatedEvent;
|
||||
|
||||
/**
|
||||
*/
|
||||
|
@ -16,7 +16,7 @@ public class CreatedEvent implements ICDICreatedEvent {
|
|||
CSession session;
|
||||
ICDIObject source;
|
||||
|
||||
public CreatedEvent(CSession s, MIBreakPointCreatedEvent bpoint) {
|
||||
public CreatedEvent(CSession s, MIBreakpointCreatedEvent bpoint) {
|
||||
session = s;
|
||||
BreakpointManager mgr = (BreakpointManager)session.getBreakpointManager();
|
||||
int number = bpoint.getNumber();
|
||||
|
|
|
@ -7,7 +7,7 @@ package org.eclipse.cdt.debug.mi.core.cdi;
|
|||
|
||||
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.MIBreakPointDeletedEvent;
|
||||
import org.eclipse.cdt.debug.mi.core.event.MIBreakpointDeletedEvent;
|
||||
import org.eclipse.cdt.debug.mi.core.event.MIThreadExitEvent;
|
||||
import org.eclipse.cdt.debug.mi.core.event.MIVarChangedEvent;
|
||||
|
||||
|
@ -35,7 +35,7 @@ public class DestroyedEvent implements ICDIDestroyedEvent {
|
|||
}
|
||||
}
|
||||
|
||||
public DestroyedEvent(CSession s, MIBreakPointDeletedEvent bpoint) {
|
||||
public DestroyedEvent(CSession s, MIBreakpointDeletedEvent bpoint) {
|
||||
session = s;
|
||||
BreakpointManager mgr = (BreakpointManager)session.getBreakpointManager();
|
||||
int number = bpoint.getNumber();
|
||||
|
|
|
@ -15,9 +15,9 @@ import org.eclipse.cdt.debug.core.cdi.CDIException;
|
|||
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.event.MIBreakPointChangedEvent;
|
||||
import org.eclipse.cdt.debug.mi.core.event.MIBreakPointCreatedEvent;
|
||||
import org.eclipse.cdt.debug.mi.core.event.MIBreakPointDeletedEvent;
|
||||
import org.eclipse.cdt.debug.mi.core.event.MIBreakpointChangedEvent;
|
||||
import org.eclipse.cdt.debug.mi.core.event.MIBreakpointCreatedEvent;
|
||||
import org.eclipse.cdt.debug.mi.core.event.MIBreakpointDeletedEvent;
|
||||
import org.eclipse.cdt.debug.mi.core.event.MIChangedEvent;
|
||||
import org.eclipse.cdt.debug.mi.core.event.MICreatedEvent;
|
||||
import org.eclipse.cdt.debug.mi.core.event.MIDestroyedEvent;
|
||||
|
@ -81,12 +81,13 @@ public class EventManager extends SessionObject implements ICDIEventManager, Obs
|
|||
blocks[i].setDirty(false);
|
||||
}
|
||||
}
|
||||
} else if (miEvent instanceof MIBreakPointChangedEvent) {
|
||||
MIBreakPointChangedEvent bpoint = (MIBreakPointChangedEvent)miEvent;
|
||||
} else if (miEvent instanceof MIBreakpointChangedEvent) {
|
||||
MIBreakpointChangedEvent bpoint = (MIBreakpointChangedEvent)miEvent;
|
||||
if (bpoint.getNumber() > 0) {
|
||||
cdiList.add(new ChangedEvent(session, (MIBreakPointChangedEvent)miEvent));
|
||||
cdiList.add(new ChangedEvent(session, bpoint));
|
||||
} else {
|
||||
// Try to update to figure out what have change.
|
||||
// Something change we do not know what
|
||||
// Let the breakpoint manager handle it with an update().
|
||||
try {
|
||||
((BreakpointManager)(session.getBreakpointManager())).update();
|
||||
} catch (CDIException e) {
|
||||
|
@ -102,12 +103,32 @@ public class EventManager extends SessionObject implements ICDIEventManager, Obs
|
|||
cdiList.add(new DestroyedEvent(session));
|
||||
} else if (miEvent instanceof MIDetachedEvent) {
|
||||
cdiList.add(new DisconnectedEvent(session));
|
||||
} else if (miEvent instanceof MIBreakPointDeletedEvent) {
|
||||
cdiList.add(new DestroyedEvent(session, (MIBreakPointDeletedEvent)miEvent));
|
||||
} else if (miEvent instanceof MIBreakpointDeletedEvent) {
|
||||
MIBreakpointDeletedEvent bpoint = (MIBreakpointDeletedEvent)miEvent;
|
||||
if (bpoint.getNumber() > 0) {
|
||||
cdiList.add(new DestroyedEvent(session, bpoint));
|
||||
} else {
|
||||
// Something was deleted we do not know what
|
||||
// Let the breakpoint manager handle it with an update().
|
||||
try {
|
||||
((BreakpointManager)(session.getBreakpointManager())).update();
|
||||
} catch (CDIException e) {
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (miEvent instanceof MICreatedEvent) {
|
||||
if (miEvent instanceof MIBreakPointCreatedEvent) {
|
||||
cdiList.add(new CreatedEvent(session, (MIBreakPointCreatedEvent)miEvent));
|
||||
if (miEvent instanceof MIBreakpointCreatedEvent) {
|
||||
MIBreakpointCreatedEvent bpoint = (MIBreakpointCreatedEvent)miEvent;
|
||||
if (bpoint.getNumber() > 0) {
|
||||
cdiList.add(new CreatedEvent(session, bpoint));
|
||||
} else {
|
||||
// Something created we do not know what
|
||||
// Let the breakpoint manager handle it with an update().
|
||||
try {
|
||||
((BreakpointManager)(session.getBreakpointManager())).update();
|
||||
} catch (CDIException e) {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ package org.eclipse.cdt.debug.mi.core.cdi;
|
|||
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.mi.core.event.MIBreakpointEvent;
|
||||
import org.eclipse.cdt.debug.mi.core.event.MIBreakpointHitEvent;
|
||||
import org.eclipse.cdt.debug.mi.core.event.MIErrorEvent;
|
||||
import org.eclipse.cdt.debug.mi.core.event.MIEvent;
|
||||
import org.eclipse.cdt.debug.mi.core.event.MIFunctionFinishedEvent;
|
||||
|
@ -32,8 +32,8 @@ public class SuspendedEvent implements ICDISuspendedEvent {
|
|||
}
|
||||
|
||||
public ICDISessionObject getReason() {
|
||||
if (event instanceof MIBreakpointEvent) {
|
||||
return new BreakpointHit(session, (MIBreakpointEvent)event);
|
||||
if (event instanceof MIBreakpointHitEvent) {
|
||||
return new BreakpointHit(session, (MIBreakpointHitEvent)event);
|
||||
} else if (event instanceof MIWatchpointTriggerEvent) {
|
||||
return new WatchpointTrigger(session, (MIWatchpointTriggerEvent)event);
|
||||
} else if (event instanceof MIWatchpointScopeEvent) {
|
||||
|
|
|
@ -7,13 +7,13 @@ package org.eclipse.cdt.debug.mi.core.cdi;
|
|||
|
||||
import org.eclipse.cdt.debug.core.cdi.CDIException;
|
||||
import org.eclipse.cdt.debug.core.cdi.model.ICDIWatchpoint;
|
||||
import org.eclipse.cdt.debug.mi.core.output.MIBreakPoint;
|
||||
import org.eclipse.cdt.debug.mi.core.output.MIBreakpoint;
|
||||
|
||||
/**
|
||||
*/
|
||||
public class Watchpoint extends Breakpoint implements ICDIWatchpoint {
|
||||
|
||||
public Watchpoint(BreakpointManager m, MIBreakPoint miBreak) {
|
||||
public Watchpoint(BreakpointManager m, MIBreakpoint miBreak) {
|
||||
super(m, miBreak);
|
||||
}
|
||||
|
||||
|
@ -21,21 +21,21 @@ public class Watchpoint extends Breakpoint implements ICDIWatchpoint {
|
|||
* @see org.eclipse.cdt.debug.core.cdi.ICDIWatchpoint#getWatchExpression()
|
||||
*/
|
||||
public String getWatchExpression() throws CDIException {
|
||||
return getMIBreakPoint().getWhat();
|
||||
return getMIBreakpoint().getWhat();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.eclipse.cdt.debug.core.cdi.ICDIWatchpoint#isReadType()
|
||||
*/
|
||||
public boolean isReadType() {
|
||||
return getMIBreakPoint().isReadWatchpoint() || getMIBreakPoint().isAccessWatchpoint();
|
||||
return getMIBreakpoint().isReadWatchpoint() || getMIBreakpoint().isAccessWatchpoint();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.eclipse.cdt.debug.core.cdi.ICDIWatchpoint#isWriteType()
|
||||
*/
|
||||
public boolean isWriteType() {
|
||||
return getMIBreakPoint().isAccessWatchpoint() || getMIBreakPoint().isWriteWatchpoint();
|
||||
return getMIBreakpoint().isAccessWatchpoint() || getMIBreakpoint().isWriteWatchpoint();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -10,16 +10,16 @@ package org.eclipse.cdt.debug.mi.core.event;
|
|||
/**
|
||||
*
|
||||
*/
|
||||
public class MIBreakPointChangedEvent extends MIChangedEvent {
|
||||
public class MIBreakpointChangedEvent extends MIChangedEvent {
|
||||
|
||||
int no;
|
||||
|
||||
public MIBreakPointChangedEvent(int number) {
|
||||
public MIBreakpointChangedEvent(int number) {
|
||||
super(0);
|
||||
no = number;
|
||||
}
|
||||
|
||||
public MIBreakPointChangedEvent(int id, int number) {
|
||||
public MIBreakpointChangedEvent(int id, int number) {
|
||||
super(id);
|
||||
no = number;
|
||||
}
|
|
@ -10,16 +10,16 @@ package org.eclipse.cdt.debug.mi.core.event;
|
|||
/**
|
||||
*
|
||||
*/
|
||||
public class MIBreakPointCreatedEvent extends MICreatedEvent {
|
||||
public class MIBreakpointCreatedEvent extends MICreatedEvent {
|
||||
|
||||
int no;
|
||||
|
||||
public MIBreakPointCreatedEvent(int number) {
|
||||
public MIBreakpointCreatedEvent(int number) {
|
||||
super(0);
|
||||
no = number;
|
||||
}
|
||||
|
||||
public MIBreakPointCreatedEvent(int id, int number) {
|
||||
public MIBreakpointCreatedEvent(int id, int number) {
|
||||
super(id);
|
||||
no = number;
|
||||
}
|
|
@ -10,16 +10,16 @@ package org.eclipse.cdt.debug.mi.core.event;
|
|||
/**
|
||||
*
|
||||
*/
|
||||
public class MIBreakPointDeletedEvent extends MIDestroyedEvent {
|
||||
public class MIBreakpointDeletedEvent extends MIDestroyedEvent {
|
||||
|
||||
int no;
|
||||
|
||||
public MIBreakPointDeletedEvent(int number) {
|
||||
public MIBreakpointDeletedEvent(int number) {
|
||||
super(0);
|
||||
no = number;
|
||||
}
|
||||
|
||||
public MIBreakPointDeletedEvent(int id, int number) {
|
||||
public MIBreakpointDeletedEvent(int id, int number) {
|
||||
super(id);
|
||||
no = number;
|
||||
}
|
|
@ -17,17 +17,17 @@ import org.eclipse.cdt.debug.mi.core.output.MIValue;
|
|||
* ^stopped,reason="breakpoint-hit",bkptno="1",thread-id="0",frame={addr="0x08048468",func="main",args=[{name="argc",value="1"},{name="argv",value="0xbffff18c"}],file="hello.c",line="4"}
|
||||
*
|
||||
*/
|
||||
public class MIBreakpointEvent extends MIStoppedEvent {
|
||||
public class MIBreakpointHitEvent extends MIStoppedEvent {
|
||||
|
||||
int bkptno;
|
||||
MIFrame frame;
|
||||
|
||||
public MIBreakpointEvent(MIExecAsyncOutput record) {
|
||||
public MIBreakpointHitEvent(MIExecAsyncOutput record) {
|
||||
super(record);
|
||||
parse();
|
||||
}
|
||||
|
||||
public MIBreakpointEvent(MIResultRecord record) {
|
||||
public MIBreakpointHitEvent(MIResultRecord record) {
|
||||
super(record);
|
||||
parse();
|
||||
}
|
|
@ -21,7 +21,7 @@ import java.util.List;
|
|||
*/
|
||||
public class MIBreakInsertInfo extends MIInfo {
|
||||
|
||||
MIBreakPoint[] breakpoints;
|
||||
MIBreakpoint[] breakpoints;
|
||||
|
||||
void parse() {
|
||||
List aList = new ArrayList(1);
|
||||
|
@ -33,27 +33,27 @@ public class MIBreakInsertInfo extends MIInfo {
|
|||
for (int i = 0; i < results.length; i++) {
|
||||
String var = results[i].getVariable();
|
||||
MIValue val = results[i].getMIValue();
|
||||
MIBreakPoint bpt = null;
|
||||
MIBreakpoint bpt = null;
|
||||
if (var.equals("wpt")) {
|
||||
if (val instanceof MITuple) {
|
||||
bpt = new MIBreakPoint((MITuple)val);
|
||||
bpt = new MIBreakpoint((MITuple)val);
|
||||
bpt.setEnabled(true);
|
||||
bpt.setWriteWatchpoint(true);
|
||||
}
|
||||
} else if (var.equals("bkpt")) {
|
||||
if (val instanceof MITuple) {
|
||||
bpt = new MIBreakPoint((MITuple)val);
|
||||
bpt = new MIBreakpoint((MITuple)val);
|
||||
bpt.setEnabled(true);
|
||||
}
|
||||
} else if (var.equals("hw-awpt")) {
|
||||
if (val instanceof MITuple) {
|
||||
bpt = new MIBreakPoint((MITuple)val);
|
||||
bpt = new MIBreakpoint((MITuple)val);
|
||||
bpt.setAccessWatchpoint(true);
|
||||
bpt.setEnabled(true);
|
||||
}
|
||||
} else if (var.equals("hw-rwpt")) {
|
||||
if (val instanceof MITuple) {
|
||||
bpt = new MIBreakPoint((MITuple)val);
|
||||
bpt = new MIBreakpoint((MITuple)val);
|
||||
bpt.setReadWatchpoint(true);
|
||||
bpt.setEnabled(true);
|
||||
}
|
||||
|
@ -64,14 +64,14 @@ public class MIBreakInsertInfo extends MIInfo {
|
|||
}
|
||||
}
|
||||
}
|
||||
breakpoints = (MIBreakPoint[])aList.toArray(new MIBreakPoint[aList.size()]);
|
||||
breakpoints = (MIBreakpoint[])aList.toArray(new MIBreakpoint[aList.size()]);
|
||||
}
|
||||
|
||||
public MIBreakInsertInfo(MIOutput record) {
|
||||
super(record);
|
||||
}
|
||||
|
||||
public MIBreakPoint[] getBreakPoints() {
|
||||
public MIBreakpoint[] getMIBreakpoints() {
|
||||
if (breakpoints == null) {
|
||||
parse();
|
||||
}
|
||||
|
|
|
@ -18,13 +18,13 @@ import java.util.List;
|
|||
*/
|
||||
public class MIBreakListInfo extends MIInfo {
|
||||
|
||||
MIBreakPoint[] breakpoints;
|
||||
MIBreakpoint[] breakpoints;
|
||||
|
||||
public MIBreakListInfo(MIOutput rr) {
|
||||
super(rr);
|
||||
}
|
||||
|
||||
public MIBreakPoint[] getBreakPoints() {
|
||||
public MIBreakpoint[] getMIBreakpoints() {
|
||||
if (breakpoints == null) {
|
||||
parse();
|
||||
}
|
||||
|
@ -46,7 +46,7 @@ public class MIBreakListInfo extends MIInfo {
|
|||
}
|
||||
}
|
||||
}
|
||||
breakpoints = (MIBreakPoint[])aList.toArray(new MIBreakPoint[aList.size()]);
|
||||
breakpoints = (MIBreakpoint[])aList.toArray(new MIBreakpoint[aList.size()]);
|
||||
}
|
||||
|
||||
void parseTable(MIValue val, List aList) {
|
||||
|
@ -69,7 +69,7 @@ public class MIBreakListInfo extends MIInfo {
|
|||
if (b.equals("bkpt")) {
|
||||
MIValue value = bkpts[i].getMIValue();
|
||||
if (value instanceof MITuple) {
|
||||
aList.add(new MIBreakPoint((MITuple)value));
|
||||
aList.add(new MIBreakpoint((MITuple)value));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -42,7 +42,7 @@ package org.eclipse.cdt.debug.mi.core.output;
|
|||
* </li>
|
||||
*</ul>
|
||||
*/
|
||||
public class MIBreakPoint {
|
||||
public class MIBreakpoint {
|
||||
|
||||
int number;
|
||||
String type = "";
|
||||
|
@ -63,7 +63,7 @@ public class MIBreakPoint {
|
|||
boolean isRWpt;
|
||||
boolean isWWpt;
|
||||
|
||||
public MIBreakPoint(MITuple tuple) {
|
||||
public MIBreakpoint(MITuple tuple) {
|
||||
parse(tuple);
|
||||
}
|
||||
|
Loading…
Add table
Reference in a new issue