mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-13 03:05:39 +02:00
implement new scheme for BreakpointHit, WatchpointTrigger and WatchpointScope
This commit is contained in:
parent
5321f78ce1
commit
ed14a106db
7 changed files with 127 additions and 15 deletions
|
@ -12,7 +12,7 @@ import org.eclipse.cdt.debug.mi.core.output.MIBreakPoint;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*/
|
*/
|
||||||
public class Breakpoint extends SessionObject implements ICDILocationBreakpoint {
|
public class Breakpoint extends CObject implements ICDILocationBreakpoint {
|
||||||
|
|
||||||
ICDILocation location;
|
ICDILocation location;
|
||||||
ICDICondition condition;
|
ICDICondition condition;
|
||||||
|
@ -20,7 +20,7 @@ public class Breakpoint extends SessionObject implements ICDILocationBreakpoint
|
||||||
BreakpointManager mgr;
|
BreakpointManager mgr;
|
||||||
|
|
||||||
public Breakpoint(BreakpointManager m, MIBreakPoint miBreak) {
|
public Breakpoint(BreakpointManager m, MIBreakPoint miBreak) {
|
||||||
super(m.getCSession());
|
super(m.getCSession().getCTarget());
|
||||||
miBreakPoint = miBreak;
|
miBreakPoint = miBreak;
|
||||||
mgr = m;
|
mgr = m;
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,31 @@
|
||||||
|
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;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*/
|
||||||
|
public class BreakpointHit extends SessionObject implements ICDIBreakpointHit {
|
||||||
|
|
||||||
|
MIBreakpointEvent breakEvent;
|
||||||
|
|
||||||
|
public BreakpointHit(CSession session, MIBreakpointEvent e) {
|
||||||
|
super(session);
|
||||||
|
breakEvent = e;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see org.eclipse.cdt.debug.core.cdi.ICDIBreakpointHit#getBreakpoint()
|
||||||
|
*/
|
||||||
|
public ICDIBreakpoint getBreakpoint() {
|
||||||
|
int number = breakEvent.getNumber();
|
||||||
|
// Ask the breakpointManager for the breakpoint
|
||||||
|
BreakpointManager mgr = (BreakpointManager)getCSession().getBreakpointManager();
|
||||||
|
// We need to return the same object as the breakpoint.
|
||||||
|
Breakpoint point = mgr.getBreakpoint(number);
|
||||||
|
// FIXME: if point == null ?? Create a new breakpoint ??
|
||||||
|
return point;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -63,6 +63,10 @@ public class BreakpointManager extends SessionObject implements ICDIBreakpointMa
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Watchpoint getWatchpoint(int number) {
|
||||||
|
return (Watchpoint)getBreakpoint(number);
|
||||||
|
}
|
||||||
|
|
||||||
Breakpoint[] listBreakpoints() {
|
Breakpoint[] listBreakpoints() {
|
||||||
return (Breakpoint[]) breakList.toArray(
|
return (Breakpoint[]) breakList.toArray(
|
||||||
new Breakpoint[breakList.size()]);
|
new Breakpoint[breakList.size()]);
|
||||||
|
|
|
@ -170,6 +170,20 @@ public class CTarget implements ICDITarget {
|
||||||
return cthreads;
|
return cthreads;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see org.eclipse.cdt.debug.core.cdi.model.ICDITarget#getCurrentThread()
|
||||||
|
*/
|
||||||
|
public ICDIThread getCurrentThread() throws CDIException {
|
||||||
|
ICDIThread[] threads = getThreads();
|
||||||
|
for (int i = 0; i < threads.length; i++) {
|
||||||
|
CThread cthread = (CThread)threads[i];
|
||||||
|
if (cthread.getId() == currentThreadId) {
|
||||||
|
return cthread;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see org.eclipse.cdt.debug.core.cdi.model.ICDITarget#getThreads()
|
* @see org.eclipse.cdt.debug.core.cdi.model.ICDITarget#getThreads()
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -32,22 +32,14 @@ public class SuspendedEvent implements ICDISuspendedEvent {
|
||||||
}
|
}
|
||||||
|
|
||||||
public ICDISessionObject getReason() {
|
public ICDISessionObject getReason() {
|
||||||
if (event instanceof MIBreakpointEvent || event instanceof MIWatchpointEvent) {
|
if (event instanceof MIBreakpointEvent) {
|
||||||
MIBreakpointEvent breakEvent = (MIBreakpointEvent)event;
|
return new BreakpointHit(session, (MIBreakpointEvent)event);
|
||||||
int number = breakEvent.getNumber();
|
} else if (event instanceof MIWatchpointEvent) {
|
||||||
BreakpointManager mgr = (BreakpointManager)session.getBreakpointManager();
|
return new WatchpointTrigger(session, (MIWatchpointEvent)event);
|
||||||
// Ask the breakpointManager for the breakpoint
|
|
||||||
// We need to return the same object as the reason.
|
|
||||||
Breakpoint point = mgr.getBreakpoint(number);
|
|
||||||
if (point != null) {
|
|
||||||
return point;
|
|
||||||
} else {
|
|
||||||
// FIXME: Create a new breakpoint.
|
|
||||||
}
|
|
||||||
} else if (event instanceof MISteppingRangeEvent) {
|
} else if (event instanceof MISteppingRangeEvent) {
|
||||||
return new EndSteppingRange(session);
|
return new EndSteppingRange(session);
|
||||||
} else if (event instanceof MISignalEvent) {
|
} else if (event instanceof MISignalEvent) {
|
||||||
return new Signal(session, (MISignalEvent) event);
|
return new Signal(session, (MISignalEvent)event);
|
||||||
} else if (event instanceof MILocationReachedEvent) {
|
} else if (event instanceof MILocationReachedEvent) {
|
||||||
return new EndSteppingRange(session);
|
return new EndSteppingRange(session);
|
||||||
} else if (event instanceof MIFunctionFinishedEvent) {
|
} else if (event instanceof MIFunctionFinishedEvent) {
|
||||||
|
|
|
@ -0,0 +1,37 @@
|
||||||
|
package org.eclipse.cdt.debug.mi.core.cdi;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.debug.core.cdi.ICDIWatchpointScope;
|
||||||
|
import org.eclipse.cdt.debug.core.cdi.model.ICDIWatchpoint;
|
||||||
|
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 WatchpointScope extends SessionObject implements ICDIWatchpointScope {
|
||||||
|
|
||||||
|
MIWatchpointEvent watchEvent;
|
||||||
|
|
||||||
|
public WatchpointScope(CSession session, MIWatchpointEvent e) {
|
||||||
|
super(session);
|
||||||
|
watchEvent = e;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see org.eclipse.cdt.debug.core.cdi.ICDIWatchpointScope#getWatchpoint()
|
||||||
|
*/
|
||||||
|
public ICDIWatchpoint getWatchpoint() {
|
||||||
|
int number = watchEvent.getNumber();
|
||||||
|
// Ask the breakpointManager for the breakpoint
|
||||||
|
BreakpointManager mgr = (BreakpointManager)getCSession().getBreakpointManager();
|
||||||
|
// We need to return the same object as the reason.
|
||||||
|
Watchpoint point = mgr.getWatchpoint(number);
|
||||||
|
// FIXME: if point ==null ??? Create a new breakpoint ?
|
||||||
|
return point;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,34 @@
|
||||||
|
package org.eclipse.cdt.debug.mi.core.cdi;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.debug.core.cdi.ICDIWatchpointTrigger;
|
||||||
|
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 WatchpointTrigger extends WatchpointScope implements ICDIWatchpointTrigger {
|
||||||
|
|
||||||
|
public WatchpointTrigger(CSession session, MIWatchpointEvent e) {
|
||||||
|
super(session, e);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see org.eclipse.cdt.debug.core.cdi.ICDIWatchpointTrigger#getNewValue()
|
||||||
|
*/
|
||||||
|
public String getNewValue() {
|
||||||
|
return watchEvent.getNewValue();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see org.eclipse.cdt.debug.core.cdi.ICDIWatchpointTrigger#getOldValue()
|
||||||
|
*/
|
||||||
|
public String getOldValue() {
|
||||||
|
return watchEvent.getOldValue();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
Add table
Reference in a new issue