1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-23 14:42:11 +02:00

Adjust to the new CDI interface.

This commit is contained in:
Alain Magloire 2004-09-08 04:16:34 +00:00
parent ead5f8c975
commit 654e6be53f
20 changed files with 397 additions and 298 deletions

View file

@ -11,20 +11,17 @@
package org.eclipse.cdt.debug.mi.core.cdi;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import org.eclipse.cdt.debug.core.cdi.CDIException;
import org.eclipse.cdt.debug.core.cdi.ICDICatchEvent;
import org.eclipse.cdt.debug.core.cdi.ICDICondition;
import org.eclipse.cdt.debug.core.cdi.ICDILocation;
import org.eclipse.cdt.debug.core.cdi.ICDISharedLibraryManager;
import org.eclipse.cdt.debug.core.cdi.model.ICDIBreakpoint;
import org.eclipse.cdt.debug.core.cdi.model.ICDICatchpoint;
import org.eclipse.cdt.debug.core.cdi.model.ICDIExceptionpoint;
import org.eclipse.cdt.debug.core.cdi.model.ICDILocationBreakpoint;
import org.eclipse.cdt.debug.core.cdi.model.ICDITarget;
import org.eclipse.cdt.debug.core.cdi.model.ICDIWatchpoint;
@ -361,13 +358,6 @@ public class BreakpointManager extends Manager {
}
}
/**
* @see org.eclipse.cdt.debug.core.cdi.ICDIBreakpointManager#deleteAllBreakpoints()
*/
public void deleteAllBreakpoints() throws CDIException {
deleteBreakpoints(getBreakpoints());
}
public void deleteAllBreakpoints(Target target) throws CDIException {
List bList = (List)breakMap.get(target);
if (bList != null) {
@ -383,15 +373,6 @@ public class BreakpointManager extends Manager {
deleteBreakpoints((Target)breakpoint.getTarget(), new ICDIBreakpoint[] { breakpoint });
}
/**
* @see org.eclipse.cdt.debug.core.cdi.ICDIBreakpointManager#deleteBreakpoints(ICDIBreakpoint[])
*/
public void deleteBreakpoints(ICDIBreakpoint[] breakpoints) throws CDIException {
for (int i = 0; i < breakpoints.length; ++i) {
deleteBreakpoint(breakpoints[i]);
}
}
public void deleteBreakpoints(Target target, ICDIBreakpoint[] breakpoints) throws CDIException {
int[] numbers = new int[breakpoints.length];
List bList = (List)breakMap.get(target);
@ -444,17 +425,6 @@ public class BreakpointManager extends Manager {
return EMPTY_BREAKPOINTS;
}
/**
* @see org.eclipse.cdt.debug.core.cdi.ICDIBreakpointManager#getBreakpoints()
*/
public ICDIBreakpoint[] getBreakpoints() throws CDIException {
Collection col = breakMap.values();
Iterator itr = breakMap.values().iterator();
ICDIBreakpoint[] bps = new ICDIBreakpoint[col.size()];
col.toArray(bps);
return bps;
}
public ICDIBreakpoint[] getDeferredBreakpoints(Target target) throws CDIException {
List dlist = (List)deferredMap.get(target);
if (dlist != null) {
@ -465,33 +435,6 @@ public class BreakpointManager extends Manager {
return EMPTY_BREAKPOINTS;
}
/**
* @see org.eclipse.cdt.debug.core.cdi.ICDIBreakpointManager#setCatchpoint(int, ICDICatchEvent, String, ICDICondition, boolean)
*/
public ICDICatchpoint setCatchpoint( int type, ICDICatchEvent event, String expression,
ICDICondition condition) throws CDIException {
throw new CDIException(CdiResources.getString("cdi.BreakpointManager.Not_Supported")); //$NON-NLS-1$
}
/**
* @see org.eclipse.cdt.debug.core.cdi.ICDIBreakpointManager#setLocationBreakpoint(int, ICDILocation, ICDICondition, boolean, String)
*/
public ICDILocationBreakpoint setLocationBreakpoint(int type, ICDILocation location,
ICDICondition condition, String threadId) throws CDIException {
return setLocationBreakpoint(type, location, condition, threadId, false);
}
/**
* @see org.eclipse.cdt.debug.core.cdi.ICDIBreakpointManager#setLocationBreakpoint(int, ICDILocation, ICDICondition, boolean, String)
*/
public ICDILocationBreakpoint setLocationBreakpoint(int type, ICDILocation location,
ICDICondition condition, String threadId, boolean deferred) throws CDIException {
Session session = (Session)getSession();
Target target = (Target)session.getCurrentTarget();
return setLocationBreakpoint(target, type, location, condition, threadId, deferred);
}
public ICDILocationBreakpoint setLocationBreakpoint(Target target, int type, ICDILocation location,
ICDICondition condition, String threadId, boolean deferred) throws CDIException {
@ -598,14 +541,6 @@ public class BreakpointManager extends Manager {
bkpt.setMIBreakpoint(points[0]);
}
/**
* @see org.eclipse.cdt.debug.core.cdi.ICDIBreakpointManager#setWatchpoint(int, int, String, ICDICondition, boolean)
*/
public ICDIWatchpoint setWatchpoint(int type, int watchType, String expression,
ICDICondition condition) throws CDIException {
Target target = (Target)getSession().getCurrentTarget();
return setWatchpoint(target, type, watchType, expression, condition);
}
public ICDIWatchpoint setWatchpoint(Target target, int type, int watchType, String expression,
ICDICondition condition) throws CDIException {
@ -644,6 +579,11 @@ public class BreakpointManager extends Manager {
return bkpt;
}
public ICDIExceptionpoint setExceptionpoint(Target target, String clazz, boolean stopOnThrow,
boolean stopOnCatch) throws CDIException {
return null;
}
/**
* @see org.eclipse.cdt.debug.core.cdi.ICDIBreakpointManager#createCondition(int, String)
*/

View file

@ -54,6 +54,7 @@ import org.eclipse.cdt.debug.mi.core.event.MIDestroyedEvent;
import org.eclipse.cdt.debug.mi.core.event.MIDetachedEvent;
import org.eclipse.cdt.debug.mi.core.event.MIEvent;
import org.eclipse.cdt.debug.mi.core.event.MIGDBExitEvent;
import org.eclipse.cdt.debug.mi.core.event.MIInferiorCreatedEvent;
import org.eclipse.cdt.debug.mi.core.event.MIInferiorExitEvent;
import org.eclipse.cdt.debug.mi.core.event.MIInferiorSignalExitEvent;
import org.eclipse.cdt.debug.mi.core.event.MIMemoryChangedEvent;
@ -163,7 +164,7 @@ public class EventManager extends SessionObject implements ICDIEventManager, Obs
} else if (miEvent instanceof MIGDBExitEvent) {
cdiList.add(new DestroyedEvent(session));
} else if (miEvent instanceof MIDetachedEvent) {
cdiList.add(new DisconnectedEvent(session));
cdiList.add(new DisconnectedEvent(session, (MIDetachedEvent)miEvent));
} else if (miEvent instanceof MIBreakpointDeletedEvent) {
MIBreakpointDeletedEvent bpoint = (MIBreakpointDeletedEvent)miEvent;
if (bpoint.getNumber() > 0) {
@ -204,6 +205,8 @@ public class EventManager extends SessionObject implements ICDIEventManager, Obs
cdiList.add(new CreatedEvent(session, (MIMemoryCreatedEvent)miEvent));
} else if (miEvent instanceof MISharedLibCreatedEvent) {
cdiList.add(new CreatedEvent(session, (MISharedLibCreatedEvent)miEvent));
} else if (miEvent instanceof MIInferiorCreatedEvent) {
cdiList.add(new CreatedEvent(session, (MIInferiorCreatedEvent)miEvent));
}
}

View file

@ -131,12 +131,11 @@ public class ExpressionManager extends Manager implements ICDIExpressionManager{
public ICDIExpression createExpression(ICDIStackFrame frame, String name) throws CDIException {
Expression expression = null;
Session session = (Session)getSession();
ICDITarget currentTarget = session.getCurrentTarget();
ICDIThread currentThread = currentTarget.getCurrentThread();
Target target = (Target)frame.getTarget();
ICDIThread currentThread = target.getCurrentThread();
ICDIStackFrame currentFrame = currentThread.getCurrentStackFrame();
frame.getThread().setCurrentStackFrame(frame, false);
try {
Target target = (Target)frame.getThread().getTarget();
MISession mi = target.getMISession();
CommandFactory factory = mi.getCommandFactory();
MIVarCreate var = factory.createMIVarCreate(name);

View file

@ -5,51 +5,104 @@
*/
package org.eclipse.cdt.debug.mi.core.cdi;
import java.util.HashMap;
import java.util.Vector;
import org.eclipse.cdt.debug.core.cdi.CDIException;
import org.eclipse.cdt.debug.core.cdi.model.ICDITarget;
import org.eclipse.cdt.debug.mi.core.MISession;
import org.eclipse.cdt.debug.mi.core.cdi.model.Target;
import org.eclipse.cdt.debug.mi.core.event.MIInferiorCreatedEvent;
import org.eclipse.cdt.debug.mi.core.event.MIInferiorExitEvent;
/**
*/
public class ProcessManager extends Manager {
static final Target[] noProcess = new Target[0];
HashMap processMap;
class ProcessSet {
Target[] currentProcs;
int currentProcessId;
ProcessSet(Target[] procs, int id) {
currentProcs = procs;
currentProcessId = id;
}
}
static final Target[] EMPTY_TARGETS = new Target[0];
Vector debugTargetList;
Target currentTarget;
public ProcessManager(Session session) {
super(session, true);
processMap = new HashMap();
debugTargetList = new Vector(1);
}
/**
* @see org.eclipse.cdt.debug.core.cdi.ICDIProcessManager#getProcesses()
*/
public Target[] getProcesses(Session session) throws CDIException {
ProcessSet set = (ProcessSet)processMap.get(session);
if (set == null) {
set = getProcessSet(session);
processMap.put(session, set);
}
return set.currentProcs;
public Target[] getTargets() {
return (Target[]) debugTargetList.toArray(new Target[debugTargetList.size()]);
}
protected ProcessSet getProcessSet(Session session) throws CDIException {
//Target[] cprocs = new Target[] {new Target((Session)session)};
//return new ProcessSet(cprocs, 0);
public ICDITarget[] getCDITargets() {
return (ICDITarget[]) debugTargetList.toArray(new ICDITarget[debugTargetList.size()]);
}
public void addTargets(Target[] targets, Target current) {
EventManager eventManager = (EventManager)getSession().getEventManager();
for (int i = 0; i < targets.length; ++i) {
Target target = targets[i];
MISession miSession = target.getMISession();
if (miSession != null) {
miSession.addObserver(eventManager);
miSession.fireEvent(new MIInferiorCreatedEvent(miSession, 0));
if (!debugTargetList.contains(target)) {
debugTargetList.add(target);
}
}
}
if (current != null && debugTargetList.contains(current)) {
currentTarget = current;
}
debugTargetList.trimToSize();
}
public void removeTargets(Target[] targets) {
EventManager eventManager = (EventManager)getSession().getEventManager();
for (int i = 0; i < targets.length; ++i) {
Target target = targets[i];
MISession miSession = target.getMISession();
if (miSession != null) {
miSession.notifyObservers(new MIInferiorExitEvent(miSession, 0));
miSession.deleteObserver(eventManager);
}
if (currentTarget != null && currentTarget.equals(target)) {
currentTarget = null;
}
debugTargetList.remove(target);
}
debugTargetList.trimToSize();
}
public Target getTarget(MISession miSession) {
synchronized(debugTargetList) {
for (int i = 0; i < debugTargetList.size(); ++i) {
Target target = (Target)debugTargetList.get(i);
MISession mi = target.getMISession();
if (mi.equals(miSession)) {
return target;
}
}
}
// ASSERT: it should not happen.
return null;
}
/**
* @deprecated
* @return
*/
public Target getCurrentTarget() {
return currentTarget;
}
/**
* @deprecated
* @param current
*/
public void setCurrentTarget(Target current) {
currentTarget = current;
}
/**
* @deprecated
* @see org.eclipse.cdt.derug.core.cdi.ICDIManager#update()

View file

@ -11,8 +11,6 @@
package org.eclipse.cdt.debug.mi.core.cdi;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Properties;
import org.eclipse.cdt.debug.core.cdi.CDIException;
@ -42,6 +40,7 @@ public class Session implements ICDISession, ICDISessionObject {
public final static Target[] EMPTY_TARGETS = {};
Properties props;
ProcessManager processManager;
EventManager eventManager;
BreakpointManager breakpointManager;
ExpressionManager expressionManager;
@ -52,8 +51,6 @@ public class Session implements ICDISession, ICDISessionObject {
SignalManager signalManager;
SourceManager sourceManager;
ICDIConfiguration configuration;
Target[] debugTargets = EMPTY_TARGETS;
Target currentTarget;
public Session(MISession miSession, boolean attach) {
commonSetup();
@ -79,6 +76,7 @@ public class Session implements ICDISession, ICDISessionObject {
private void commonSetup() {
props = new Properties();
processManager = new ProcessManager(this);
breakpointManager = new BreakpointManager(this);
eventManager = new EventManager(this);
expressionManager = new ExpressionManager(this);
@ -91,44 +89,27 @@ public class Session implements ICDISession, ICDISessionObject {
}
public void addTargets(Target[] targets, Target current) {
Target[] newTargets = new Target[debugTargets.length + targets.length];
System.arraycopy(debugTargets, 0, newTargets, 0, debugTargets.length);
System.arraycopy(targets, 0, newTargets, debugTargets.length, targets.length);
if (current != null) {
currentTarget = current;
}
for (int i = 0; i < targets.length; ++i) {
MISession miSession = targets[i].getMISession();
if (miSession != null) {
miSession.addObserver((EventManager)getEventManager());
}
}
ProcessManager pMgr = getProcessManager();
pMgr.addTargets(targets, current);
}
public void removeTargets(Target[] targets) {
ArrayList list = new ArrayList(Arrays.asList(debugTargets));
for (int i = 0; i < targets.length; ++i) {
MISession miSession = targets[i].getMISession();
if (miSession != null) {
miSession.deleteObserver((EventManager)getEventManager());
}
if (currentTarget != null && currentTarget.equals(targets[i])) {
currentTarget = null;
}
list.remove(targets[i]);
}
debugTargets = (Target[]) list.toArray(new Target[list.size()]);
ProcessManager pMgr = getProcessManager();
pMgr.removeTargets(targets);
}
public Target getTarget(MISession miSession) {
for (int i = 0; i < debugTargets.length; ++i) {
MISession mi = debugTargets[i].getMISession();
if (mi.equals(miSession)) {
return debugTargets[i];
ProcessManager pMgr = getProcessManager();
return pMgr.getTarget(miSession);
}
}
// ASSERT: it should not happen.
return null;
/**
* @deprecated
* @see org.eclipse.cdt.debug.core.cdi.ICDISession#getCurrentTarget()
*/
public ICDITarget getCurrentTarget() {
ProcessManager pMgr = getProcessManager();
return pMgr.getCurrentTarget();
}
/**
@ -138,6 +119,10 @@ public class Session implements ICDISession, ICDISessionObject {
return props.getProperty(key);
}
public ProcessManager getProcessManager() {
return processManager;
}
/**
* @see org.eclipse.cdt.debug.core.cdi.ICDISession#getBreakpointManager()
*/
@ -205,22 +190,17 @@ public class Session implements ICDISession, ICDISessionObject {
* @see org.eclipse.cdt.debug.core.cdi.ICDISession#getTargets()
*/
public ICDITarget[] getTargets() {
return debugTargets;
}
/**
* @see org.eclipse.cdt.debug.core.cdi.ICDISession#getCurrentTarget()
*/
public ICDITarget getCurrentTarget() {
return currentTarget;
ProcessManager pMgr = getProcessManager();
return pMgr.getCDITargets();
}
/**
* @see org.eclipse.cdt.debug.core.cdi.ICDISession#setCurrentTarget()
*/
public void setCurrentTarget(ICDITarget target) throws CDIException {
ProcessManager pMgr = getProcessManager();
if (target instanceof Target) {
currentTarget = (Target)target;
pMgr.setCurrentTarget((Target)target);
} else {
throw new CDIException(CdiResources.getString("cdi.Session.Unknown_target")); //$NON-NLS-1$
}
@ -262,8 +242,10 @@ public class Session implements ICDISession, ICDISessionObject {
* @see org.eclipse.cdt.debug.core.cdi.ICDISession#terminate(ICDITarget)
*/
public void terminate() throws CDIException {
for (int i = 0; i < debugTargets.length; ++i) {
debugTargets[i].terminate();
ProcessManager pMgr = getProcessManager();
Target[] targets = pMgr.getTargets();
for (int i = 0; i < targets.length; ++i) {
targets[i].terminate();
}
//TODO: the ExitEvent is sent by MISession.terminate()
// We nee move it here.
@ -281,7 +263,7 @@ public class Session implements ICDISession, ICDISessionObject {
* @see org.eclipse.cdt.debug.core.cdi.ICDISession#addSearchPaths(String[])
*/
public void addSearchPaths(String[] dirs) throws CDIException {
addSearchPaths(currentTarget, dirs);
addSearchPaths(getCurrentTarget(), dirs);
}
/**
* @see org.eclipse.cdt.debug.core.cdi.ICDISession#addSearchPaths(String[])
@ -303,7 +285,7 @@ public class Session implements ICDISession, ICDISessionObject {
* @see org.eclipse.cdt.debug.core.cdi.ICDISession#getSessionProcess()
*/
public Process getSessionProcess() throws CDIException {
return getSessionProcess(currentTarget);
return getSessionProcess(getCurrentTarget());
}
/**

View file

@ -21,7 +21,6 @@ import org.eclipse.cdt.debug.core.cdi.ICDIVariableManager;
import org.eclipse.cdt.debug.core.cdi.model.ICDIArgument;
import org.eclipse.cdt.debug.core.cdi.model.ICDIArgumentObject;
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.ICDIThread;
import org.eclipse.cdt.debug.core.cdi.model.ICDIVariable;
import org.eclipse.cdt.debug.core.cdi.model.ICDIVariableObject;
@ -29,6 +28,7 @@ import org.eclipse.cdt.debug.mi.core.MIException;
import org.eclipse.cdt.debug.mi.core.MISession;
import org.eclipse.cdt.debug.mi.core.cdi.model.Argument;
import org.eclipse.cdt.debug.mi.core.cdi.model.ArgumentObject;
import org.eclipse.cdt.debug.mi.core.cdi.model.StackFrame;
import org.eclipse.cdt.debug.mi.core.cdi.model.Target;
import org.eclipse.cdt.debug.mi.core.cdi.model.Variable;
import org.eclipse.cdt.debug.mi.core.cdi.model.VariableObject;
@ -148,9 +148,14 @@ public class VariableManager extends Manager implements ICDIVariableManager {
/**
* Check the type
*/
public void checkType(MISession miSession, String type) throws CDIException {
public void checkType(StackFrame frame, String type) throws CDIException {
if (type != null && type.length() > 0) {
Target target = (Target)frame.getTarget();
ICDIThread currentThread = target.getCurrentThread();
ICDIStackFrame currentFrame = currentThread.getCurrentStackFrame();
frame.getThread().setCurrentStackFrame(frame, false);
try {
MISession miSession = target.getMISession();
CommandFactory factory = miSession.getCommandFactory();
MIPType ptype = factory.createMIPType(type);
miSession.postCommand(ptype);
@ -160,6 +165,8 @@ public class VariableManager extends Manager implements ICDIVariableManager {
}
} catch (MIException e) {
throw new MI2CDIException(e);
} finally {
currentThread.setCurrentStackFrame(currentFrame, false);
}
} else {
throw new CDIException(CdiResources.getString("cdi.VariableManager.Unknown_type")); //$NON-NLS-1$
@ -222,14 +229,13 @@ public class VariableManager extends Manager implements ICDIVariableManager {
Session session = (Session) getSession();
ICDIThread currentThread = null;
ICDIStackFrame currentFrame = null;
Target target = (Target)argObj.getTarget();
if (stack != null) {
ICDITarget currentTarget = session.getCurrentTarget();
currentThread = currentTarget.getCurrentThread();
currentThread = target.getCurrentThread();
currentFrame = currentThread.getCurrentStackFrame();
stack.getThread().setCurrentStackFrame(stack, false);
}
try {
Target target = (Target)argObj.getTarget();
MISession mi = target.getMISession();
CommandFactory factory = mi.getCommandFactory();
MIVarCreate var = factory.createMIVarCreate(name);
@ -260,12 +266,11 @@ public class VariableManager extends Manager implements ICDIVariableManager {
public ICDIArgumentObject[] getArgumentObjects(ICDIStackFrame frame) throws CDIException {
List argObjects = new ArrayList();
Session session = (Session) getSession();
ICDITarget currentTarget = session.getCurrentTarget();
ICDIThread currentThread = currentTarget.getCurrentThread();
Target target = (Target)frame.getTarget();
ICDIThread currentThread = target.getCurrentThread();
ICDIStackFrame currentFrame = currentThread.getCurrentStackFrame();
frame.getThread().setCurrentStackFrame(frame, false);
try {
Target target = (Target)frame.getTarget();
MISession mi = target.getMISession();
CommandFactory factory = mi.getCommandFactory();
int depth = frame.getThread().getStackFrameCount();
@ -361,7 +366,7 @@ public class VariableManager extends Manager implements ICDIVariableManager {
if (obj != null) {
// throw an exception if not a good type.
Target target = (Target)obj.getTarget();
checkType(target.getMISession(), type);
checkType((StackFrame)obj.getStackFrame(), type);
VariableObject vo =
new VariableObject(
target,
@ -386,12 +391,11 @@ public class VariableManager extends Manager implements ICDIVariableManager {
public ICDIVariableObject[] getLocalVariableObjects(ICDIStackFrame frame) throws CDIException {
List varObjects = new ArrayList();
Session session = (Session) getSession();
ICDITarget currentTarget = session.getCurrentTarget();
ICDIThread currentThread = currentTarget.getCurrentThread();
Target target = (Target)frame.getTarget();
ICDIThread currentThread = target.getCurrentThread();
ICDIStackFrame currentFrame = currentThread.getCurrentStackFrame();
frame.getThread().setCurrentStackFrame(frame, false);
try {
Target target = (Target)frame.getTarget();
MISession mi = target.getMISession();
CommandFactory factory = mi.getCommandFactory();
int level = frame.getLevel();
@ -445,14 +449,13 @@ public class VariableManager extends Manager implements ICDIVariableManager {
ICDIStackFrame stack = varObj.getStackFrame();
ICDIThread currentThread = null;
ICDIStackFrame currentFrame = null;
Target target = (Target)varObj.getTarget();
if (stack != null) {
ICDITarget currentTarget = session.getCurrentTarget();
currentThread = currentTarget.getCurrentThread();
currentThread = target.getCurrentThread();
currentFrame = currentThread.getCurrentStackFrame();
stack.getThread().setCurrentStackFrame(stack, false);
}
try {
Target target = (Target)varObj.getTarget();
MISession mi = target.getMISession();
CommandFactory factory = mi.getCommandFactory();
MIVarCreate var = factory.createMIVarCreate(name);

View file

@ -15,6 +15,7 @@ import org.eclipse.cdt.debug.core.cdi.model.ICDIBreakpoint;
import org.eclipse.cdt.debug.core.cdi.model.ICDIObject;
import org.eclipse.cdt.debug.core.cdi.model.ICDISharedLibrary;
import org.eclipse.cdt.debug.core.cdi.model.ICDISignal;
import org.eclipse.cdt.debug.mi.core.MISession;
import org.eclipse.cdt.debug.mi.core.cdi.BreakpointManager;
import org.eclipse.cdt.debug.mi.core.cdi.ExpressionManager;
import org.eclipse.cdt.debug.mi.core.cdi.RegisterManager;
@ -43,69 +44,79 @@ public class ChangedEvent implements ICDIChangedEvent {
// Try the Variable manager.
VariableManager mgr = (VariableManager)session.getVariableManager();
String varName = var.getVarName();
source = mgr.getVariable(var.getMISession(), varName);
MISession miSession = var.getMISession();
source = mgr.getVariable(miSession, varName);
// Try the Expression manager
if (source == null) {
ExpressionManager expMgr = (ExpressionManager)session.getExpressionManager();
source = expMgr.getExpression(var.getMISession(), varName);
source = expMgr.getExpression(miSession, varName);
}
// Try the Register manager
if (source == null) {
RegisterManager regMgr = (RegisterManager)session.getRegisterManager();
source = regMgr.getRegister(var.getMISession(), varName);
source = regMgr.getRegister(miSession, varName);
}
// Fall back
if (source == null) {
source = new CObject((Target)session.getCurrentTarget());
Target target = session.getTarget(miSession);
source = new CObject(target);
}
}
public ChangedEvent(Session s, MIRegisterChangedEvent var) {
public ChangedEvent(Session s, MIRegisterChangedEvent reg) {
session = s;
RegisterManager mgr = (RegisterManager)session.getRegisterManager();
int regno = var.getNumber();
source = mgr.getRegister(var.getMISession(), regno);
MISession miSession = reg.getMISession();
int regno = reg.getNumber();
source = mgr.getRegister(miSession, regno);
if (source == null) {
source = new CObject((Target)session.getCurrentTarget());
Target target = session.getTarget(miSession);
source = new CObject(target);
}
}
public ChangedEvent(Session s, MIBreakpointChangedEvent bpoint) {
session = s;
BreakpointManager mgr = (BreakpointManager)session.getBreakpointManager();
BreakpointManager mgr = session.getBreakpointManager();
MISession miSession = bpoint.getMISession();
int number = bpoint.getNumber();
ICDIBreakpoint breakpoint = mgr.getBreakpoint(bpoint.getMISession(), number);
ICDIBreakpoint breakpoint = mgr.getBreakpoint(miSession, number);
if (breakpoint != null) {
source = breakpoint;
} else {
source = new CObject((Target)session.getCurrentTarget());
Target target = session.getTarget(miSession);
source = new CObject(target);
}
}
public ChangedEvent(Session s, MISharedLibChangedEvent slib) {
session = s;
SharedLibraryManager mgr = (SharedLibraryManager)session.getSharedLibraryManager();
MISession miSession = slib.getMISession();
String name = slib.getName();
ICDISharedLibrary lib = mgr.getSharedLibrary(slib.getMISession(), name);
ICDISharedLibrary lib = mgr.getSharedLibrary(miSession, name);
if (lib != null) {
source = lib;
} else {
source = new CObject((Target)session.getCurrentTarget());
Target target = session.getTarget(miSession);
source = new CObject(target);
}
}
public ChangedEvent(Session s, MISignalChangedEvent sig) {
session = s;
SignalManager mgr = (SignalManager)session.getSignalManager();
MISession miSession = sig.getMISession();
String name = sig.getName();
ICDISignal signal = mgr.getSignal(sig.getMISession(), name);
ICDISignal signal = mgr.getSignal(miSession, name);
if (signal != null) {
source = signal;
} else {
source = new CObject((Target)session.getCurrentTarget());
Target target = session.getTarget(miSession);
source = new CObject(target);
}
}

View file

@ -13,6 +13,7 @@ package org.eclipse.cdt.debug.mi.core.cdi.event;
import org.eclipse.cdt.debug.core.cdi.event.ICDICreatedEvent;
import org.eclipse.cdt.debug.core.cdi.model.ICDIMemoryBlock;
import org.eclipse.cdt.debug.core.cdi.model.ICDIObject;
import org.eclipse.cdt.debug.mi.core.MISession;
import org.eclipse.cdt.debug.mi.core.cdi.BreakpointManager;
import org.eclipse.cdt.debug.mi.core.cdi.MemoryManager;
import org.eclipse.cdt.debug.mi.core.cdi.RegisterManager;
@ -22,6 +23,7 @@ import org.eclipse.cdt.debug.mi.core.cdi.VariableManager;
import org.eclipse.cdt.debug.mi.core.cdi.model.CObject;
import org.eclipse.cdt.debug.mi.core.cdi.model.Target;
import org.eclipse.cdt.debug.mi.core.event.MIBreakpointCreatedEvent;
import org.eclipse.cdt.debug.mi.core.event.MIInferiorCreatedEvent;
import org.eclipse.cdt.debug.mi.core.event.MIMemoryCreatedEvent;
import org.eclipse.cdt.debug.mi.core.event.MIRegisterCreatedEvent;
import org.eclipse.cdt.debug.mi.core.event.MISharedLibCreatedEvent;
@ -37,47 +39,61 @@ public class CreatedEvent implements ICDICreatedEvent {
public CreatedEvent(Session s, MIBreakpointCreatedEvent bpoint) {
session = s;
BreakpointManager mgr = (BreakpointManager)session.getBreakpointManager();
BreakpointManager mgr = session.getBreakpointManager();
MISession miSession = bpoint.getMISession();
int number = bpoint.getNumber();
source = mgr.getBreakpoint(bpoint.getMISession(), number);
source = mgr.getBreakpoint(miSession, number);
if (source == null) {
source = new CObject((Target)session.getCurrentTarget());
Target target = session.getTarget(miSession);
source = new CObject(target);
}
}
public CreatedEvent(Session s, MIVarCreatedEvent var) {
session = s;
VariableManager mgr = (VariableManager)session.getVariableManager();
MISession miSession = var.getMISession();
String varName = var.getVarName();
source = mgr.getVariable(var.getMISession(), varName);
source = mgr.getVariable(miSession, varName);
if (source == null) {
source = new CObject((Target)session.getCurrentTarget());
Target target = session.getTarget(miSession);
source = new CObject(target);
}
}
public CreatedEvent(Session s, MIRegisterCreatedEvent var) {
public CreatedEvent(Session s, MIRegisterCreatedEvent reg) {
session = s;
RegisterManager mgr = (RegisterManager)session.getRegisterManager();
int regno = var.getNumber();
source = mgr.getRegister(var.getMISession(), regno);
MISession miSession = reg.getMISession();
int regno = reg.getNumber();
source = mgr.getRegister(miSession, regno);
if (source == null) {
source = new CObject((Target)session.getCurrentTarget());
Target target = session.getTarget(miSession);
source = new CObject(target);
}
}
public CreatedEvent(Session s, MIThreadCreatedEvent ethread) {
public CreatedEvent(Session s, MIThreadCreatedEvent cthread) {
session = s;
Target target = (Target)session.getCurrentTarget();
source = target.getThread(ethread.getId());
MISession miSession = cthread.getMISession();
Target target = session.getTarget(miSession);
source = target.getThread(cthread.getId());
if (source == null) {
source = new CObject((Target)session.getCurrentTarget());
source = new CObject(target);
}
}
public CreatedEvent(Session s, MIInferiorCreatedEvent inferior) {
session = s;
MISession miSession = inferior.getMISession();
source = session.getTarget(miSession);
}
public CreatedEvent(Session s, MIMemoryCreatedEvent mblock) {
session = s;
MemoryManager mgr = (MemoryManager)session.getMemoryManager();
ICDIMemoryBlock[] blocks = mgr.getMemoryBlocks(mblock.getMISession());
MISession miSession = mblock.getMISession();
ICDIMemoryBlock[] blocks = mgr.getMemoryBlocks(miSession);
for (int i = 0; i < blocks.length; i++) {
if (blocks[i].getStartAddress() == mblock.getAddress() &&
blocks[i].getLength() == mblock.getLength()) {
@ -86,17 +102,20 @@ public class CreatedEvent implements ICDICreatedEvent {
}
}
if (source == null) {
source = new CObject((Target)session.getCurrentTarget());
Target target = session.getTarget(miSession);
source = new CObject(target);
}
}
public CreatedEvent(Session s, MISharedLibCreatedEvent slib) {
session = s;
SharedLibraryManager mgr = (SharedLibraryManager)session.getSharedLibraryManager();
MISession miSession = slib.getMISession();
String name = slib.getName();
source = mgr.getSharedLibrary(slib.getMISession(), name);
source = mgr.getSharedLibrary(miSession, name);
if (source == null) {
source = new CObject((Target)session.getCurrentTarget());
Target target = session.getTarget(miSession);
source = new CObject(target);
}
}

View file

@ -14,6 +14,7 @@ import org.eclipse.cdt.debug.core.cdi.CDIException;
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.ICDISharedLibrary;
import org.eclipse.cdt.debug.mi.core.MISession;
import org.eclipse.cdt.debug.mi.core.cdi.BreakpointManager;
import org.eclipse.cdt.debug.mi.core.cdi.ExpressionManager;
import org.eclipse.cdt.debug.mi.core.cdi.Session;
@ -36,60 +37,67 @@ public class DestroyedEvent implements ICDIDestroyedEvent {
Session session;
ICDIObject source;
public DestroyedEvent(Session s, MIThreadExitEvent ethread) {
public DestroyedEvent(Session s, MIThreadExitEvent cthread) {
session = s;
source = new Thread((Target)session.getCurrentTarget(), ethread.getId());
Target target = session.getTarget(cthread.getMISession());
source = new Thread(target, cthread.getId());
}
public DestroyedEvent(Session s, MIVarDeletedEvent var) {
session = s;
VariableManager varMgr = (VariableManager)session.getVariableManager();
MISession miSession = var.getMISession();
String varName = var.getVarName();
Variable variable = varMgr.getVariable(var.getMISession(), varName);
Variable variable = varMgr.getVariable(miSession, varName);
if (variable!= null) {
source = variable;
try {
varMgr.removeVariable(var.getMISession(), variable.getMIVar().getVarName());
varMgr.removeVariable(miSession, variable.getMIVar().getVarName());
} catch (CDIException e) {
}
} else {
ExpressionManager expMgr = (ExpressionManager)session.getExpressionManager();
variable = expMgr.getExpression(var.getMISession(), varName);
variable = expMgr.getExpression(miSession, varName);
if (variable != null) {
source = variable;
try {
expMgr.removeExpression(var.getMISession(), variable.getMIVar().getVarName());
expMgr.removeExpression(miSession, variable.getMIVar().getVarName());
} catch (CDIException e) {
}
} else {
source = new CObject((Target)session.getCurrentTarget());
Target target = session.getTarget(miSession);
source = new CObject(target);
}
}
}
public DestroyedEvent(Session s, MIBreakpointDeletedEvent bpoint) {
session = s;
BreakpointManager mgr = (BreakpointManager)session.getBreakpointManager();
BreakpointManager mgr = session.getBreakpointManager();
MISession miSession = bpoint.getMISession();
int number = bpoint.getNumber();
Breakpoint breakpoint = mgr.getBreakpoint(bpoint.getMISession(), number);
Breakpoint breakpoint = mgr.getBreakpoint(miSession, number);
if (breakpoint != null) {
source = breakpoint;
mgr.deleteBreakpoint(bpoint.getMISession(), number);
mgr.deleteBreakpoint(miSession, number);
} else {
source = new CObject((Target)session.getCurrentTarget());
Target target = session.getTarget(miSession);
source = new CObject(target);
}
}
public DestroyedEvent(Session s, MISharedLibUnloadedEvent slib) {
session = s;
SharedLibraryManager mgr = (SharedLibraryManager)session.getSharedLibraryManager();
MISession miSession = slib.getMISession();
String name = slib.getName();
ICDISharedLibrary lib = mgr.getSharedLibrary(slib.getMISession(), name);
ICDISharedLibrary lib = mgr.getSharedLibrary(miSession, name);
if (lib != null) {
mgr.deleteSharedLibrary(slib.getMISession(), lib);
mgr.deleteSharedLibrary(miSession, lib);
source = lib;
} else {
source = new CObject((Target)session.getCurrentTarget());
Target target = session.getTarget(miSession);
source = new CObject(target);
}
}

View file

@ -14,6 +14,8 @@ package org.eclipse.cdt.debug.mi.core.cdi.event;
import org.eclipse.cdt.debug.core.cdi.event.ICDIDisconnectedEvent;
import org.eclipse.cdt.debug.core.cdi.model.ICDIObject;
import org.eclipse.cdt.debug.mi.core.cdi.Session;
import org.eclipse.cdt.debug.mi.core.cdi.model.Target;
import org.eclipse.cdt.debug.mi.core.event.MIDetachedEvent;
/**
*/
@ -21,8 +23,9 @@ public class DisconnectedEvent implements ICDIDisconnectedEvent {
ICDIObject source;
public DisconnectedEvent(Session session) {
source = session.getCurrentTarget();
public DisconnectedEvent(Session session, MIDetachedEvent detach) {
Target target = session.getTarget(detach.getMISession());
source = target;
}
/**

View file

@ -16,6 +16,7 @@ import org.eclipse.cdt.debug.core.cdi.model.ICDIObject;
import org.eclipse.cdt.debug.mi.core.cdi.ExitInfo;
import org.eclipse.cdt.debug.mi.core.cdi.Session;
import org.eclipse.cdt.debug.mi.core.cdi.SignalExitInfo;
import org.eclipse.cdt.debug.mi.core.cdi.model.Target;
import org.eclipse.cdt.debug.mi.core.event.MIEvent;
import org.eclipse.cdt.debug.mi.core.event.MIInferiorExitEvent;
import org.eclipse.cdt.debug.mi.core.event.MIInferiorSignalExitEvent;
@ -53,7 +54,8 @@ public class ExitedEvent implements ICDIExitedEvent {
* @see org.eclipse.cdt.debug.core.cdi.event.ICDIEvent#getSource()
*/
public ICDIObject getSource() {
return session.getCurrentTarget();
Target target = session.getTarget(event.getMISession());
return target;
}
}

View file

@ -13,6 +13,7 @@ package org.eclipse.cdt.debug.mi.core.cdi.event;
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.cdi.Session;
import org.eclipse.cdt.debug.mi.core.cdi.model.Target;
import org.eclipse.cdt.debug.mi.core.event.MIRunningEvent;
/**
@ -31,7 +32,12 @@ public class ResumedEvent implements ICDIResumedEvent {
* @see org.eclipse.cdt.debug.core.cdi.event.ICDIEvent#getSource()
*/
public ICDIObject getSource() {
return session.getCurrentTarget();
// We can send the target as the Source. CDI
// Will assume that all threads are supended for this.
// This is true for gdb when it suspend the inferior
// all threads are suspended.
Target target = session.getTarget(event.getMISession());
return target;
}
/**

View file

@ -13,7 +13,6 @@ package org.eclipse.cdt.debug.mi.core.cdi.event;
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.ICDITarget;
import org.eclipse.cdt.debug.mi.core.cdi.BreakpointHit;
import org.eclipse.cdt.debug.mi.core.cdi.EndSteppingRange;
import org.eclipse.cdt.debug.mi.core.cdi.ErrorInfo;
@ -22,6 +21,7 @@ import org.eclipse.cdt.debug.mi.core.cdi.SharedLibraryEvent;
import org.eclipse.cdt.debug.mi.core.cdi.SignalReceived;
import org.eclipse.cdt.debug.mi.core.cdi.WatchpointScope;
import org.eclipse.cdt.debug.mi.core.cdi.WatchpointTrigger;
import org.eclipse.cdt.debug.mi.core.cdi.model.Target;
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;
@ -73,7 +73,7 @@ public class SuspendedEvent implements ICDISuspendedEvent {
* @see org.eclipse.cdt.debug.core.cdi.event.ICDIEvent#getSource()
*/
public ICDIObject getSource() {
ICDITarget target = session.getCurrentTarget();
Target target = session.getTarget(event.getMISession());
// We can send the target as the Source. CDI
// Will assume that all threads are supended for this.
// This is true for gdb when it suspend the inferior

View file

@ -1,32 +0,0 @@
/*******************************************************************************
* Copyright (c) 2000, 2004 QNX Software Systems and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/cpl-v10.html
*
* Contributors:
* QNX Software Systems - Initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.debug.mi.core.cdi.model;
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;
/**
*/
public class Catchpoint extends Breakpoint implements ICDICatchpoint {
public Catchpoint(Target target, MIBreakpoint miBreak) {
super(target, miBreak);
}
/**
* @see org.eclipse.cdt.debug.core.cdi.ICDICatchpoint#getEvent()
*/
public ICDICatchEvent getEvent() throws CDIException {
return null;
}
}

View file

@ -0,0 +1,62 @@
/**********************************************************************
* Copyright (c) 2002,2003,2004 QNX Software Systems and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/cpl-v10.html
*
* Contributors:
* QNX Software Systems - Initial API and implementation
***********************************************************************/
package org.eclipse.cdt.debug.mi.core.cdi.model;
import org.eclipse.cdt.debug.core.cdi.model.ICDIBreakpoint;
import org.eclipse.cdt.debug.core.cdi.model.ICDIExceptionpoint;
import org.eclipse.cdt.debug.mi.core.output.MIBreakpoint;
/**
* Exceptionpoint
*/
public class Exceptionpoint extends Breakpoint implements ICDIExceptionpoint {
String fClazz;
boolean fStopOnThrow;
boolean fStopOnCatch;
/**
*/
public Exceptionpoint(Target target, String name, boolean stopOnThrow, boolean stopOnCatch) {
super(target, ICDIBreakpoint.REGULAR, null, null, null);
fClazz = name;
fStopOnThrow = stopOnThrow;
fStopOnCatch = stopOnCatch;
}
public String getExceptionName() {
return fClazz;
}
/**
* @param target
* @param miBreak
*/
public Exceptionpoint(Target target, MIBreakpoint miBreak) {
super(target, miBreak);
}
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.core.cdi.model.ICDIExceptionpoint#isStopOnThrow()
*/
public boolean isStopOnThrow() {
return fStopOnThrow;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.core.cdi.model.ICDIExceptionpoint#isStopOnCatch()
*/
public boolean isStopOnCatch() {
return fStopOnCatch;
}
}

View file

@ -107,10 +107,8 @@ public class Thread extends CObject implements ICDIThread {
if (currentFrames == null || currentFrames.size() < depth) {
currentFrames = new ArrayList();
Target target = (Target)getTarget();
Session session = (Session) target.getSession();
Target currentTarget = (Target) session.getCurrentTarget();
ICDIThread currentThread = currentTarget.getCurrentThread();
currentTarget.setCurrentThread(this, false);
ICDIThread currentThread = target.getCurrentThread();
target.setCurrentThread(this, false);
try {
MISession mi = target.getMISession();
CommandFactory factory = mi.getCommandFactory();
@ -131,7 +129,7 @@ public class Thread extends CObject implements ICDIThread {
//throw e;
//System.out.println(e);
} finally {
currentTarget.setCurrentThread(currentThread, false);
target.setCurrentThread(currentThread, false);
}
// assign the currentFrame if it was not done yet.
if (currentFrame == null) {
@ -152,10 +150,8 @@ public class Thread extends CObject implements ICDIThread {
public int getStackFrameCount() throws CDIException {
if (stackdepth == 0) {
Target target = (Target)getTarget();
Session session = (Session) (target.getSession());
Target currentTarget = (Target) session.getCurrentTarget();
ICDIThread currentThread = currentTarget.getCurrentThread();
currentTarget.setCurrentThread(this, false);
ICDIThread currentThread = target.getCurrentThread();
target.setCurrentThread(this, false);
try {
MISession mi = target.getMISession();
CommandFactory factory = mi.getCommandFactory();
@ -185,7 +181,7 @@ public class Thread extends CObject implements ICDIThread {
} catch (MIException e) {
throw new MI2CDIException(e);
} finally {
currentTarget.setCurrentThread(currentThread, false);
target.setCurrentThread(currentThread, false);
}
}
return stackdepth;
@ -198,10 +194,8 @@ public class Thread extends CObject implements ICDIThread {
if (currentFrames == null || currentFrames.size() < high) {
currentFrames = new ArrayList();
Target target = (Target) getTarget();
Session session = (Session) target.getSession();
Target currentTarget = (Target) session.getCurrentTarget();
ICDIThread currentThread = currentTarget.getCurrentThread();
currentTarget.setCurrentThread(this, false);
ICDIThread currentThread = target.getCurrentThread();
target.setCurrentThread(this, false);
try {
int depth = getStackFrameCount();
int upperBound;
@ -233,7 +227,7 @@ public class Thread extends CObject implements ICDIThread {
//throw e;
//System.out.println(e);
} finally {
currentTarget.setCurrentThread(currentThread, false);
target.setCurrentThread(currentThread, false);
}
// take time to assign the currentFrame, if it is in the set
if (currentFrame == null) {
@ -266,15 +260,18 @@ public class Thread extends CObject implements ICDIThread {
}
// Check to see if we are already at this level
ICDIStackFrame current = getCurrentStackFrame();
if (current != null && current.getLevel() == frameLevel) {
if (currentFrame != null && currentFrame.getLevel() == frameLevel) {
if (stackframe != null) {
Thread aThread = (Thread)stackframe.getThread();
if (aThread != null && aThread.getId() == getId()) {
// noop
return;
}
}
}
try {
Target target = (Target)getTarget();
Session session = (Session) target.getSession();
MISession mi = target.getMISession();
CommandFactory factory = mi.getCommandFactory();
// Need the GDB/MI view of level which is the reverse, i.e. the highest level is 0
@ -282,7 +279,7 @@ public class Thread extends CObject implements ICDIThread {
int miLevel = getStackFrameCount() - frameLevel;
MIStackSelectFrame frame = factory.createMIStackSelectFrame(miLevel);
// Set ourself as the current thread first.
((Target) getTarget()).setCurrentThread(this, doUpdate);
target.setCurrentThread(this, doUpdate);
mi.postCommand(frame);
MIInfo info = frame.getMIInfo();
if (info == null) {
@ -293,6 +290,7 @@ public class Thread extends CObject implements ICDIThread {
// some variables like registers. Call an update()
// To generate changeEvents.
if (doUpdate) {
Session session = (Session) target.getSession();
RegisterManager regMgr = (RegisterManager) session.getRegisterManager();
if (regMgr.isAutoUpdate()) {
regMgr.update(target);

View file

@ -0,0 +1,29 @@
/**********************************************************************
* Copyright (c) 2002,2003,2004 QNX Software Systems and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/cpl-v10.html
*
* Contributors:
* QNX Software Systems - Initial API and implementation
***********************************************************************/
package org.eclipse.cdt.debug.mi.core.event;
import org.eclipse.cdt.debug.mi.core.MISession;
/**
* MIInferiorCreatedEvent
*/
public class MIInferiorCreatedEvent extends MICreatedEvent {
/**
* @param source
* @param id
*/
public MIInferiorCreatedEvent(MISession source, int id) {
super(source, id);
}
}

View file

@ -7,6 +7,7 @@ package org.eclipse.cdt.debug.mi.core;
import org.eclipse.cdt.debug.core.cdi.CDIException;
import org.eclipse.cdt.debug.core.cdi.ICDISession;
import org.eclipse.cdt.debug.core.cdi.model.ICDITarget;
import org.eclipse.cdt.debug.mi.core.cdi.Session;
import org.eclipse.cdt.debug.mi.core.cdi.model.Target;
import org.eclipse.cdt.debug.mi.core.command.CommandFactory;
@ -34,7 +35,9 @@ public class CygwinGDBDebugger extends GDBDebugger {
boolean failed = false;
try {
session = (Session) super.createLaunchSession(config, exe);
Target target = (Target)session.getCurrentTarget();
ICDITarget[] targets = session.getTargets();
for (int i = 0; i < targets.length; ++i) {
Target target = (Target)targets[i];
MISession miSession = target.getMISession();
miSession.setCommandFactory(commandFactory);
// For windows we need to start the inferior in a new console window
@ -51,6 +54,7 @@ public class CygwinGDBDebugger extends GDBDebugger {
// We ignore this exception, for example
// on GNU/Linux the new-console is an error.
}
}
return session;
} catch (CDIException e) {
failed = true;
@ -73,8 +77,11 @@ public class CygwinGDBDebugger extends GDBDebugger {
boolean failed = false;
try {
session = (Session) super.createAttachSession(config, exe, pid);
Target target = (Target)session.getCurrentTarget();
ICDITarget[] targets = session.getTargets();
for (int i = 0; i < targets.length; ++i) {
Target target = (Target)targets[i];
target.getMISession().setCommandFactory(commandFactory);
}
initializeLibraries(config, session);
return session;
} catch (CDIException e) {
@ -98,8 +105,11 @@ public class CygwinGDBDebugger extends GDBDebugger {
boolean failed = false;
try {
session = (Session) super.createCoreSession(config, exe, corefile);
Target target = (Target)session.getCurrentTarget();
ICDITarget[] targets = session.getTargets();
for (int i = 0; i < targets.length; ++i) {
Target target = (Target)targets[i];
target.getMISession().setCommandFactory(commandFactory);
}
initializeLibraries(config, session);
return session;
} catch (CDIException e) {

View file

@ -54,7 +54,6 @@ public class EventThread extends Thread {
void processSuspendedEvent(MIStoppedEvent stopped) {
// give a chance also to the underlying inferior.
session.getMIInferior().update();
}
}

View file

@ -20,6 +20,7 @@ import org.eclipse.cdt.debug.core.ICDebugger;
import org.eclipse.cdt.debug.core.cdi.CDIException;
import org.eclipse.cdt.debug.core.cdi.ICDISession;
import org.eclipse.cdt.debug.core.cdi.ICDISharedLibraryManager;
import org.eclipse.cdt.debug.core.cdi.model.ICDITarget;
import org.eclipse.cdt.debug.mi.core.cdi.Session;
import org.eclipse.cdt.debug.mi.core.cdi.SharedLibraryManager;
import org.eclipse.cdt.debug.mi.core.cdi.model.Target;
@ -77,7 +78,9 @@ public class GDBServerDebugger implements ICDebugger {
String remote = config.getAttribute(IGDBServerMILaunchConfigurationConstants.ATTR_DEV, "invalid"); //$NON-NLS-1$
String remoteBaud = config.getAttribute(IGDBServerMILaunchConfigurationConstants.ATTR_DEV_SPEED, "invalid"); //$NON-NLS-1$
session = (Session)MIPlugin.getDefault().createCSession(gdb, exe.getLocation().toFile(), -1, null, cwd, gdbinit);
Target target = (Target)session.getCurrentTarget();
ICDITarget[] targets = session.getTargets();
for (int i = 0; i < targets.length; ++i) {
Target target = (Target)targets[i];
MISession miSession = target.getMISession();
CommandFactory factory = miSession.getCommandFactory();
MIGDBSet setRemoteBaud = factory.createMIGDBSet(new String[]{"remotebaud", remoteBaud}); //$NON-NLS-1$
@ -94,6 +97,7 @@ public class GDBServerDebugger implements ICDebugger {
throw new MIException (MIPlugin.getResourceString("src.common.No_answer")); //$NON-NLS-1$
}
}
}
initializeLibraries(config, session);
return session;
} catch (IOException e) {