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

implement new scheme for BreakpointHit, WatchpointTrigger and WatchpointScope

This commit is contained in:
Alain Magloire 2002-08-27 23:41:17 +00:00
parent 5321f78ce1
commit ed14a106db
7 changed files with 127 additions and 15 deletions

View file

@ -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;
ICDICondition condition;
@ -20,7 +20,7 @@ public class Breakpoint extends SessionObject implements ICDILocationBreakpoint
BreakpointManager mgr;
public Breakpoint(BreakpointManager m, MIBreakPoint miBreak) {
super(m.getCSession());
super(m.getCSession().getCTarget());
miBreakPoint = miBreak;
mgr = m;
}

View file

@ -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;
}
}

View file

@ -63,6 +63,10 @@ public class BreakpointManager extends SessionObject implements ICDIBreakpointMa
return null;
}
Watchpoint getWatchpoint(int number) {
return (Watchpoint)getBreakpoint(number);
}
Breakpoint[] listBreakpoints() {
return (Breakpoint[]) breakList.toArray(
new Breakpoint[breakList.size()]);

View file

@ -170,6 +170,20 @@ public class CTarget implements ICDITarget {
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()
*/

View file

@ -32,22 +32,14 @@ public class SuspendedEvent implements ICDISuspendedEvent {
}
public ICDISessionObject getReason() {
if (event instanceof MIBreakpointEvent || event instanceof MIWatchpointEvent) {
MIBreakpointEvent breakEvent = (MIBreakpointEvent)event;
int number = breakEvent.getNumber();
BreakpointManager mgr = (BreakpointManager)session.getBreakpointManager();
// 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.
}
if (event instanceof MIBreakpointEvent) {
return new BreakpointHit(session, (MIBreakpointEvent)event);
} else if (event instanceof MIWatchpointEvent) {
return new WatchpointTrigger(session, (MIWatchpointEvent)event);
} else if (event instanceof MISteppingRangeEvent) {
return new EndSteppingRange(session);
} else if (event instanceof MISignalEvent) {
return new Signal(session, (MISignalEvent) event);
return new Signal(session, (MISignalEvent)event);
} else if (event instanceof MILocationReachedEvent) {
return new EndSteppingRange(session);
} else if (event instanceof MIFunctionFinishedEvent) {

View file

@ -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;
}
}

View file

@ -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();
}
}