mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Rename of CTarget to Target
CSession to session CThread to Thread.
This commit is contained in:
parent
8e125546ce
commit
4a1e38ac3a
42 changed files with 1452 additions and 834 deletions
|
@ -1,3 +1,70 @@
|
||||||
|
2003-01-26 Alain Magloire
|
||||||
|
|
||||||
|
Major refactor of the code. Rewrote/Added Managers:
|
||||||
|
VariableManager
|
||||||
|
ExpressionManager
|
||||||
|
RegisterManager
|
||||||
|
UpdateManager.
|
||||||
|
|
||||||
|
Refactor of CSession to Session, CTarget to Target
|
||||||
|
and CThread to Thread.
|
||||||
|
* src/.../mi/core/cdi/event/ChangedEvent.java:
|
||||||
|
* src/.../mi/core/cdi/event/CreatedEvent.java:
|
||||||
|
* src/.../mi/core/cdi/event/DestroyedEvent.java:
|
||||||
|
* src/.../mi/core/cdi/event/DisconnectedEvent.java:
|
||||||
|
* src/.../mi/core/cdi/event/ExitedEvent.java:
|
||||||
|
* src/.../mi/core/cdi/event/MemoryChangedEvent.java:
|
||||||
|
* src/.../mi/core/cdi/event/ResumedEvent.java:
|
||||||
|
* src/.../mi/core/cdi/event/SuspendedEvent.java:
|
||||||
|
|
||||||
|
|
||||||
|
* src/.../mi/core/cdi/model/Argument.java:
|
||||||
|
* src/.../mi/core/cdi/model/Breakpoint.java:
|
||||||
|
* src/.../mi/core/cdi/model/Thread.java:
|
||||||
|
* src/.../mi/core/cdi/model/Target.java:
|
||||||
|
* src/.../mi/core/cdi/model/MemoryBlock.java:
|
||||||
|
* src/.../mi/core/cdi/model/MixedInstruction.java:
|
||||||
|
* src/.../mi/core/cdi/model/Instruction.java:
|
||||||
|
* src/.../mi/core/cdi/model/Signal.java:
|
||||||
|
* src/.../mi/core/cdi/model/SharedLibrary.java:
|
||||||
|
* src/.../mi/core/cdi/model/CObject.java:
|
||||||
|
* src/.../mi/core/cdi/model/Expression.java:
|
||||||
|
* src/.../mi/core/cdi/model/Variable.java:
|
||||||
|
* src/.../mi/core/cdi/model/Value.java:
|
||||||
|
* src/.../mi/core/cdi/model/Register.java:
|
||||||
|
* src/.../mi/core/cdi/model/StackFrame.java:
|
||||||
|
|
||||||
|
* src/.../mi/core/cdi/ArgumentObject.java:
|
||||||
|
* src/.../mi/core/cdi/VariableObject.java:
|
||||||
|
* src/.../mi/core/cdi/RegisterObject.java:
|
||||||
|
* src/.../mi/core/cdi/BreakpointHit.java:
|
||||||
|
* src/.../mi/core/cdi/BreakpointManager.java:
|
||||||
|
* src/.../mi/core/cdi/VariableManager.java:
|
||||||
|
* src/.../mi/core/cdi/ExpressionManager.java:
|
||||||
|
* src/.../mi/core/cdi/RegisterManaget.java:
|
||||||
|
* src/.../mi/core/cdi/SignalManager.java:
|
||||||
|
* src/.../mi/core/cdi/SharedLibraryManager.java:
|
||||||
|
* src/.../mi/core/cdi/EventManager.java:
|
||||||
|
* src/.../mi/core/cdi/MemoryManager.java:
|
||||||
|
* src/.../mi/core/cdi/ErrorInfo.java:
|
||||||
|
* src/.../mi/core/cdi/Session.java:
|
||||||
|
* src/.../mi/core/cdi/ExitInfo.java:
|
||||||
|
* src/.../mi/core/cdi/UpdateManager.java:
|
||||||
|
* src/.../mi/core/cdi/IUpdateListener.java:
|
||||||
|
* src/.../mi/core/cdi/SessionObject.java:
|
||||||
|
* src/.../mi/core/cdi/SignalReceived.java:
|
||||||
|
* src/.../mi/core/cdi/SourceManager.java:
|
||||||
|
* src/.../mi/core/cdi/RuntimeOptions.java:
|
||||||
|
* src/.../mi/core/cdi/WatchpointScope.java:
|
||||||
|
* src/.../mi/core/cdi/WatchpointTrigger.java:
|
||||||
|
* src/.../mi/core/cdi/EndSteppingRange.java:
|
||||||
|
|
||||||
|
* src/.../mi/core/MIPlugin.java:
|
||||||
|
* src/.../mi/core/CygwinGDBDebugger.java:
|
||||||
|
* src/.../mi/core/GDBDebugger.java:
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
2003-01-24 Alain Magloire
|
2003-01-24 Alain Magloire
|
||||||
|
|
||||||
* src/.../mi/core/CLIProcessor.java (isEnableBreakpoint):
|
* src/.../mi/core/CLIProcessor.java (isEnableBreakpoint):
|
||||||
|
|
|
@ -7,7 +7,7 @@ package org.eclipse.cdt.debug.mi.core;
|
||||||
|
|
||||||
import org.eclipse.cdt.debug.core.cdi.CDIException;
|
import org.eclipse.cdt.debug.core.cdi.CDIException;
|
||||||
import org.eclipse.cdt.debug.core.cdi.ICDISession;
|
import org.eclipse.cdt.debug.core.cdi.ICDISession;
|
||||||
import org.eclipse.cdt.debug.mi.core.cdi.CSession;
|
import org.eclipse.cdt.debug.mi.core.cdi.Session;
|
||||||
import org.eclipse.cdt.debug.mi.core.command.CommandFactory;
|
import org.eclipse.cdt.debug.mi.core.command.CommandFactory;
|
||||||
import org.eclipse.cdt.debug.mi.core.command.CygwinCommandFactory;
|
import org.eclipse.cdt.debug.mi.core.command.CygwinCommandFactory;
|
||||||
import org.eclipse.cdt.debug.mi.core.command.MIGDBSet;
|
import org.eclipse.cdt.debug.mi.core.command.MIGDBSet;
|
||||||
|
@ -26,14 +26,14 @@ public class CygwinGDBDebugger extends GDBDebugger {
|
||||||
new CygwinCommandFactory();
|
new CygwinCommandFactory();
|
||||||
|
|
||||||
/* Cygwin does not have any special initialization like solib paths etc.. */
|
/* Cygwin does not have any special initialization like solib paths etc.. */
|
||||||
protected void initializeLibraries(ILaunchConfiguration config, CSession session) throws CDIException {
|
protected void initializeLibraries(ILaunchConfiguration config, Session session) throws CDIException {
|
||||||
}
|
}
|
||||||
|
|
||||||
public ICDISession createLaunchSession(
|
public ICDISession createLaunchSession(
|
||||||
ILaunchConfiguration config,
|
ILaunchConfiguration config,
|
||||||
IFile exe)
|
IFile exe)
|
||||||
throws CDIException {
|
throws CDIException {
|
||||||
CSession session = (CSession) super.createLaunchSession(config, exe);
|
Session session = (Session) super.createLaunchSession(config, exe);
|
||||||
session.getMISession().setCommandFactory(commandFactory);
|
session.getMISession().setCommandFactory(commandFactory);
|
||||||
// For windows we need to start the inferior in a new console window
|
// For windows we need to start the inferior in a new console window
|
||||||
// to separate the Inferior std{in,out,err} from gdb std{in,out,err}
|
// to separate the Inferior std{in,out,err} from gdb std{in,out,err}
|
||||||
|
@ -58,8 +58,8 @@ public class CygwinGDBDebugger extends GDBDebugger {
|
||||||
IFile exe,
|
IFile exe,
|
||||||
int pid)
|
int pid)
|
||||||
throws CDIException {
|
throws CDIException {
|
||||||
CSession session =
|
Session session =
|
||||||
(CSession) super.createAttachSession(config, exe, pid);
|
(Session) super.createAttachSession(config, exe, pid);
|
||||||
session.getMISession().setCommandFactory(commandFactory);
|
session.getMISession().setCommandFactory(commandFactory);
|
||||||
return session;
|
return session;
|
||||||
}
|
}
|
||||||
|
@ -69,8 +69,8 @@ public class CygwinGDBDebugger extends GDBDebugger {
|
||||||
IFile exe,
|
IFile exe,
|
||||||
IPath corefile)
|
IPath corefile)
|
||||||
throws CDIException {
|
throws CDIException {
|
||||||
CSession session =
|
Session session =
|
||||||
(CSession) super.createCoreSession(config, exe, corefile);
|
(Session) super.createCoreSession(config, exe, corefile);
|
||||||
session.getMISession().setCommandFactory(commandFactory);
|
session.getMISession().setCommandFactory(commandFactory);
|
||||||
return session;
|
return session;
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,7 +12,7 @@ import java.util.List;
|
||||||
import org.eclipse.cdt.debug.core.ICDebugger;
|
import org.eclipse.cdt.debug.core.ICDebugger;
|
||||||
import org.eclipse.cdt.debug.core.cdi.CDIException;
|
import org.eclipse.cdt.debug.core.cdi.CDIException;
|
||||||
import org.eclipse.cdt.debug.core.cdi.ICDISession;
|
import org.eclipse.cdt.debug.core.cdi.ICDISession;
|
||||||
import org.eclipse.cdt.debug.mi.core.cdi.CSession;
|
import org.eclipse.cdt.debug.mi.core.cdi.Session;
|
||||||
import org.eclipse.cdt.debug.mi.core.cdi.SourceManager;
|
import org.eclipse.cdt.debug.mi.core.cdi.SourceManager;
|
||||||
import org.eclipse.core.resources.IFile;
|
import org.eclipse.core.resources.IFile;
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
|
@ -21,7 +21,7 @@ import org.eclipse.debug.core.ILaunchConfiguration;
|
||||||
|
|
||||||
public class GDBDebugger implements ICDebugger {
|
public class GDBDebugger implements ICDebugger {
|
||||||
|
|
||||||
protected void initializeLibraries(ILaunchConfiguration config, CSession session) throws CDIException {
|
protected void initializeLibraries(ILaunchConfiguration config, Session session) throws CDIException {
|
||||||
try {
|
try {
|
||||||
SourceManager mgr = (SourceManager)session.getSourceManager();
|
SourceManager mgr = (SourceManager)session.getSourceManager();
|
||||||
boolean autolib = config.getAttribute(IMILaunchConfigurationConstants.ATTR_AUTO_SOLIB, true);
|
boolean autolib = config.getAttribute(IMILaunchConfigurationConstants.ATTR_AUTO_SOLIB, true);
|
||||||
|
@ -41,7 +41,7 @@ public class GDBDebugger implements ICDebugger {
|
||||||
String gdb = config.getAttribute(IMILaunchConfigurationConstants.ATTR_DEBUG_NAME, "gdb");
|
String gdb = config.getAttribute(IMILaunchConfigurationConstants.ATTR_DEBUG_NAME, "gdb");
|
||||||
File cwd = exe.getProject().getLocation().toFile();
|
File cwd = exe.getProject().getLocation().toFile();
|
||||||
String gdbinit = config.getAttribute(IMILaunchConfigurationConstants.ATTR_GDB_INIT, ".gdbinit");
|
String gdbinit = config.getAttribute(IMILaunchConfigurationConstants.ATTR_GDB_INIT, ".gdbinit");
|
||||||
CSession session = (CSession)MIPlugin.getDefault().createCSession(gdb, exe.getLocation().toFile(), cwd, gdbinit);
|
Session session = (Session)MIPlugin.getDefault().createCSession(gdb, exe.getLocation().toFile(), cwd, gdbinit);
|
||||||
initializeLibraries(config, session);
|
initializeLibraries(config, session);
|
||||||
return session;
|
return session;
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
|
@ -58,7 +58,7 @@ public class GDBDebugger implements ICDebugger {
|
||||||
String gdb = config.getAttribute(IMILaunchConfigurationConstants.ATTR_DEBUG_NAME, "gdb");
|
String gdb = config.getAttribute(IMILaunchConfigurationConstants.ATTR_DEBUG_NAME, "gdb");
|
||||||
File cwd = exe.getProject().getLocation().toFile();
|
File cwd = exe.getProject().getLocation().toFile();
|
||||||
String gdbinit = config.getAttribute(IMILaunchConfigurationConstants.ATTR_GDB_INIT, ".gdbinit");
|
String gdbinit = config.getAttribute(IMILaunchConfigurationConstants.ATTR_GDB_INIT, ".gdbinit");
|
||||||
CSession session = (CSession)MIPlugin.getDefault().createCSession(gdb, exe.getLocation().toFile(), pid, null, cwd, gdbinit);
|
Session session = (Session)MIPlugin.getDefault().createCSession(gdb, exe.getLocation().toFile(), pid, null, cwd, gdbinit);
|
||||||
initializeLibraries(config, session);
|
initializeLibraries(config, session);
|
||||||
return session;
|
return session;
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
|
@ -76,7 +76,7 @@ public class GDBDebugger implements ICDebugger {
|
||||||
String gdb = config.getAttribute(IMILaunchConfigurationConstants.ATTR_DEBUG_NAME, "gdb");
|
String gdb = config.getAttribute(IMILaunchConfigurationConstants.ATTR_DEBUG_NAME, "gdb");
|
||||||
File cwd = exe.getProject().getLocation().toFile();
|
File cwd = exe.getProject().getLocation().toFile();
|
||||||
String gdbinit = config.getAttribute(IMILaunchConfigurationConstants.ATTR_GDB_INIT, ".gdbinit");
|
String gdbinit = config.getAttribute(IMILaunchConfigurationConstants.ATTR_GDB_INIT, ".gdbinit");
|
||||||
CSession session = (CSession)MIPlugin.getDefault().createCSession(gdb, exe.getLocation().toFile(), corefile.toFile(), cwd, gdbinit);
|
Session session = (Session)MIPlugin.getDefault().createCSession(gdb, exe.getLocation().toFile(), corefile.toFile(), cwd, gdbinit);
|
||||||
initializeLibraries(config, session);
|
initializeLibraries(config, session);
|
||||||
return session;
|
return session;
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
|
|
|
@ -8,7 +8,7 @@ import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
import org.eclipse.cdt.debug.core.cdi.ICDISession;
|
import org.eclipse.cdt.debug.core.cdi.ICDISession;
|
||||||
import org.eclipse.cdt.debug.mi.core.cdi.CSession;
|
import org.eclipse.cdt.debug.mi.core.cdi.Session;
|
||||||
import org.eclipse.cdt.debug.mi.core.command.CLICommand;
|
import org.eclipse.cdt.debug.mi.core.command.CLICommand;
|
||||||
import org.eclipse.cdt.debug.mi.core.command.CommandFactory;
|
import org.eclipse.cdt.debug.mi.core.command.CommandFactory;
|
||||||
import org.eclipse.cdt.debug.mi.core.command.MITargetAttach;
|
import org.eclipse.cdt.debug.mi.core.command.MITargetAttach;
|
||||||
|
@ -144,7 +144,7 @@ public class MIPlugin extends Plugin {
|
||||||
// If an exception is thrown that means ok
|
// If an exception is thrown that means ok
|
||||||
// we did not attach to any target.
|
// we did not attach to any target.
|
||||||
}
|
}
|
||||||
return new CSession(session, false);
|
return new Session(session, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -171,7 +171,7 @@ public class MIPlugin extends Plugin {
|
||||||
}
|
}
|
||||||
Process pgdb = ProcessFactory.getFactory().exec(args);
|
Process pgdb = ProcessFactory.getFactory().exec(args);
|
||||||
MISession session = createMISession(pgdb, null, MISession.CORE);
|
MISession session = createMISession(pgdb, null, MISession.CORE);
|
||||||
return new CSession(session);
|
return new Session(session);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -216,7 +216,7 @@ public class MIPlugin extends Plugin {
|
||||||
}
|
}
|
||||||
//@@@ We have to manually set the suspended state when we attach
|
//@@@ We have to manually set the suspended state when we attach
|
||||||
session.getMIInferior().setSuspended();
|
session.getMIInferior().setSuspended();
|
||||||
return new CSession(session, true);
|
return new Session(session, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -0,0 +1,20 @@
|
||||||
|
/*
|
||||||
|
*(c) Copyright QNX Software Systems Ltd. 2002.
|
||||||
|
* All Rights Reserved.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
package org.eclipse.cdt.debug.mi.core.cdi;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.debug.core.cdi.ICDIArgumentObject;
|
||||||
|
import org.eclipse.cdt.debug.mi.core.cdi.model.StackFrame;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*/
|
||||||
|
public class ArgumentObject extends VariableObject implements ICDIArgumentObject {
|
||||||
|
|
||||||
|
public ArgumentObject(String name, StackFrame frame, int pos, int depth) {
|
||||||
|
super(name, frame, pos, depth);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -16,7 +16,7 @@ public class BreakpointHit extends SessionObject implements ICDIBreakpointHit {
|
||||||
|
|
||||||
MIBreakpointHitEvent breakEvent;
|
MIBreakpointHitEvent breakEvent;
|
||||||
|
|
||||||
public BreakpointHit(CSession session, MIBreakpointHitEvent e) {
|
public BreakpointHit(Session session, MIBreakpointHitEvent e) {
|
||||||
super(session);
|
super(session);
|
||||||
breakEvent = e;
|
breakEvent = e;
|
||||||
}
|
}
|
||||||
|
@ -27,7 +27,7 @@ public class BreakpointHit extends SessionObject implements ICDIBreakpointHit {
|
||||||
public ICDIBreakpoint getBreakpoint() {
|
public ICDIBreakpoint getBreakpoint() {
|
||||||
int number = breakEvent.getNumber();
|
int number = breakEvent.getNumber();
|
||||||
// Ask the breakpointManager for the breakpoint
|
// Ask the breakpointManager for the breakpoint
|
||||||
BreakpointManager mgr = (BreakpointManager)getCSession().getBreakpointManager();
|
BreakpointManager mgr = (BreakpointManager)getSession().getBreakpointManager();
|
||||||
// We need to return the same object as the breakpoint.
|
// We need to return the same object as the breakpoint.
|
||||||
Breakpoint point = mgr.getBreakpoint(number);
|
Breakpoint point = mgr.getBreakpoint(number);
|
||||||
// FIXME: if point == null ?? Create a new breakpoint ??
|
// FIXME: if point == null ?? Create a new breakpoint ??
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
package org.eclipse.cdt.debug.mi.core.cdi;
|
package org.eclipse.cdt.debug.mi.core.cdi;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.eclipse.cdt.debug.core.cdi.CDIException;
|
import org.eclipse.cdt.debug.core.cdi.CDIException;
|
||||||
|
@ -16,11 +17,12 @@ import org.eclipse.cdt.debug.core.cdi.ICDILocation;
|
||||||
import org.eclipse.cdt.debug.core.cdi.model.ICDIBreakpoint;
|
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.ICDICatchpoint;
|
||||||
import org.eclipse.cdt.debug.core.cdi.model.ICDILocationBreakpoint;
|
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;
|
import org.eclipse.cdt.debug.core.cdi.model.ICDIWatchpoint;
|
||||||
import org.eclipse.cdt.debug.mi.core.MIException;
|
import org.eclipse.cdt.debug.mi.core.MIException;
|
||||||
import org.eclipse.cdt.debug.mi.core.MISession;
|
import org.eclipse.cdt.debug.mi.core.MISession;
|
||||||
import org.eclipse.cdt.debug.mi.core.cdi.model.Breakpoint;
|
import org.eclipse.cdt.debug.mi.core.cdi.model.Breakpoint;
|
||||||
import org.eclipse.cdt.debug.mi.core.cdi.model.CTarget;
|
import org.eclipse.cdt.debug.mi.core.cdi.model.Target;
|
||||||
import org.eclipse.cdt.debug.mi.core.cdi.model.Watchpoint;
|
import org.eclipse.cdt.debug.mi.core.cdi.model.Watchpoint;
|
||||||
import org.eclipse.cdt.debug.mi.core.command.CommandFactory;
|
import org.eclipse.cdt.debug.mi.core.command.CommandFactory;
|
||||||
import org.eclipse.cdt.debug.mi.core.command.MIBreakAfter;
|
import org.eclipse.cdt.debug.mi.core.command.MIBreakAfter;
|
||||||
|
@ -47,18 +49,18 @@ import org.eclipse.cdt.debug.mi.core.output.MIInfo;
|
||||||
public class BreakpointManager extends SessionObject implements ICDIBreakpointManager {
|
public class BreakpointManager extends SessionObject implements ICDIBreakpointManager {
|
||||||
|
|
||||||
List breakList;
|
List breakList;
|
||||||
List delList;
|
|
||||||
boolean allowInterrupt;
|
boolean allowInterrupt;
|
||||||
|
boolean autoupdate;
|
||||||
|
|
||||||
public BreakpointManager(CSession session) {
|
public BreakpointManager(Session session) {
|
||||||
super(session);
|
super(session);
|
||||||
breakList = new ArrayList(1);
|
breakList = Collections.synchronizedList(new ArrayList());
|
||||||
delList = new ArrayList(1);
|
|
||||||
allowInterrupt = true;
|
allowInterrupt = true;
|
||||||
|
autoupdate = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public MIBreakpoint[] getMIBreakpoints() throws CDIException {
|
public MIBreakpoint[] getMIBreakpoints() throws CDIException {
|
||||||
CSession s = getCSession();
|
Session s = (Session)getSession();
|
||||||
CommandFactory factory = s.getMISession().getCommandFactory();
|
CommandFactory factory = s.getMISession().getCommandFactory();
|
||||||
MIBreakList breakpointList = factory.createMIBreakList();
|
MIBreakList breakpointList = factory.createMIBreakList();
|
||||||
try {
|
try {
|
||||||
|
@ -73,49 +75,6 @@ public class BreakpointManager extends SessionObject implements ICDIBreakpointMa
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
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();
|
|
||||||
if (containsBreakpoint(no)) {
|
|
||||||
if (hasBreakpointChanged(newMIBreakpoints[i])) {
|
|
||||||
// Fire ChangedEvent
|
|
||||||
eventList.add(new MIBreakpointChangedEvent(no));
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
// 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[j].getNumber()) {
|
|
||||||
found = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!found) {
|
|
||||||
// Fire destroyed Events.
|
|
||||||
breakList.remove(oldBreakpoints[i]);
|
|
||||||
delList.add(oldBreakpoints[i]);
|
|
||||||
eventList.add(new MIBreakpointDeletedEvent(no));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
MISession mi = getCSession().getMISession();
|
|
||||||
MIEvent[] events = (MIEvent[])eventList.toArray(new MIEvent[0]);
|
|
||||||
mi.fireEvents(events);
|
|
||||||
}
|
|
||||||
|
|
||||||
boolean containsBreakpoint(int number) {
|
boolean containsBreakpoint(int number) {
|
||||||
return (getBreakpoint(number) != null);
|
return (getBreakpoint(number) != null);
|
||||||
}
|
}
|
||||||
|
@ -152,107 +111,43 @@ public class BreakpointManager extends SessionObject implements ICDIBreakpointMa
|
||||||
}
|
}
|
||||||
|
|
||||||
Breakpoint[] listBreakpoints() {
|
Breakpoint[] listBreakpoints() {
|
||||||
return (Breakpoint[]) breakList.toArray(new Breakpoint[breakList.size()]);
|
return (Breakpoint[]) breakList.toArray(new Breakpoint[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean suspendInferior() throws CDIException {
|
boolean suspendInferior() throws CDIException {
|
||||||
boolean shouldRestart = false;
|
boolean shouldRestart = false;
|
||||||
CSession s = getCSession();
|
Session s = (Session)getSession();
|
||||||
CTarget target = s.getCTarget();
|
ICDITarget currentTarget = s.getCurrentTarget();
|
||||||
// Stop the program and disable events.
|
// Stop the program and disable events.
|
||||||
if (target.isRunning() && allowInterrupt) {
|
if (currentTarget instanceof Target) {
|
||||||
int lastToken = target.getLastExecutionToken();
|
Target target = (Target)currentTarget;
|
||||||
shouldRestart = true;
|
if (target.isRunning() && allowInterrupt) {
|
||||||
((EventManager)s.getEventManager()).disableEventToken(lastToken);
|
int lastToken = target.getLastExecutionToken();
|
||||||
target.suspend();
|
shouldRestart = true;
|
||||||
((EventManager)s.getEventManager()).enableEventToken(lastToken);
|
((EventManager)s.getEventManager()).disableEventToken(lastToken);
|
||||||
|
target.suspend();
|
||||||
|
((EventManager)s.getEventManager()).enableEventToken(lastToken);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return shouldRestart;
|
return shouldRestart;
|
||||||
}
|
}
|
||||||
|
|
||||||
void resumeInferior(boolean shouldRestart) throws CDIException {
|
void resumeInferior(boolean shouldRestart) throws CDIException {
|
||||||
if (shouldRestart) {
|
if (shouldRestart) {
|
||||||
CSession s = getCSession();
|
Session s = (Session)getSession();
|
||||||
CTarget target = s.getCTarget();
|
ICDITarget target = s.getCurrentTarget();
|
||||||
target.resume();
|
target.resume();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void deleteBreakpoint (int no) {
|
||||||
/**
|
Breakpoint[] points = listBreakpoints();
|
||||||
* @see org.eclipse.cdt.debug.core.cdi.ICDIBreakpointManager#allowProgramInterruption()
|
|
||||||
*/
|
|
||||||
public void allowProgramInterruption(boolean e) {
|
|
||||||
allowInterrupt = e;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see org.eclipse.cdt.debug.core.cdi.ICDIBreakpointManager#deleteAllBreakpoints()
|
|
||||||
*/
|
|
||||||
public void deleteAllBreakpoints() throws CDIException {
|
|
||||||
deleteBreakpoints(listBreakpoints());
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see org.eclipse.cdt.debug.core.cdi.ICDIBreakpointManager#deleteBreakpoint(ICDIBreakpoint)
|
|
||||||
*/
|
|
||||||
public void deleteBreakpoint(ICDIBreakpoint breakpoint)
|
|
||||||
throws CDIException {
|
|
||||||
deleteBreakpoints(new ICDIBreakpoint[] { breakpoint });
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see org.eclipse.cdt.debug.core.cdi.ICDIBreakpointManager#deleteBreakpoints(ICDIBreakpoint[])
|
|
||||||
*/
|
|
||||||
public void deleteBreakpoints(ICDIBreakpoint[] breakpoints) throws CDIException {
|
|
||||||
int[] numbers = new int[breakpoints.length];
|
|
||||||
for (int i = 0; i < numbers.length; i++) {
|
|
||||||
if (breakpoints[i] instanceof Breakpoint
|
|
||||||
&& breakList.contains(breakpoints[i])) {
|
|
||||||
numbers[i] =
|
|
||||||
((Breakpoint) breakpoints[i]).getMIBreakpoint().getNumber();
|
|
||||||
} else {
|
|
||||||
throw new CDIException("Not a CDT breakpoint");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
boolean state = suspendInferior();
|
|
||||||
CSession s = getCSession();
|
|
||||||
CommandFactory factory = s.getMISession().getCommandFactory();
|
|
||||||
MIBreakDelete breakDelete = factory.createMIBreakDelete(numbers);
|
|
||||||
try {
|
|
||||||
s.getMISession().postCommand(breakDelete);
|
|
||||||
MIInfo info = breakDelete.getMIInfo();
|
|
||||||
if (info == null) {
|
|
||||||
throw new CDIException("No answer");
|
|
||||||
}
|
|
||||||
} catch (MIException e) {
|
|
||||||
throw new MI2CDIException(e);
|
|
||||||
} finally {
|
|
||||||
resumeInferior(state);
|
|
||||||
}
|
|
||||||
List eventList = new ArrayList(breakpoints.length);
|
|
||||||
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));
|
|
||||||
}
|
|
||||||
MISession mi = s.getMISession();
|
|
||||||
MIEvent[] events = (MIEvent[])eventList.toArray(new MIEvent[0]);
|
|
||||||
mi.fireEvents(events);
|
|
||||||
}
|
|
||||||
|
|
||||||
public Breakpoint deleteBreakpoint (int no) {
|
|
||||||
Breakpoint point = null;
|
|
||||||
Breakpoint[] points = (Breakpoint[])delList.toArray(new Breakpoint[delList.size()]);
|
|
||||||
for (int i = 0; i < points.length; i++) {
|
for (int i = 0; i < points.length; i++) {
|
||||||
if (points[i].getMIBreakpoint().getNumber() == no) {
|
if (points[i].getMIBreakpoint().getNumber() == no) {
|
||||||
delList.remove(points[i]);
|
breakList.remove(points[i]);
|
||||||
point = points[i];
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return point;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void enableBreakpoint(ICDIBreakpoint breakpoint) throws CDIException {
|
public void enableBreakpoint(ICDIBreakpoint breakpoint) throws CDIException {
|
||||||
|
@ -264,10 +159,9 @@ public class BreakpointManager extends SessionObject implements ICDIBreakpointMa
|
||||||
throw new CDIException("Not a CDT breakpoint");
|
throw new CDIException("Not a CDT breakpoint");
|
||||||
}
|
}
|
||||||
boolean state = suspendInferior();
|
boolean state = suspendInferior();
|
||||||
CSession s = getCSession();
|
Session s = (Session)getSession();
|
||||||
CommandFactory factory = s.getMISession().getCommandFactory();
|
CommandFactory factory = s.getMISession().getCommandFactory();
|
||||||
MIBreakEnable breakEnable =
|
MIBreakEnable breakEnable = factory.createMIBreakEnable(new int[] { number });
|
||||||
factory.createMIBreakEnable(new int[] { number });
|
|
||||||
try {
|
try {
|
||||||
s.getMISession().postCommand(breakEnable);
|
s.getMISession().postCommand(breakEnable);
|
||||||
MIInfo info = breakEnable.getMIInfo();
|
MIInfo info = breakEnable.getMIInfo();
|
||||||
|
@ -295,7 +189,7 @@ public class BreakpointManager extends SessionObject implements ICDIBreakpointMa
|
||||||
throw new CDIException("Not a CDT breakpoint");
|
throw new CDIException("Not a CDT breakpoint");
|
||||||
}
|
}
|
||||||
boolean state = suspendInferior();
|
boolean state = suspendInferior();
|
||||||
CSession s = getCSession();
|
Session s = (Session)getSession();
|
||||||
CommandFactory factory = s.getMISession().getCommandFactory();
|
CommandFactory factory = s.getMISession().getCommandFactory();
|
||||||
MIBreakDisable breakDisable =
|
MIBreakDisable breakDisable =
|
||||||
factory.createMIBreakDisable(new int[] { number });
|
factory.createMIBreakDisable(new int[] { number });
|
||||||
|
@ -326,7 +220,7 @@ public class BreakpointManager extends SessionObject implements ICDIBreakpointMa
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean state = suspendInferior();
|
boolean state = suspendInferior();
|
||||||
CSession s = getCSession();
|
Session s = (Session)getSession();
|
||||||
CommandFactory factory = s.getMISession().getCommandFactory();
|
CommandFactory factory = s.getMISession().getCommandFactory();
|
||||||
|
|
||||||
// reset the values to sane states.
|
// reset the values to sane states.
|
||||||
|
@ -364,19 +258,123 @@ public class BreakpointManager extends SessionObject implements ICDIBreakpointMa
|
||||||
mi.fireEvent(new MIBreakpointChangedEvent(((Breakpoint)breakpoint).getMIBreakpoint().getNumber()));
|
mi.fireEvent(new MIBreakpointChangedEvent(((Breakpoint)breakpoint).getMIBreakpoint().getNumber()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see org.eclipse.cdt.debug.core.cdi.ICDIBreakpointManager#update()
|
||||||
|
*/
|
||||||
|
public 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();
|
||||||
|
if (containsBreakpoint(no)) {
|
||||||
|
if (hasBreakpointChanged(newMIBreakpoints[i])) {
|
||||||
|
// Fire ChangedEvent
|
||||||
|
eventList.add(new MIBreakpointChangedEvent(no));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// 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[j].getNumber()) {
|
||||||
|
found = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!found) {
|
||||||
|
// Fire destroyed Events.
|
||||||
|
eventList.add(new MIBreakpointDeletedEvent(no));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
MISession mi = ((Session)getSession()).getMISession();
|
||||||
|
MIEvent[] events = (MIEvent[])eventList.toArray(new MIEvent[0]);
|
||||||
|
mi.fireEvents(events);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see org.eclipse.cdt.debug.core.cdi.ICDIBreakpointManager#allowProgramInterruption()
|
||||||
|
*/
|
||||||
|
public void allowProgramInterruption(boolean e) {
|
||||||
|
allowInterrupt = e;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see org.eclipse.cdt.debug.core.cdi.ICDIBreakpointManager#deleteAllBreakpoints()
|
||||||
|
*/
|
||||||
|
public void deleteAllBreakpoints() throws CDIException {
|
||||||
|
deleteBreakpoints(listBreakpoints());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see org.eclipse.cdt.debug.core.cdi.ICDIBreakpointManager#deleteBreakpoint(ICDIBreakpoint)
|
||||||
|
*/
|
||||||
|
public void deleteBreakpoint(ICDIBreakpoint breakpoint) throws CDIException {
|
||||||
|
deleteBreakpoints(new ICDIBreakpoint[] { breakpoint });
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see org.eclipse.cdt.debug.core.cdi.ICDIBreakpointManager#deleteBreakpoints(ICDIBreakpoint[])
|
||||||
|
*/
|
||||||
|
public void deleteBreakpoints(ICDIBreakpoint[] breakpoints) throws CDIException {
|
||||||
|
int[] numbers = new int[breakpoints.length];
|
||||||
|
for (int i = 0; i < numbers.length; i++) {
|
||||||
|
if (breakpoints[i] instanceof Breakpoint
|
||||||
|
&& breakList.contains(breakpoints[i])) {
|
||||||
|
numbers[i] =
|
||||||
|
((Breakpoint) breakpoints[i]).getMIBreakpoint().getNumber();
|
||||||
|
} else {
|
||||||
|
throw new CDIException("Not a CDT breakpoint");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
boolean state = suspendInferior();
|
||||||
|
Session s = (Session)getSession();
|
||||||
|
CommandFactory factory = s.getMISession().getCommandFactory();
|
||||||
|
MIBreakDelete breakDelete = factory.createMIBreakDelete(numbers);
|
||||||
|
try {
|
||||||
|
s.getMISession().postCommand(breakDelete);
|
||||||
|
MIInfo info = breakDelete.getMIInfo();
|
||||||
|
if (info == null) {
|
||||||
|
throw new CDIException("No answer");
|
||||||
|
}
|
||||||
|
} catch (MIException e) {
|
||||||
|
throw new MI2CDIException(e);
|
||||||
|
} finally {
|
||||||
|
resumeInferior(state);
|
||||||
|
}
|
||||||
|
List eventList = new ArrayList(breakpoints.length);
|
||||||
|
for (int i = 0; i < breakpoints.length; i++) {
|
||||||
|
int no = ((Breakpoint)breakpoints[i]).getMIBreakpoint().getNumber();
|
||||||
|
eventList.add(new MIBreakpointDeletedEvent(no));
|
||||||
|
}
|
||||||
|
MISession mi = s.getMISession();
|
||||||
|
MIEvent[] events = (MIEvent[])eventList.toArray(new MIEvent[0]);
|
||||||
|
mi.fireEvents(events);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see org.eclipse.cdt.debug.core.cdi.ICDIBreakpointManager#getBreakpoints()
|
* @see org.eclipse.cdt.debug.core.cdi.ICDIBreakpointManager#getBreakpoints()
|
||||||
*/
|
*/
|
||||||
public ICDIBreakpoint[] getBreakpoints() throws CDIException {
|
public ICDIBreakpoint[] getBreakpoints() throws CDIException {
|
||||||
update();
|
update();
|
||||||
return (ICDIBreakpoint[]) listBreakpoints();
|
return (ICDIBreakpoint[]) breakList.toArray(new ICDIBreakpoint[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see org.eclipse.cdt.debug.core.cdi.ICDIBreakpointManager#getBreakpoints()
|
* @see org.eclipse.cdt.debug.core.cdi.ICDIBreakpointManager#getBreakpoints()
|
||||||
*/
|
*/
|
||||||
// public ICDIBreakpoint[] getBreakpoints() throws CDIException {
|
// public ICDIBreakpoint[] getBreakpoints() throws CDIException {
|
||||||
// CSession s = getCSession();
|
// Session s = getCSession();
|
||||||
// CommandFactory factory = s.getMISession().getCommandFactory();
|
// CommandFactory factory = s.getMISession().getCommandFactory();
|
||||||
// MIBreakList breakpointList = factory.createMIBreakList();
|
// MIBreakList breakpointList = factory.createMIBreakList();
|
||||||
// try {
|
// try {
|
||||||
|
@ -443,7 +441,7 @@ public class BreakpointManager extends SessionObject implements ICDIBreakpointMa
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean state = suspendInferior();
|
boolean state = suspendInferior();
|
||||||
CSession s = getCSession();
|
Session s = (Session)getSession();
|
||||||
CommandFactory factory = s.getMISession().getCommandFactory();
|
CommandFactory factory = s.getMISession().getCommandFactory();
|
||||||
MIBreakInsert breakInsert =
|
MIBreakInsert breakInsert =
|
||||||
factory.createMIBreakInsert( temporary, hardware, exprCond,
|
factory.createMIBreakInsert( temporary, hardware, exprCond,
|
||||||
|
@ -483,7 +481,7 @@ public class BreakpointManager extends SessionObject implements ICDIBreakpointMa
|
||||||
boolean read = ( !((watchType & ICDIWatchpoint.WRITE) == ICDIWatchpoint.WRITE) &&
|
boolean read = ( !((watchType & ICDIWatchpoint.WRITE) == ICDIWatchpoint.WRITE) &&
|
||||||
(watchType & ICDIWatchpoint.READ) == ICDIWatchpoint.READ );
|
(watchType & ICDIWatchpoint.READ) == ICDIWatchpoint.READ );
|
||||||
boolean state = suspendInferior();
|
boolean state = suspendInferior();
|
||||||
CSession s = getCSession();
|
Session s = (Session)getSession();
|
||||||
CommandFactory factory = s.getMISession().getCommandFactory();
|
CommandFactory factory = s.getMISession().getCommandFactory();
|
||||||
MIBreakWatch breakWatch =
|
MIBreakWatch breakWatch =
|
||||||
factory.createMIBreakWatch(access, read, expression);
|
factory.createMIBreakWatch(access, read, expression);
|
||||||
|
@ -533,4 +531,18 @@ public class BreakpointManager extends SessionObject implements ICDIBreakpointMa
|
||||||
return new Location(address);
|
return new Location(address);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see org.eclipse.cdt.debug.core.cdi.ICDIBreakpointManager#isAutoUpdate()
|
||||||
|
*/
|
||||||
|
public boolean isAutoUpdate() {
|
||||||
|
return autoupdate;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see org.eclipse.cdt.debug.core.cdi.ICDIBreakpointManager#setAutoUpdate(boolean)
|
||||||
|
*/
|
||||||
|
public void setAutoUpdate(boolean update) {
|
||||||
|
autoupdate = update;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,7 +11,7 @@ import org.eclipse.cdt.debug.core.cdi.ICDIEndSteppingRange;
|
||||||
*/
|
*/
|
||||||
public class EndSteppingRange extends SessionObject implements ICDIEndSteppingRange {
|
public class EndSteppingRange extends SessionObject implements ICDIEndSteppingRange {
|
||||||
|
|
||||||
public EndSteppingRange(CSession session) {
|
public EndSteppingRange(Session session) {
|
||||||
super(session);
|
super(session);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,7 +9,7 @@ public class ErrorInfo extends SessionObject implements ICDIErrorInfo {
|
||||||
|
|
||||||
MIErrorEvent event;
|
MIErrorEvent event;
|
||||||
|
|
||||||
public ErrorInfo(CSession session, MIErrorEvent e) {
|
public ErrorInfo(Session session, MIErrorEvent e) {
|
||||||
super(session);
|
super(session);
|
||||||
event = e;
|
event = e;
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,9 +12,18 @@ import java.util.Observable;
|
||||||
import java.util.Observer;
|
import java.util.Observer;
|
||||||
|
|
||||||
import org.eclipse.cdt.debug.core.cdi.CDIException;
|
import org.eclipse.cdt.debug.core.cdi.CDIException;
|
||||||
|
import org.eclipse.cdt.debug.core.cdi.ICDIBreakpointManager;
|
||||||
import org.eclipse.cdt.debug.core.cdi.ICDIEventManager;
|
import org.eclipse.cdt.debug.core.cdi.ICDIEventManager;
|
||||||
|
import org.eclipse.cdt.debug.core.cdi.ICDIExpressionManager;
|
||||||
|
import org.eclipse.cdt.debug.core.cdi.ICDIMemoryManager;
|
||||||
|
import org.eclipse.cdt.debug.core.cdi.ICDIRegisterManager;
|
||||||
|
import org.eclipse.cdt.debug.core.cdi.ICDISharedLibraryManager;
|
||||||
|
import org.eclipse.cdt.debug.core.cdi.ICDISignalManager;
|
||||||
|
import org.eclipse.cdt.debug.core.cdi.ICDISourceManager;
|
||||||
|
import org.eclipse.cdt.debug.core.cdi.ICDIVariableManager;
|
||||||
import org.eclipse.cdt.debug.core.cdi.event.ICDIEvent;
|
import org.eclipse.cdt.debug.core.cdi.event.ICDIEvent;
|
||||||
import org.eclipse.cdt.debug.core.cdi.event.ICDIEventListener;
|
import org.eclipse.cdt.debug.core.cdi.event.ICDIEventListener;
|
||||||
|
import org.eclipse.cdt.debug.core.cdi.model.ICDITarget;
|
||||||
import org.eclipse.cdt.debug.mi.core.cdi.event.ChangedEvent;
|
import org.eclipse.cdt.debug.mi.core.cdi.event.ChangedEvent;
|
||||||
import org.eclipse.cdt.debug.mi.core.cdi.event.CreatedEvent;
|
import org.eclipse.cdt.debug.mi.core.cdi.event.CreatedEvent;
|
||||||
import org.eclipse.cdt.debug.mi.core.cdi.event.DestroyedEvent;
|
import org.eclipse.cdt.debug.mi.core.cdi.event.DestroyedEvent;
|
||||||
|
@ -23,8 +32,8 @@ import org.eclipse.cdt.debug.mi.core.cdi.event.ExitedEvent;
|
||||||
import org.eclipse.cdt.debug.mi.core.cdi.event.MemoryChangedEvent;
|
import org.eclipse.cdt.debug.mi.core.cdi.event.MemoryChangedEvent;
|
||||||
import org.eclipse.cdt.debug.mi.core.cdi.event.ResumedEvent;
|
import org.eclipse.cdt.debug.mi.core.cdi.event.ResumedEvent;
|
||||||
import org.eclipse.cdt.debug.mi.core.cdi.event.SuspendedEvent;
|
import org.eclipse.cdt.debug.mi.core.cdi.event.SuspendedEvent;
|
||||||
import org.eclipse.cdt.debug.mi.core.cdi.model.CTarget;
|
|
||||||
import org.eclipse.cdt.debug.mi.core.cdi.model.MemoryBlock;
|
import org.eclipse.cdt.debug.mi.core.cdi.model.MemoryBlock;
|
||||||
|
import org.eclipse.cdt.debug.mi.core.cdi.model.Target;
|
||||||
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.MIBreakpointCreatedEvent;
|
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.MIBreakpointDeletedEvent;
|
||||||
|
@ -62,7 +71,7 @@ public class EventManager extends SessionObject implements ICDIEventManager, Obs
|
||||||
*/
|
*/
|
||||||
public void update(Observable o, Object arg) {
|
public void update(Observable o, Object arg) {
|
||||||
MIEvent miEvent = (MIEvent)arg;
|
MIEvent miEvent = (MIEvent)arg;
|
||||||
CSession session = getCSession();
|
Session session = (Session)getSession();
|
||||||
List cdiList = new ArrayList(1);
|
List cdiList = new ArrayList(1);
|
||||||
|
|
||||||
if (ignoreEventToken(miEvent.getToken())) {
|
if (ignoreEventToken(miEvent.getToken())) {
|
||||||
|
@ -168,7 +177,7 @@ public class EventManager extends SessionObject implements ICDIEventManager, Obs
|
||||||
fireEvents(cdiEvents);
|
fireEvents(cdiEvents);
|
||||||
}
|
}
|
||||||
|
|
||||||
public EventManager(CSession session) {
|
public EventManager(Session session) {
|
||||||
super(session);
|
super(session);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -217,22 +226,46 @@ public class EventManager extends SessionObject implements ICDIEventManager, Obs
|
||||||
* fired for changes.
|
* fired for changes.
|
||||||
*/
|
*/
|
||||||
void processSuspendedEvent(MIStoppedEvent stopped) {
|
void processSuspendedEvent(MIStoppedEvent stopped) {
|
||||||
CTarget target = getCSession().getCTarget();
|
Session session = (Session)getSession();
|
||||||
|
ICDITarget currentTarget = session.getCurrentTarget();
|
||||||
// Set the current thread.
|
// Set the current thread.
|
||||||
int threadId = threadId = stopped.getThreadId();
|
int threadId = threadId = stopped.getThreadId();
|
||||||
target.updateState(threadId);
|
if (currentTarget instanceof Target) {
|
||||||
|
((Target)currentTarget).updateState(threadId);
|
||||||
|
}
|
||||||
// Update the managers.
|
// Update the managers.
|
||||||
VariableManager varMgr = getCSession().getVariableManager();
|
// For the Variable/Expression Managers call only the updateManager.
|
||||||
RegisterManager regMgr = getCSession().getRegisterManager();
|
UpdateManager upMgr = session.getUpdateManager();
|
||||||
MemoryManager memMgr = (MemoryManager)getCSession().getMemoryManager();
|
ICDIVariableManager varMgr = session.getVariableManager();
|
||||||
SharedLibraryManager libMgr = (SharedLibraryManager)getCSession().getSharedLibraryManager();
|
ICDIExpressionManager expMgr = session.getExpressionManager();
|
||||||
|
ICDIRegisterManager regMgr = session.getRegisterManager();
|
||||||
|
ICDIMemoryManager memMgr = session.getMemoryManager();
|
||||||
|
ICDISharedLibraryManager libMgr = session.getSharedLibraryManager();
|
||||||
|
ICDIBreakpointManager bpMgr = session.getBreakpointManager();
|
||||||
|
ICDISignalManager sigMgr = session.getSignalManager();
|
||||||
|
ICDISourceManager srcMgr = session.getSourceManager();
|
||||||
try {
|
try {
|
||||||
varMgr.update();
|
if (varMgr.isAutoUpdate() || expMgr.isAutoUpdate()) {
|
||||||
regMgr.update();
|
upMgr.update();
|
||||||
memMgr.update();
|
}
|
||||||
libMgr.update();
|
if (regMgr.isAutoUpdate()) {
|
||||||
|
regMgr.update();
|
||||||
|
}
|
||||||
|
if (memMgr.isAutoUpdate()) {
|
||||||
|
memMgr.update();
|
||||||
|
}
|
||||||
|
if (libMgr.isAutoUpdate()) {
|
||||||
|
libMgr.update();
|
||||||
|
}
|
||||||
|
if (bpMgr.isAutoUpdate()) {
|
||||||
|
bpMgr.update();
|
||||||
|
}
|
||||||
|
if (sigMgr.isAutoUpdate()) {
|
||||||
|
sigMgr.update();
|
||||||
|
}
|
||||||
|
if (srcMgr.isAutoUpdate()) {
|
||||||
|
srcMgr.update();
|
||||||
|
}
|
||||||
} catch (CDIException e) {
|
} catch (CDIException e) {
|
||||||
//System.out.println(e);
|
//System.out.println(e);
|
||||||
}
|
}
|
||||||
|
@ -242,7 +275,7 @@ public class EventManager extends SessionObject implements ICDIEventManager, Obs
|
||||||
* Do any processing of before a running event.
|
* Do any processing of before a running event.
|
||||||
*/
|
*/
|
||||||
void processRunningEvent() {
|
void processRunningEvent() {
|
||||||
//CTarget target = getCSession().getCTarget();
|
//Target target = getCSession().getCTarget();
|
||||||
//target.clearState();
|
//target.clearState();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,7 @@ public class ExitInfo extends SessionObject implements ICDIExitInfo {
|
||||||
|
|
||||||
MIInferiorExitEvent event;
|
MIInferiorExitEvent event;
|
||||||
|
|
||||||
public ExitInfo(CSession session, MIInferiorExitEvent e) {
|
public ExitInfo(Session session, MIInferiorExitEvent e) {
|
||||||
super(session);
|
super(session);
|
||||||
event = e;
|
event = e;
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,179 @@
|
||||||
|
/*
|
||||||
|
*(c) Copyright QNX Software Systems Ltd. 2002.
|
||||||
|
* All Rights Reserved.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
package org.eclipse.cdt.debug.mi.core.cdi;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.debug.core.cdi.CDIException;
|
||||||
|
import org.eclipse.cdt.debug.core.cdi.ICDIExpressionManager;
|
||||||
|
import org.eclipse.cdt.debug.core.cdi.model.ICDIExpression;
|
||||||
|
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.mi.core.MIException;
|
||||||
|
import org.eclipse.cdt.debug.mi.core.MISession;
|
||||||
|
import org.eclipse.cdt.debug.mi.core.cdi.model.Expression;
|
||||||
|
import org.eclipse.cdt.debug.mi.core.cdi.model.StackFrame;
|
||||||
|
import org.eclipse.cdt.debug.mi.core.command.CommandFactory;
|
||||||
|
import org.eclipse.cdt.debug.mi.core.command.MIVarCreate;
|
||||||
|
import org.eclipse.cdt.debug.mi.core.event.MIEvent;
|
||||||
|
import org.eclipse.cdt.debug.mi.core.event.MIVarChangedEvent;
|
||||||
|
import org.eclipse.cdt.debug.mi.core.output.MIVarChange;
|
||||||
|
import org.eclipse.cdt.debug.mi.core.output.MIVarCreateInfo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*/
|
||||||
|
public class ExpressionManager extends SessionObject implements ICDIExpressionManager, IUpdateListener {
|
||||||
|
|
||||||
|
private List expList;
|
||||||
|
private boolean autoupdate;
|
||||||
|
|
||||||
|
public ExpressionManager(Session session) {
|
||||||
|
super(session);
|
||||||
|
expList = Collections.synchronizedList(new ArrayList());
|
||||||
|
autoupdate = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
synchronized private void addExpression(Expression exp) {
|
||||||
|
expList.add(exp);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see org.eclipse.cdt.debug.core.cdi.ICDIExpressionManager#createExpression(String)
|
||||||
|
*/
|
||||||
|
public ICDIExpression createExpression(String name) throws CDIException {
|
||||||
|
Expression expression = null;
|
||||||
|
try {
|
||||||
|
Session session = (Session)getSession();
|
||||||
|
MISession mi = session.getMISession();
|
||||||
|
CommandFactory factory = mi.getCommandFactory();
|
||||||
|
MIVarCreate var = factory.createMIVarCreate(name);
|
||||||
|
mi.postCommand(var);
|
||||||
|
MIVarCreateInfo info = var.getMIVarCreateInfo();
|
||||||
|
if (info == null) {
|
||||||
|
throw new CDIException("No answer");
|
||||||
|
}
|
||||||
|
VariableObject varObj = new VariableObject(name, null, 0, 0);
|
||||||
|
expression = new Expression(varObj, info.getMIVar());
|
||||||
|
addExpression(expression);
|
||||||
|
} catch (MIException e) {
|
||||||
|
throw new MI2CDIException(e);
|
||||||
|
}
|
||||||
|
return expression;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see org.eclipse.cdt.debug.core.cdi.ICDIExpressionManager#createExpression(ICDIStackFrame, String)
|
||||||
|
*/
|
||||||
|
public ICDIExpression createExpression(ICDIStackFrame frame, String name) throws CDIException {
|
||||||
|
Expression expression = null;
|
||||||
|
if (!(frame instanceof StackFrame)) {
|
||||||
|
return expression;
|
||||||
|
}
|
||||||
|
Session session = (Session)getSession();
|
||||||
|
ICDITarget currentTarget = session.getCurrentTarget();
|
||||||
|
ICDIThread currentThread = currentTarget.getCurrentThread();
|
||||||
|
ICDIStackFrame currentFrame = currentThread.getCurrentStackFrame();
|
||||||
|
frame.getThread().setCurrentStackFrame(frame);
|
||||||
|
try {
|
||||||
|
MISession mi = session.getMISession();
|
||||||
|
CommandFactory factory = mi.getCommandFactory();
|
||||||
|
MIVarCreate var = factory.createMIVarCreate(name);
|
||||||
|
mi.postCommand(var);
|
||||||
|
MIVarCreateInfo info = var.getMIVarCreateInfo();
|
||||||
|
if (info == null) {
|
||||||
|
throw new CDIException("No answer");
|
||||||
|
}
|
||||||
|
VariableObject varObj = new VariableObject(name, (StackFrame)frame, 0, 0);
|
||||||
|
expression = new Expression(varObj, info.getMIVar());
|
||||||
|
addExpression(expression);
|
||||||
|
} catch (MIException e) {
|
||||||
|
throw new MI2CDIException(e);
|
||||||
|
} finally {
|
||||||
|
currentThread.setCurrentStackFrame(currentFrame);
|
||||||
|
}
|
||||||
|
return expression;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see org.eclipse.cdt.debug.core.cdi.ICDIExpressionManager#getExpressions()
|
||||||
|
*/
|
||||||
|
public ICDIExpression[] getExpressions() throws CDIException {
|
||||||
|
return (ICDIExpression[])expList.toArray(new ICDIExpression[0]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see org.eclipse.cdt.debug.core.cdi.ICDIExpressionManager#destroyExpression(ICDIExpression)
|
||||||
|
*/
|
||||||
|
synchronized public void removeExpression(ICDIExpression expression) throws CDIException {
|
||||||
|
expList.remove(expression);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see org.eclipse.cdt.debug.core.cdi.ICDIExpressionManager#removeExpression(ICDIExpression)
|
||||||
|
*/
|
||||||
|
public void destroyExpression(ICDIExpression expression) throws CDIException {
|
||||||
|
removeExpression(expression);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the element that have the uniq varName.
|
||||||
|
* null is return if the element is not in the cache.
|
||||||
|
*/
|
||||||
|
public Expression getExpression(String varName) {
|
||||||
|
Expression[] exps = (Expression[])expList.toArray(new Expression[0]);
|
||||||
|
for (int i = 0; i < exps.length; i++) {
|
||||||
|
if (exps[i].getMIVar().getVarName().equals(varName)) {
|
||||||
|
return exps[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see org.eclipse.cdt.debug.core.cdi.ICDIExpressionManager#update()
|
||||||
|
*/
|
||||||
|
public void update() throws CDIException {
|
||||||
|
Session session = (Session)getSession();
|
||||||
|
UpdateManager mgr = session.getUpdateManager();
|
||||||
|
mgr.update();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see org.eclipse.cdt.debug.mi.core.cdi.IUpdateListener#changeList(MIVarChange[])
|
||||||
|
*/
|
||||||
|
public void changeList(MIVarChange[] changes) {
|
||||||
|
List eventList = new ArrayList(changes.length);
|
||||||
|
for (int i = 0 ; i < changes.length; i++) {
|
||||||
|
String varName = changes[i].getVarName();
|
||||||
|
Expression expression = getExpression(varName);
|
||||||
|
if (expression != null) {
|
||||||
|
eventList.add(new MIVarChangedEvent(0, varName, changes[i].isInScope()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Session session = (Session)getSession();
|
||||||
|
MISession mi = session.getMISession();
|
||||||
|
MIEvent[] events = (MIEvent[])eventList.toArray(new MIEvent[0]);
|
||||||
|
mi.fireEvents(events);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see org.eclipse.cdt.debug.core.cdi.ICDIExpressionManager#isAutoUpdate()
|
||||||
|
*/
|
||||||
|
public boolean isAutoUpdate() {
|
||||||
|
return autoupdate;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see org.eclipse.cdt.debug.core.cdi.ICDIExpressionManager#setAutoUpdate(boolean)
|
||||||
|
*/
|
||||||
|
public void setAutoUpdate(boolean update) {
|
||||||
|
autoupdate = update;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,12 @@
|
||||||
|
/*
|
||||||
|
*(c) Copyright QNX Software Systems Ltd. 2002.
|
||||||
|
* All Rights Reserved.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
package org.eclipse.cdt.debug.mi.core.cdi;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.debug.mi.core.output.MIVarChange;
|
||||||
|
|
||||||
|
public interface IUpdateListener {
|
||||||
|
void changeList(MIVarChange[] changes);
|
||||||
|
}
|
|
@ -27,10 +27,12 @@ import org.eclipse.cdt.debug.mi.core.output.MIDataReadMemoryInfo;
|
||||||
public class MemoryManager extends SessionObject implements ICDIMemoryManager {
|
public class MemoryManager extends SessionObject implements ICDIMemoryManager {
|
||||||
|
|
||||||
List blockList;
|
List blockList;
|
||||||
|
boolean autoupdate;
|
||||||
|
|
||||||
public MemoryManager(CSession session) {
|
public MemoryManager(Session session) {
|
||||||
super(session);
|
super(session);
|
||||||
blockList = new ArrayList();
|
blockList = new ArrayList();
|
||||||
|
autoupdate = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -38,9 +40,12 @@ public class MemoryManager extends SessionObject implements ICDIMemoryManager {
|
||||||
* inferior comes to a Stop/Suspended. It will allow to look at the blocks that
|
* inferior comes to a Stop/Suspended. It will allow to look at the blocks that
|
||||||
* are registered and fired any event if changed.
|
* are registered and fired any event if changed.
|
||||||
* Note: Frozen blocks are not updated.
|
* Note: Frozen blocks are not updated.
|
||||||
|
*
|
||||||
|
* @see org.eclipse.cdt.debug.core.cdi.ICDIMemoryManager#createMemoryBlock(long, int)
|
||||||
*/
|
*/
|
||||||
public void update() {
|
public void update() {
|
||||||
MISession mi = getCSession().getMISession();
|
Session session = (Session)getSession();
|
||||||
|
MISession mi = session.getMISession();
|
||||||
MemoryBlock[] blocks = listMemoryBlocks();
|
MemoryBlock[] blocks = listMemoryBlocks();
|
||||||
List eventList = new ArrayList(blocks.length);
|
List eventList = new ArrayList(blocks.length);
|
||||||
for (int i = 0; i < blocks.length; i++) {
|
for (int i = 0; i < blocks.length; i++) {
|
||||||
|
@ -68,7 +73,8 @@ public class MemoryManager extends SessionObject implements ICDIMemoryManager {
|
||||||
if (aList != null) {
|
if (aList != null) {
|
||||||
aList.add(new MIMemoryChangedEvent(array));
|
aList.add(new MIMemoryChangedEvent(array));
|
||||||
} else {
|
} else {
|
||||||
MISession mi = getCSession().getMISession();
|
Session session = (Session)getSession();
|
||||||
|
MISession mi = session.getMISession();
|
||||||
mi.fireEvent(new MIMemoryChangedEvent(array));
|
mi.fireEvent(new MIMemoryChangedEvent(array));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -112,16 +118,18 @@ public class MemoryManager extends SessionObject implements ICDIMemoryManager {
|
||||||
* with the MemoryManager.
|
* with the MemoryManager.
|
||||||
*/
|
*/
|
||||||
MemoryBlock cloneBlock(MemoryBlock block) throws CDIException {
|
MemoryBlock cloneBlock(MemoryBlock block) throws CDIException {
|
||||||
|
Session session = (Session)getSession();
|
||||||
String exp = block.getExpression();
|
String exp = block.getExpression();
|
||||||
MIDataReadMemoryInfo info = createMIDataReadMemoryInfo(exp, (int)block.getLength());
|
MIDataReadMemoryInfo info = createMIDataReadMemoryInfo(exp, (int)block.getLength());
|
||||||
return new MemoryBlock(getCSession().getCTarget(), exp, info);
|
return new MemoryBlock(session.getCurrentTarget(), exp, info);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Post a -data-read-memory to gdb/mi.
|
* Post a -data-read-memory to gdb/mi.
|
||||||
*/
|
*/
|
||||||
MIDataReadMemoryInfo createMIDataReadMemoryInfo(String exp, int length) throws CDIException {
|
MIDataReadMemoryInfo createMIDataReadMemoryInfo(String exp, int length) throws CDIException {
|
||||||
MISession mi = getCSession().getMISession();
|
Session session = (Session)getSession();
|
||||||
|
MISession mi = session.getMISession();
|
||||||
CommandFactory factory = mi.getCommandFactory();
|
CommandFactory factory = mi.getCommandFactory();
|
||||||
MIDataReadMemory mem = factory.createMIDataReadMemory(0, exp, MIFormat.HEXADECIMAL, 1, 1, length, null);
|
MIDataReadMemory mem = factory.createMIDataReadMemory(0, exp, MIFormat.HEXADECIMAL, 1, 1, length, null);
|
||||||
try {
|
try {
|
||||||
|
@ -149,10 +157,11 @@ public class MemoryManager extends SessionObject implements ICDIMemoryManager {
|
||||||
* @see org.eclipse.cdt.debug.core.cdi.ICDIMemoryManager#createMemoryBlock(string, int)
|
* @see org.eclipse.cdt.debug.core.cdi.ICDIMemoryManager#createMemoryBlock(string, int)
|
||||||
*/
|
*/
|
||||||
public ICDIMemoryBlock createMemoryBlock(String address, int length) throws CDIException {
|
public ICDIMemoryBlock createMemoryBlock(String address, int length) throws CDIException {
|
||||||
|
Session session = (Session)getSession();
|
||||||
MIDataReadMemoryInfo info = createMIDataReadMemoryInfo(address, length);
|
MIDataReadMemoryInfo info = createMIDataReadMemoryInfo(address, length);
|
||||||
ICDIMemoryBlock block = new MemoryBlock(getCSession().getCTarget(), address, info);
|
ICDIMemoryBlock block = new MemoryBlock(session.getCurrentTarget(), address, info);
|
||||||
blockList.add(block);
|
blockList.add(block);
|
||||||
MISession mi = getCSession().getMISession();
|
MISession mi = session.getMISession();
|
||||||
mi.fireEvent(new MIMemoryCreatedEvent(block.getStartAddress(), block.getLength()));
|
mi.fireEvent(new MIMemoryCreatedEvent(block.getStartAddress(), block.getLength()));
|
||||||
return block;
|
return block;
|
||||||
}
|
}
|
||||||
|
@ -188,4 +197,18 @@ public class MemoryManager extends SessionObject implements ICDIMemoryManager {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see org.eclipse.cdt.debug.core.cdi.ICDIMemoryManager#isAutoUpdate()
|
||||||
|
*/
|
||||||
|
public boolean isAutoUpdate() {
|
||||||
|
return autoupdate;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see org.eclipse.cdt.debug.core.cdi.ICDIMemoryManager#setAutoUpdate(boolean)
|
||||||
|
*/
|
||||||
|
public void setAutoUpdate(boolean update) {
|
||||||
|
autoupdate = update;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,10 +6,13 @@
|
||||||
package org.eclipse.cdt.debug.mi.core.cdi;
|
package org.eclipse.cdt.debug.mi.core.cdi;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.eclipse.cdt.debug.core.cdi.CDIException;
|
import org.eclipse.cdt.debug.core.cdi.CDIException;
|
||||||
|
import org.eclipse.cdt.debug.core.cdi.ICDIRegisterManager;
|
||||||
import org.eclipse.cdt.debug.core.cdi.ICDIRegisterObject;
|
import org.eclipse.cdt.debug.core.cdi.ICDIRegisterObject;
|
||||||
|
import org.eclipse.cdt.debug.core.cdi.model.ICDIRegister;
|
||||||
import org.eclipse.cdt.debug.mi.core.MIException;
|
import org.eclipse.cdt.debug.mi.core.MIException;
|
||||||
import org.eclipse.cdt.debug.mi.core.MISession;
|
import org.eclipse.cdt.debug.mi.core.MISession;
|
||||||
import org.eclipse.cdt.debug.mi.core.cdi.model.Register;
|
import org.eclipse.cdt.debug.mi.core.cdi.model.Register;
|
||||||
|
@ -24,20 +27,23 @@ import org.eclipse.cdt.debug.mi.core.output.MIDataListRegisterNamesInfo;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*/
|
*/
|
||||||
public class RegisterManager extends SessionObject {
|
public class RegisterManager extends SessionObject implements ICDIRegisterManager {
|
||||||
|
|
||||||
List regList;
|
private List regList;
|
||||||
|
private boolean autoupdate;
|
||||||
|
|
||||||
public RegisterManager(CSession session) {
|
public RegisterManager(Session session) {
|
||||||
super(session);
|
super(session);
|
||||||
regList = new ArrayList();
|
regList = Collections.synchronizedList(new ArrayList());
|
||||||
|
autoupdate = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see org.eclipse.cdt.debug.core.cdi.model.ICDITarget#getRegisterObjects()
|
* @see org.eclipse.cdt.debug.core.cdi.model.ICDITarget#getRegisterObjects()
|
||||||
*/
|
*/
|
||||||
public ICDIRegisterObject[] getRegisterObjects() throws CDIException {
|
public ICDIRegisterObject[] getRegisterObjects() throws CDIException {
|
||||||
MISession mi = getCSession().getMISession();
|
Session session = (Session)getSession();
|
||||||
|
MISession mi = session.getMISession();
|
||||||
CommandFactory factory = mi.getCommandFactory();
|
CommandFactory factory = mi.getCommandFactory();
|
||||||
MIDataListRegisterNames registers = factory.createMIDataListRegisterNames();
|
MIDataListRegisterNames registers = factory.createMIDataListRegisterNames();
|
||||||
try {
|
try {
|
||||||
|
@ -58,10 +64,45 @@ public class RegisterManager extends SessionObject {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Register[] getRegisters() {
|
/**
|
||||||
return (Register[])regList.toArray(new Register[0]);
|
* @see org.eclipse.cdt.debug.core.cdi.model.ICDITarget#createRegister()
|
||||||
|
*/
|
||||||
|
public ICDIRegister createRegister(ICDIRegisterObject regObject) throws CDIException {
|
||||||
|
Register reg = getRegister(regObject);
|
||||||
|
if (reg == null) {
|
||||||
|
Session session = (Session)getSession();
|
||||||
|
reg = new Register(session.getCurrentTarget(), regObject);
|
||||||
|
regList.add(reg);
|
||||||
|
MISession mi = session.getMISession();
|
||||||
|
mi.fireEvent(new MIRegisterCreatedEvent(reg.getName(), reg.getID()));
|
||||||
|
}
|
||||||
|
return reg;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see org.eclipse.cdt.debug.core.cdi.ICDIRegisterManager#destroyRegister(ICDIRegister)
|
||||||
|
*/
|
||||||
|
public void destroyRegister(ICDIRegister reg) {
|
||||||
|
regList.remove(reg);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see org.eclipse.cdt.debug.core.cdi.ICDIRegisterManager#setAutoUpdate(boolean)
|
||||||
|
*/
|
||||||
|
public void setAutoUpdate(boolean update) {
|
||||||
|
autoupdate = update;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see org.eclipse.cdt.debug.core.cdi.ICDIRegisterManager#isAutoUpdate()
|
||||||
|
*/
|
||||||
|
public boolean isAutoUpdate() {
|
||||||
|
return autoupdate;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Use by the eventManager to find the Register;
|
||||||
|
*/
|
||||||
public Register getRegister(int regno) throws CDIException {
|
public Register getRegister(int regno) throws CDIException {
|
||||||
Register[] regs = getRegisters();
|
Register[] regs = getRegisters();
|
||||||
for (int i = 0; i < regs.length; i++) {
|
for (int i = 0; i < regs.length; i++) {
|
||||||
|
@ -72,37 +113,12 @@ public class RegisterManager extends SessionObject {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
Register getRegister(ICDIRegisterObject regObject) throws CDIException {
|
/**
|
||||||
Register[] regs = getRegisters();
|
* Call the by the EventManager when the target is suspended.
|
||||||
for (int i = 0; i < regs.length; i++) {
|
*/
|
||||||
if (regObject.getName().equals(regs[i].getName())) {
|
|
||||||
return regs[i];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Register createRegister(ICDIRegisterObject regObject) throws CDIException {
|
|
||||||
Register reg = getRegister(regObject);
|
|
||||||
if (reg == null) {
|
|
||||||
reg = new Register(getCSession().getCTarget(), regObject);
|
|
||||||
regList.add(reg);
|
|
||||||
MISession mi = getCSession().getMISession();
|
|
||||||
mi.fireEvent(new MIRegisterCreatedEvent(reg.getName(), reg.getID()));
|
|
||||||
}
|
|
||||||
return reg;
|
|
||||||
}
|
|
||||||
|
|
||||||
Register[] createRegisters(ICDIRegisterObject[] regObjects) throws CDIException {
|
|
||||||
Register[] regs = new Register[regObjects.length];
|
|
||||||
for (int i = 0; i < regs.length; i++) {
|
|
||||||
regs[i] = createRegister(regObjects[i]);
|
|
||||||
}
|
|
||||||
return regs;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void update() throws CDIException {
|
public void update() throws CDIException {
|
||||||
MISession mi = getCSession().getMISession();
|
Session session = (Session)getSession();
|
||||||
|
MISession mi = session.getMISession();
|
||||||
CommandFactory factory = mi.getCommandFactory();
|
CommandFactory factory = mi.getCommandFactory();
|
||||||
MIDataListChangedRegisters changed = factory.createMIDataListChangedRegisters();
|
MIDataListChangedRegisters changed = factory.createMIDataListChangedRegisters();
|
||||||
try {
|
try {
|
||||||
|
@ -127,4 +143,19 @@ public class RegisterManager extends SessionObject {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private Register[] getRegisters() {
|
||||||
|
return (Register[])regList.toArray(new Register[0]);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private Register getRegister(ICDIRegisterObject regObject) throws CDIException {
|
||||||
|
Register[] regs = getRegisters();
|
||||||
|
for (int i = 0; i < regs.length; i++) {
|
||||||
|
if (regObject.getName().equals(regs[i].getName())) {
|
||||||
|
return regs[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,25 +4,10 @@ import org.eclipse.cdt.debug.core.cdi.ICDIRegisterObject;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*/
|
*/
|
||||||
public class RegisterObject implements ICDIRegisterObject {
|
public class RegisterObject extends VariableObject implements ICDIRegisterObject {
|
||||||
|
|
||||||
int index;
|
public RegisterObject(String name, int i) {
|
||||||
String name;
|
super(name, null, i, 0);
|
||||||
|
|
||||||
public RegisterObject(String n, int i) {
|
|
||||||
name = n;
|
|
||||||
index = i;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getId() {
|
|
||||||
return index;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see org.eclipse.cdt.debug.core.cdi.ICDIRegisterObject#getName()
|
|
||||||
*/
|
|
||||||
public String getName() {
|
|
||||||
return name;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,9 +21,9 @@ import org.eclipse.cdt.debug.mi.core.output.MIInfo;
|
||||||
*/
|
*/
|
||||||
public class RuntimeOptions implements ICDIRuntimeOptions {
|
public class RuntimeOptions implements ICDIRuntimeOptions {
|
||||||
|
|
||||||
CSession session;
|
Session session;
|
||||||
|
|
||||||
public RuntimeOptions(CSession s) {
|
public RuntimeOptions(Session s) {
|
||||||
session = s;
|
session = s;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -14,28 +14,32 @@ import org.eclipse.cdt.debug.core.cdi.ICDIConfiguration;
|
||||||
import org.eclipse.cdt.debug.core.cdi.ICDIEventManager;
|
import org.eclipse.cdt.debug.core.cdi.ICDIEventManager;
|
||||||
import org.eclipse.cdt.debug.core.cdi.ICDIExpressionManager;
|
import org.eclipse.cdt.debug.core.cdi.ICDIExpressionManager;
|
||||||
import org.eclipse.cdt.debug.core.cdi.ICDIMemoryManager;
|
import org.eclipse.cdt.debug.core.cdi.ICDIMemoryManager;
|
||||||
|
import org.eclipse.cdt.debug.core.cdi.ICDIRegisterManager;
|
||||||
import org.eclipse.cdt.debug.core.cdi.ICDIRuntimeOptions;
|
import org.eclipse.cdt.debug.core.cdi.ICDIRuntimeOptions;
|
||||||
import org.eclipse.cdt.debug.core.cdi.ICDISession;
|
import org.eclipse.cdt.debug.core.cdi.ICDISession;
|
||||||
import org.eclipse.cdt.debug.core.cdi.ICDISessionObject;
|
import org.eclipse.cdt.debug.core.cdi.ICDISessionObject;
|
||||||
import org.eclipse.cdt.debug.core.cdi.ICDISharedLibraryManager;
|
import org.eclipse.cdt.debug.core.cdi.ICDISharedLibraryManager;
|
||||||
import org.eclipse.cdt.debug.core.cdi.ICDISignalManager;
|
import org.eclipse.cdt.debug.core.cdi.ICDISignalManager;
|
||||||
import org.eclipse.cdt.debug.core.cdi.ICDISourceManager;
|
import org.eclipse.cdt.debug.core.cdi.ICDISourceManager;
|
||||||
|
import org.eclipse.cdt.debug.core.cdi.ICDIVariableManager;
|
||||||
import org.eclipse.cdt.debug.core.cdi.model.ICDITarget;
|
import org.eclipse.cdt.debug.core.cdi.model.ICDITarget;
|
||||||
import org.eclipse.cdt.debug.mi.core.MIException;
|
import org.eclipse.cdt.debug.mi.core.MIException;
|
||||||
import org.eclipse.cdt.debug.mi.core.MISession;
|
import org.eclipse.cdt.debug.mi.core.MISession;
|
||||||
import org.eclipse.cdt.debug.mi.core.cdi.model.CTarget;
|
import org.eclipse.cdt.debug.mi.core.cdi.model.Target;
|
||||||
import org.eclipse.cdt.debug.mi.core.command.CommandFactory;
|
import org.eclipse.cdt.debug.mi.core.command.CommandFactory;
|
||||||
import org.eclipse.cdt.debug.mi.core.command.MIEnvironmentDirectory;
|
import org.eclipse.cdt.debug.mi.core.command.MIEnvironmentDirectory;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see org.eclipse.cdt.debug.core.cdi.ICDISession
|
* @see org.eclipse.cdt.debug.core.cdi.ICDISession
|
||||||
*/
|
*/
|
||||||
public class CSession implements ICDISession, ICDISessionObject {
|
public class Session implements ICDISession, ICDISessionObject {
|
||||||
|
|
||||||
Properties props;
|
Properties props;
|
||||||
MISession session;
|
MISession session;
|
||||||
BreakpointManager breakpointManager;
|
UpdateManager updateManager;
|
||||||
EventManager eventManager;
|
EventManager eventManager;
|
||||||
|
BreakpointManager breakpointManager;
|
||||||
|
ExpressionManager expressionManager;
|
||||||
VariableManager variableManager;
|
VariableManager variableManager;
|
||||||
RegisterManager registerManager;
|
RegisterManager registerManager;
|
||||||
MemoryManager memoryManager;
|
MemoryManager memoryManager;
|
||||||
|
@ -43,14 +47,14 @@ public class CSession implements ICDISession, ICDISessionObject {
|
||||||
SignalManager signalManager;
|
SignalManager signalManager;
|
||||||
SourceManager sourceManager;
|
SourceManager sourceManager;
|
||||||
ICDIConfiguration configuration;
|
ICDIConfiguration configuration;
|
||||||
CTarget ctarget;
|
Target ctarget;
|
||||||
|
|
||||||
public CSession(MISession s, boolean attach) {
|
public Session(MISession s, boolean attach) {
|
||||||
commonSetup(s);
|
commonSetup(s);
|
||||||
configuration = new Configuration(s, attach);
|
configuration = new Configuration(s, attach);
|
||||||
}
|
}
|
||||||
|
|
||||||
public CSession(MISession s) {
|
public Session(MISession s) {
|
||||||
commonSetup(s);
|
commonSetup(s);
|
||||||
configuration = new CoreFileConfiguration();
|
configuration = new CoreFileConfiguration();
|
||||||
}
|
}
|
||||||
|
@ -58,24 +62,32 @@ public class CSession implements ICDISession, ICDISessionObject {
|
||||||
private void commonSetup(MISession s) {
|
private void commonSetup(MISession s) {
|
||||||
session = s;
|
session = s;
|
||||||
props = new Properties();
|
props = new Properties();
|
||||||
|
|
||||||
breakpointManager = new BreakpointManager(this);
|
breakpointManager = new BreakpointManager(this);
|
||||||
|
|
||||||
eventManager = new EventManager(this);
|
eventManager = new EventManager(this);
|
||||||
s.addObserver(eventManager);
|
s.addObserver(eventManager);
|
||||||
|
|
||||||
|
updateManager = new UpdateManager(this);
|
||||||
|
expressionManager = new ExpressionManager(this);
|
||||||
variableManager = new VariableManager(this);
|
variableManager = new VariableManager(this);
|
||||||
|
updateManager.addUpdateListener(variableManager);
|
||||||
|
updateManager.addUpdateListener(expressionManager);
|
||||||
|
|
||||||
registerManager = new RegisterManager(this);
|
registerManager = new RegisterManager(this);
|
||||||
memoryManager = new MemoryManager(this);
|
memoryManager = new MemoryManager(this);
|
||||||
signalManager = new SignalManager(this);
|
signalManager = new SignalManager(this);
|
||||||
sourceManager = new SourceManager(this);
|
sourceManager = new SourceManager(this);
|
||||||
sharedLibraryManager = new SharedLibraryManager(this);
|
sharedLibraryManager = new SharedLibraryManager(this);
|
||||||
ctarget = new CTarget(this);
|
ctarget = new Target(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public MISession getMISession() {
|
public MISession getMISession() {
|
||||||
return session;
|
return session;
|
||||||
}
|
}
|
||||||
|
|
||||||
public CTarget getCTarget() {
|
public UpdateManager getUpdateManager() {
|
||||||
return ctarget;
|
return updateManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -100,12 +112,26 @@ public class CSession implements ICDISession, ICDISessionObject {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see org.eclipse.cdt.debug.core.cdi.ICDISession#getVariableManager()
|
* @see org.eclipse.cdt.debug.core.cdi.ICDISession#getExpressionManager()
|
||||||
*/
|
*/
|
||||||
public ICDIExpressionManager getExpressionManager() {
|
public ICDIExpressionManager getExpressionManager() {
|
||||||
|
return expressionManager;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see org.eclipse.cdt.debug.core.cdi.ICDISession#getVariableManager()
|
||||||
|
*/
|
||||||
|
public ICDIVariableManager getVariableManager() {
|
||||||
return variableManager;
|
return variableManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see org.eclipse.cdt.debug.core.cdi.ICDISession#getRegisterManager()
|
||||||
|
*/
|
||||||
|
public ICDIRegisterManager getRegisterManager() {
|
||||||
|
return registerManager;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see org.eclipse.cdt.debug.core.cdi.ICDISession#getSharedLibraryManager()
|
* @see org.eclipse.cdt.debug.core.cdi.ICDISession#getSharedLibraryManager()
|
||||||
*/
|
*/
|
||||||
|
@ -113,18 +139,6 @@ public class CSession implements ICDISession, ICDISessionObject {
|
||||||
return sharedLibraryManager;
|
return sharedLibraryManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
*/
|
|
||||||
public RegisterManager getRegisterManager() {
|
|
||||||
return registerManager;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
*/
|
|
||||||
public VariableManager getVariableManager() {
|
|
||||||
return variableManager;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see org.eclipse.cdt.debug.core.cdi.ICDISession#getMemoryManager()
|
* @see org.eclipse.cdt.debug.core.cdi.ICDISession#getMemoryManager()
|
||||||
*/
|
*/
|
||||||
|
@ -161,13 +175,14 @@ public class CSession implements ICDISession, ICDISessionObject {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* @see org.eclipse.cdt.debug.core.cdi.ICDISession#setCurrentTarget()
|
||||||
*/
|
*/
|
||||||
public void setCurrentTarget(ICDITarget target) throws CDIException {
|
public void setCurrentTarget(ICDITarget target) throws CDIException {
|
||||||
if (target instanceof CTarget) {
|
if (target instanceof Target) {
|
||||||
ctarget = (CTarget)target;
|
ctarget = (Target)target;
|
||||||
return;
|
} else {
|
||||||
|
throw new CDIException("Unkown target");
|
||||||
}
|
}
|
||||||
throw new CDIException("Unkown target");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
|
@ -12,9 +12,9 @@ import org.eclipse.cdt.debug.core.cdi.ICDISessionObject;
|
||||||
*/
|
*/
|
||||||
public class SessionObject implements ICDISessionObject {
|
public class SessionObject implements ICDISessionObject {
|
||||||
|
|
||||||
private CSession session;
|
private Session session;
|
||||||
|
|
||||||
public SessionObject (CSession session) {
|
public SessionObject (Session session) {
|
||||||
this.session = session;
|
this.session = session;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -25,7 +25,4 @@ public class SessionObject implements ICDISessionObject {
|
||||||
return session;
|
return session;
|
||||||
}
|
}
|
||||||
|
|
||||||
public CSession getCSession() {
|
|
||||||
return session;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,25 +34,30 @@ public class SharedLibraryManager extends SessionObject implements ICDISharedLib
|
||||||
|
|
||||||
List sharedList;
|
List sharedList;
|
||||||
List unloadedList;
|
List unloadedList;
|
||||||
|
boolean autoupdate;
|
||||||
|
|
||||||
public SharedLibraryManager (CSession session) {
|
public SharedLibraryManager (Session session) {
|
||||||
super(session);
|
super(session);
|
||||||
sharedList = new ArrayList(1);
|
sharedList = new ArrayList(1);
|
||||||
unloadedList = new ArrayList(1);
|
unloadedList = new ArrayList(1);
|
||||||
|
autoupdate = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see org.eclipse.cdt.debug.core.cdi.ICDISharedLibraryManager#update()
|
||||||
|
*/
|
||||||
public void update() throws CDIException {
|
public void update() throws CDIException {
|
||||||
CSession s = getCSession();
|
Session session = (Session)getSession();
|
||||||
ICDIConfiguration conf = s.getConfiguration();
|
ICDIConfiguration conf = session.getConfiguration();
|
||||||
if (!conf.supportsSharedLibrary()) {
|
if (!conf.supportsSharedLibrary()) {
|
||||||
return; // Bail out early;
|
return; // Bail out early;
|
||||||
}
|
}
|
||||||
|
|
||||||
MIShared[] miLibs = new MIShared[0];
|
MIShared[] miLibs = new MIShared[0];
|
||||||
CommandFactory factory = s.getMISession().getCommandFactory();
|
CommandFactory factory = session.getMISession().getCommandFactory();
|
||||||
MIInfoSharedLibrary infoShared = factory.createMIInfoSharedLibrary();
|
MIInfoSharedLibrary infoShared = factory.createMIInfoSharedLibrary();
|
||||||
try {
|
try {
|
||||||
s.getMISession().postCommand(infoShared);
|
session.getMISession().postCommand(infoShared);
|
||||||
MIInfoSharedLibraryInfo info = infoShared.getMIInfoSharedLibraryInfo();
|
MIInfoSharedLibraryInfo info = infoShared.getMIInfoSharedLibraryInfo();
|
||||||
if (info == null) {
|
if (info == null) {
|
||||||
throw new CDIException("No answer");
|
throw new CDIException("No answer");
|
||||||
|
@ -93,7 +98,7 @@ public class SharedLibraryManager extends SessionObject implements ICDISharedLib
|
||||||
eventList.add(new MISharedLibUnloadedEvent(oldlibs[i].getFileName()));
|
eventList.add(new MISharedLibUnloadedEvent(oldlibs[i].getFileName()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
MISession mi = getCSession().getMISession();
|
MISession mi = session.getMISession();
|
||||||
MIEvent[] events = (MIEvent[])eventList.toArray(new MIEvent[0]);
|
MIEvent[] events = (MIEvent[])eventList.toArray(new MIEvent[0]);
|
||||||
mi.fireEvents(events);
|
mi.fireEvents(events);
|
||||||
}
|
}
|
||||||
|
@ -161,10 +166,10 @@ public class SharedLibraryManager extends SessionObject implements ICDISharedLib
|
||||||
* @see org.eclipse.cdt.debug.core.cdi.ICDISharedLibraryManager#loadSymbols()
|
* @see org.eclipse.cdt.debug.core.cdi.ICDISharedLibraryManager#loadSymbols()
|
||||||
*/
|
*/
|
||||||
public void loadSymbols() throws CDIException {
|
public void loadSymbols() throws CDIException {
|
||||||
CSession s = getCSession();
|
Session session = (Session)getSession();
|
||||||
CLICommand cmd = new CLICommand("shared");
|
CLICommand cmd = new CLICommand("shared");
|
||||||
try {
|
try {
|
||||||
s.getMISession().postCommand(cmd);
|
session.getMISession().postCommand(cmd);
|
||||||
MIInfo info = cmd.getMIInfo();
|
MIInfo info = cmd.getMIInfo();
|
||||||
if (info == null) {
|
if (info == null) {
|
||||||
throw new CDIException("No answer");
|
throw new CDIException("No answer");
|
||||||
|
@ -184,10 +189,10 @@ public class SharedLibraryManager extends SessionObject implements ICDISharedLib
|
||||||
if (libs[i].areSymbolsLoaded()) {
|
if (libs[i].areSymbolsLoaded()) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
CSession s = getCSession();
|
Session session = (Session)getSession();
|
||||||
CLICommand cmd = new CLICommand("shared " + libs[i].getFileName());
|
CLICommand cmd = new CLICommand("shared " + libs[i].getFileName());
|
||||||
try {
|
try {
|
||||||
s.getMISession().postCommand(cmd);
|
session.getMISession().postCommand(cmd);
|
||||||
MIInfo info = cmd.getMIInfo();
|
MIInfo info = cmd.getMIInfo();
|
||||||
if (info == null) {
|
if (info == null) {
|
||||||
throw new CDIException("No answer");
|
throw new CDIException("No answer");
|
||||||
|
@ -199,4 +204,18 @@ public class SharedLibraryManager extends SessionObject implements ICDISharedLib
|
||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see org.eclipse.cdt.debug.core.cdi.ICDISharedLibraryManager#isAutoUpdate()
|
||||||
|
*/
|
||||||
|
public boolean isAutoUpdate() {
|
||||||
|
return autoupdate;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see org.eclipse.cdt.debug.core.cdi.ICDISharedLibraryManager#setAutoUpdate(boolean)
|
||||||
|
*/
|
||||||
|
public void setAutoUpdate(boolean update) {
|
||||||
|
autoupdate = update;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,8 +13,11 @@ import org.eclipse.cdt.debug.core.cdi.model.ICDISignal;
|
||||||
*/
|
*/
|
||||||
public class SignalManager extends SessionObject implements ICDISignalManager {
|
public class SignalManager extends SessionObject implements ICDISignalManager {
|
||||||
|
|
||||||
public SignalManager(CSession session) {
|
boolean autoupdate;
|
||||||
|
|
||||||
|
public SignalManager(Session session) {
|
||||||
super(session);
|
super(session);
|
||||||
|
autoupdate = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -24,4 +27,24 @@ public class SignalManager extends SessionObject implements ICDISignalManager {
|
||||||
return new ICDISignal[0];
|
return new ICDISignal[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see org.eclipse.cdt.debug.core.cdi.ICDISignalManager#isAutoUpdate()
|
||||||
|
*/
|
||||||
|
public boolean isAutoUpdate() {
|
||||||
|
return autoupdate;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see org.eclipse.cdt.debug.core.cdi.ICDISignalManager#setAutoUpdate(boolean)
|
||||||
|
*/
|
||||||
|
public void setAutoUpdate(boolean update) {
|
||||||
|
autoupdate = update;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see org.eclipse.cdt.debug.core.cdi.ICDISignalManager#update()
|
||||||
|
*/
|
||||||
|
public void update() throws CDIException {
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,9 +16,9 @@ import org.eclipse.cdt.debug.mi.core.event.MISignalEvent;
|
||||||
public class SignalReceived extends SessionObject implements ICDISignalReceived {
|
public class SignalReceived extends SessionObject implements ICDISignalReceived {
|
||||||
|
|
||||||
ICDISignal signal;
|
ICDISignal signal;
|
||||||
public SignalReceived(CSession session, MISignalEvent event) {
|
public SignalReceived(Session session, MISignalEvent event) {
|
||||||
super(session);
|
super(session);
|
||||||
signal = new Signal(session.getCTarget(), event);
|
signal = new Signal(session.getCurrentTarget(), event);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -31,15 +31,19 @@ import org.eclipse.cdt.debug.mi.core.output.MISrcAsm;
|
||||||
*/
|
*/
|
||||||
public class SourceManager extends SessionObject implements ICDISourceManager {
|
public class SourceManager extends SessionObject implements ICDISourceManager {
|
||||||
|
|
||||||
public SourceManager(CSession session) {
|
boolean autoupdate;
|
||||||
|
|
||||||
|
public SourceManager(Session session) {
|
||||||
super(session);
|
super(session);
|
||||||
|
autoupdate = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see org.eclipse.cdt.debug.core.cdi.ICDISourceManager#addSourcePaths(String[])
|
* @see org.eclipse.cdt.debug.core.cdi.ICDISourceManager#addSourcePaths(String[])
|
||||||
*/
|
*/
|
||||||
public void addSourcePaths(String[] dirs) throws CDIException {
|
public void addSourcePaths(String[] dirs) throws CDIException {
|
||||||
MISession mi = getCSession().getMISession();
|
Session session = (Session)getSession();
|
||||||
|
MISession mi = session.getMISession();
|
||||||
CommandFactory factory = mi.getCommandFactory();
|
CommandFactory factory = mi.getCommandFactory();
|
||||||
MIEnvironmentDirectory dir = factory.createMIEnvironmentDirectory(dirs);
|
MIEnvironmentDirectory dir = factory.createMIEnvironmentDirectory(dirs);
|
||||||
try {
|
try {
|
||||||
|
@ -54,7 +58,8 @@ public class SourceManager extends SessionObject implements ICDISourceManager {
|
||||||
* @see org.eclipse.cdt.debug.core.cdi.ICDISourceManager#getSourcePaths()
|
* @see org.eclipse.cdt.debug.core.cdi.ICDISourceManager#getSourcePaths()
|
||||||
*/
|
*/
|
||||||
public String[] getSourcePaths() throws CDIException {
|
public String[] getSourcePaths() throws CDIException {
|
||||||
MISession mi = getCSession().getMISession();
|
Session session = (Session)getSession();
|
||||||
|
MISession mi = session.getMISession();
|
||||||
CommandFactory factory = mi.getCommandFactory();
|
CommandFactory factory = mi.getCommandFactory();
|
||||||
MIGDBShowDirectories dir = factory.createMIGDBShowDirectories();
|
MIGDBShowDirectories dir = factory.createMIGDBShowDirectories();
|
||||||
try {
|
try {
|
||||||
|
@ -67,7 +72,8 @@ public class SourceManager extends SessionObject implements ICDISourceManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setLibraryPaths(String[] libPaths) throws CDIException {
|
public void setLibraryPaths(String[] libPaths) throws CDIException {
|
||||||
MISession mi = getCSession().getMISession();
|
Session session = (Session)getSession();
|
||||||
|
MISession mi = session.getMISession();
|
||||||
CommandFactory factory = mi.getCommandFactory();
|
CommandFactory factory = mi.getCommandFactory();
|
||||||
MIGDBSetSolibSearchPath solib = factory.createMIGDBSetSolibSearchPath(libPaths);
|
MIGDBSetSolibSearchPath solib = factory.createMIGDBSetSolibSearchPath(libPaths);
|
||||||
try {
|
try {
|
||||||
|
@ -79,7 +85,8 @@ public class SourceManager extends SessionObject implements ICDISourceManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
public String[] getLibraryPaths() throws CDIException {
|
public String[] getLibraryPaths() throws CDIException {
|
||||||
MISession mi = getCSession().getMISession();
|
Session session = (Session)getSession();
|
||||||
|
MISession mi = session.getMISession();
|
||||||
CommandFactory factory = mi.getCommandFactory();
|
CommandFactory factory = mi.getCommandFactory();
|
||||||
MIGDBShowSolibSearchPath dir = factory.createMIGDBShowSolibSearchPath();
|
MIGDBShowSolibSearchPath dir = factory.createMIGDBShowSolibSearchPath();
|
||||||
try {
|
try {
|
||||||
|
@ -92,7 +99,8 @@ public class SourceManager extends SessionObject implements ICDISourceManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setAutoSolib(boolean set) throws CDIException {
|
public void setAutoSolib(boolean set) throws CDIException {
|
||||||
MISession mi = getCSession().getMISession();
|
Session session = (Session)getSession();
|
||||||
|
MISession mi = session.getMISession();
|
||||||
CommandFactory factory = mi.getCommandFactory();
|
CommandFactory factory = mi.getCommandFactory();
|
||||||
MIGDBSetAutoSolib solib = factory.createMIGDBSetAutoSolib(set);
|
MIGDBSetAutoSolib solib = factory.createMIGDBSetAutoSolib(set);
|
||||||
try {
|
try {
|
||||||
|
@ -107,7 +115,8 @@ public class SourceManager extends SessionObject implements ICDISourceManager {
|
||||||
* @see org.eclipse.cdt.debug.core.cdi.ICDISourceManager#getInstructions(String, int, int)
|
* @see org.eclipse.cdt.debug.core.cdi.ICDISourceManager#getInstructions(String, int, int)
|
||||||
*/
|
*/
|
||||||
public ICDIInstruction[] getInstructions(String filename, int linenum, int lines) throws CDIException {
|
public ICDIInstruction[] getInstructions(String filename, int linenum, int lines) throws CDIException {
|
||||||
MISession mi = getCSession().getMISession();
|
Session session = (Session)getSession();
|
||||||
|
MISession mi = session.getMISession();
|
||||||
CommandFactory factory = mi.getCommandFactory();
|
CommandFactory factory = mi.getCommandFactory();
|
||||||
MIDataDisassemble dis = factory.createMIDataDisassemble(filename, linenum, lines, false);
|
MIDataDisassemble dis = factory.createMIDataDisassemble(filename, linenum, lines, false);
|
||||||
try {
|
try {
|
||||||
|
@ -116,7 +125,7 @@ public class SourceManager extends SessionObject implements ICDISourceManager {
|
||||||
MIAsm[] asm = info.getMIAsms();
|
MIAsm[] asm = info.getMIAsms();
|
||||||
Instruction[] instructions = new Instruction[asm.length];
|
Instruction[] instructions = new Instruction[asm.length];
|
||||||
for (int i = 0; i < instructions.length; i++) {
|
for (int i = 0; i < instructions.length; i++) {
|
||||||
instructions[i] = new Instruction(getCSession().getCTarget(), asm[i]);
|
instructions[i] = new Instruction(session.getCurrentTarget(), asm[i]);
|
||||||
}
|
}
|
||||||
return instructions;
|
return instructions;
|
||||||
} catch (MIException e) {
|
} catch (MIException e) {
|
||||||
|
@ -135,7 +144,8 @@ public class SourceManager extends SessionObject implements ICDISourceManager {
|
||||||
* @see org.eclipse.cdt.debug.core.cdi.ICDISourceManager#getInstructions(long, long)
|
* @see org.eclipse.cdt.debug.core.cdi.ICDISourceManager#getInstructions(long, long)
|
||||||
*/
|
*/
|
||||||
public ICDIInstruction[] getInstructions(long start, long end) throws CDIException {
|
public ICDIInstruction[] getInstructions(long start, long end) throws CDIException {
|
||||||
MISession mi = getCSession().getMISession();
|
Session session = (Session)getSession();
|
||||||
|
MISession mi = session.getMISession();
|
||||||
CommandFactory factory = mi.getCommandFactory();
|
CommandFactory factory = mi.getCommandFactory();
|
||||||
String hex = "0x";
|
String hex = "0x";
|
||||||
String sa = hex + Long.toHexString(start);
|
String sa = hex + Long.toHexString(start);
|
||||||
|
@ -147,7 +157,7 @@ public class SourceManager extends SessionObject implements ICDISourceManager {
|
||||||
MIAsm[] asm = info.getMIAsms();
|
MIAsm[] asm = info.getMIAsms();
|
||||||
Instruction[] instructions = new Instruction[asm.length];
|
Instruction[] instructions = new Instruction[asm.length];
|
||||||
for (int i = 0; i < instructions.length; i++) {
|
for (int i = 0; i < instructions.length; i++) {
|
||||||
instructions[i] = new Instruction(getCSession().getCTarget(), asm[i]);
|
instructions[i] = new Instruction(session.getCurrentTarget(), asm[i]);
|
||||||
}
|
}
|
||||||
return instructions;
|
return instructions;
|
||||||
} catch (MIException e) {
|
} catch (MIException e) {
|
||||||
|
@ -159,7 +169,8 @@ public class SourceManager extends SessionObject implements ICDISourceManager {
|
||||||
* @see org.eclipse.cdt.debug.core.cdi.ICDISourceManager#getMixedInstructions(String, int, int)
|
* @see org.eclipse.cdt.debug.core.cdi.ICDISourceManager#getMixedInstructions(String, int, int)
|
||||||
*/
|
*/
|
||||||
public ICDIMixedInstruction[] getMixedInstructions(String filename, int linenum, int lines) throws CDIException {
|
public ICDIMixedInstruction[] getMixedInstructions(String filename, int linenum, int lines) throws CDIException {
|
||||||
MISession mi = getCSession().getMISession();
|
Session session = (Session)getSession();
|
||||||
|
MISession mi = session.getMISession();
|
||||||
CommandFactory factory = mi.getCommandFactory();
|
CommandFactory factory = mi.getCommandFactory();
|
||||||
MIDataDisassemble dis = factory.createMIDataDisassemble(filename, linenum, lines, true);
|
MIDataDisassemble dis = factory.createMIDataDisassemble(filename, linenum, lines, true);
|
||||||
try {
|
try {
|
||||||
|
@ -168,7 +179,7 @@ public class SourceManager extends SessionObject implements ICDISourceManager {
|
||||||
MISrcAsm[] srcAsm = info.getMISrcAsms();
|
MISrcAsm[] srcAsm = info.getMISrcAsms();
|
||||||
ICDIMixedInstruction[] mixed = new ICDIMixedInstruction[srcAsm.length];
|
ICDIMixedInstruction[] mixed = new ICDIMixedInstruction[srcAsm.length];
|
||||||
for (int i = 0; i < mixed.length; i++) {
|
for (int i = 0; i < mixed.length; i++) {
|
||||||
mixed[i] = new MixedInstruction(getCSession().getCTarget(), srcAsm[i]);
|
mixed[i] = new MixedInstruction(session.getCurrentTarget(), srcAsm[i]);
|
||||||
}
|
}
|
||||||
return mixed;
|
return mixed;
|
||||||
} catch (MIException e) {
|
} catch (MIException e) {
|
||||||
|
@ -187,7 +198,8 @@ public class SourceManager extends SessionObject implements ICDISourceManager {
|
||||||
* @see org.eclipse.cdt.debug.core.cdi.ICDISourceManager#getMixedInstructions(long, long)
|
* @see org.eclipse.cdt.debug.core.cdi.ICDISourceManager#getMixedInstructions(long, long)
|
||||||
*/
|
*/
|
||||||
public ICDIMixedInstruction[] getMixedInstructions(long start, long end) throws CDIException {
|
public ICDIMixedInstruction[] getMixedInstructions(long start, long end) throws CDIException {
|
||||||
MISession mi = getCSession().getMISession();
|
Session session = (Session)getSession();
|
||||||
|
MISession mi = session.getMISession();
|
||||||
CommandFactory factory = mi.getCommandFactory();
|
CommandFactory factory = mi.getCommandFactory();
|
||||||
String hex = "0x";
|
String hex = "0x";
|
||||||
String sa = hex + Long.toHexString(start);
|
String sa = hex + Long.toHexString(start);
|
||||||
|
@ -199,7 +211,7 @@ public class SourceManager extends SessionObject implements ICDISourceManager {
|
||||||
MISrcAsm[] srcAsm = info.getMISrcAsms();
|
MISrcAsm[] srcAsm = info.getMISrcAsms();
|
||||||
ICDIMixedInstruction[] mixed = new ICDIMixedInstruction[srcAsm.length];
|
ICDIMixedInstruction[] mixed = new ICDIMixedInstruction[srcAsm.length];
|
||||||
for (int i = 0; i < mixed.length; i++) {
|
for (int i = 0; i < mixed.length; i++) {
|
||||||
mixed[i] = new MixedInstruction(getCSession().getCTarget(), srcAsm[i]);
|
mixed[i] = new MixedInstruction(session.getCurrentTarget(), srcAsm[i]);
|
||||||
}
|
}
|
||||||
return mixed;
|
return mixed;
|
||||||
} catch (MIException e) {
|
} catch (MIException e) {
|
||||||
|
@ -207,4 +219,24 @@ public class SourceManager extends SessionObject implements ICDISourceManager {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see org.eclipse.cdt.debug.core.cdi.ICDISourceManager#isAutoUpdate()
|
||||||
|
*/
|
||||||
|
public boolean isAutoUpdate() {
|
||||||
|
return autoupdate;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see org.eclipse.cdt.debug.core.cdi.ICDISourceManager#setAutoUpdate(boolean)
|
||||||
|
*/
|
||||||
|
public void setAutoUpdate(boolean update) {
|
||||||
|
autoupdate = update;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see org.eclipse.cdt.debug.core.cdi.ICDISourceManager#update()
|
||||||
|
*/
|
||||||
|
public void update() throws CDIException {
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,64 @@
|
||||||
|
/*
|
||||||
|
*(c) Copyright QNX Software Systems Ltd. 2002.
|
||||||
|
* All Rights Reserved.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
package org.eclipse.cdt.debug.mi.core.cdi;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.debug.core.cdi.CDIException;
|
||||||
|
import org.eclipse.cdt.debug.mi.core.MIException;
|
||||||
|
import org.eclipse.cdt.debug.mi.core.MISession;
|
||||||
|
import org.eclipse.cdt.debug.mi.core.command.CommandFactory;
|
||||||
|
import org.eclipse.cdt.debug.mi.core.command.MIVarUpdate;
|
||||||
|
import org.eclipse.cdt.debug.mi.core.output.MIVarChange;
|
||||||
|
import org.eclipse.cdt.debug.mi.core.output.MIVarUpdateInfo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*/
|
||||||
|
public class UpdateManager {
|
||||||
|
|
||||||
|
Session session;
|
||||||
|
List updateList = Collections.synchronizedList(new ArrayList(5));
|
||||||
|
MIVarChange[] noChanges = new MIVarChange[0];
|
||||||
|
|
||||||
|
public UpdateManager(Session s) {
|
||||||
|
session = s;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addUpdateListener(IUpdateListener listener) {
|
||||||
|
updateList.add(listener);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void removeUpdateListener(IUpdateListener listener) {
|
||||||
|
updateList.remove(listener);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update the variables, from the response of the "-var-update *"
|
||||||
|
* mi/command.
|
||||||
|
*/
|
||||||
|
public void update() throws CDIException {
|
||||||
|
MIVarChange[] changes = noChanges;
|
||||||
|
MISession mi = session.getMISession();
|
||||||
|
CommandFactory factory = mi.getCommandFactory();
|
||||||
|
MIVarUpdate update = factory.createMIVarUpdate();
|
||||||
|
try {
|
||||||
|
mi.postCommand(update);
|
||||||
|
MIVarUpdateInfo info = update.getMIVarUpdateInfo();
|
||||||
|
if (info == null) {
|
||||||
|
throw new CDIException("No answer");
|
||||||
|
}
|
||||||
|
changes = info.getMIVarChanges();
|
||||||
|
} catch (MIException e) {
|
||||||
|
throw new MI2CDIException(e);
|
||||||
|
}
|
||||||
|
IUpdateListener[] listeners = (IUpdateListener[])updateList.toArray(new IUpdateListener[0]);
|
||||||
|
for (int i = 0; i < listeners.length; i++) {
|
||||||
|
listeners[i].changeList(changes);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -6,90 +6,83 @@
|
||||||
package org.eclipse.cdt.debug.mi.core.cdi;
|
package org.eclipse.cdt.debug.mi.core.cdi;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.eclipse.cdt.debug.core.cdi.CDIException;
|
import org.eclipse.cdt.debug.core.cdi.CDIException;
|
||||||
import org.eclipse.cdt.debug.core.cdi.ICDIExpressionManager;
|
import org.eclipse.cdt.debug.core.cdi.ICDIArgumentObject;
|
||||||
|
import org.eclipse.cdt.debug.core.cdi.ICDIVariableManager;
|
||||||
|
import org.eclipse.cdt.debug.core.cdi.ICDIVariableObject;
|
||||||
import org.eclipse.cdt.debug.core.cdi.model.ICDIArgument;
|
import org.eclipse.cdt.debug.core.cdi.model.ICDIArgument;
|
||||||
import org.eclipse.cdt.debug.core.cdi.model.ICDIExpression;
|
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.ICDIVariable;
|
import org.eclipse.cdt.debug.core.cdi.model.ICDIVariable;
|
||||||
import org.eclipse.cdt.debug.mi.core.MIException;
|
import org.eclipse.cdt.debug.mi.core.MIException;
|
||||||
import org.eclipse.cdt.debug.mi.core.MISession;
|
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.Argument;
|
||||||
import org.eclipse.cdt.debug.mi.core.cdi.model.CTarget;
|
|
||||||
import org.eclipse.cdt.debug.mi.core.cdi.model.CThread;
|
|
||||||
import org.eclipse.cdt.debug.mi.core.cdi.model.Expression;
|
|
||||||
import org.eclipse.cdt.debug.mi.core.cdi.model.StackFrame;
|
import org.eclipse.cdt.debug.mi.core.cdi.model.StackFrame;
|
||||||
|
import org.eclipse.cdt.debug.mi.core.cdi.model.Thread;
|
||||||
import org.eclipse.cdt.debug.mi.core.cdi.model.Variable;
|
import org.eclipse.cdt.debug.mi.core.cdi.model.Variable;
|
||||||
import org.eclipse.cdt.debug.mi.core.command.CommandFactory;
|
import org.eclipse.cdt.debug.mi.core.command.CommandFactory;
|
||||||
|
import org.eclipse.cdt.debug.mi.core.command.MIStackListArguments;
|
||||||
|
import org.eclipse.cdt.debug.mi.core.command.MIStackListLocals;
|
||||||
import org.eclipse.cdt.debug.mi.core.command.MIVarCreate;
|
import org.eclipse.cdt.debug.mi.core.command.MIVarCreate;
|
||||||
import org.eclipse.cdt.debug.mi.core.command.MIVarDelete;
|
import org.eclipse.cdt.debug.mi.core.command.MIVarDelete;
|
||||||
import org.eclipse.cdt.debug.mi.core.command.MIVarUpdate;
|
|
||||||
import org.eclipse.cdt.debug.mi.core.event.MIEvent;
|
import org.eclipse.cdt.debug.mi.core.event.MIEvent;
|
||||||
import org.eclipse.cdt.debug.mi.core.event.MIVarChangedEvent;
|
import org.eclipse.cdt.debug.mi.core.event.MIVarChangedEvent;
|
||||||
import org.eclipse.cdt.debug.mi.core.event.MIVarCreatedEvent;
|
import org.eclipse.cdt.debug.mi.core.output.MIArg;
|
||||||
|
import org.eclipse.cdt.debug.mi.core.output.MIFrame;
|
||||||
|
import org.eclipse.cdt.debug.mi.core.output.MIStackListArgumentsInfo;
|
||||||
|
import org.eclipse.cdt.debug.mi.core.output.MIStackListLocalsInfo;
|
||||||
import org.eclipse.cdt.debug.mi.core.output.MIVar;
|
import org.eclipse.cdt.debug.mi.core.output.MIVar;
|
||||||
import org.eclipse.cdt.debug.mi.core.output.MIVarChange;
|
import org.eclipse.cdt.debug.mi.core.output.MIVarChange;
|
||||||
import org.eclipse.cdt.debug.mi.core.output.MIVarCreateInfo;
|
import org.eclipse.cdt.debug.mi.core.output.MIVarCreateInfo;
|
||||||
import org.eclipse.cdt.debug.mi.core.output.MIVarUpdateInfo;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*/
|
*/
|
||||||
public class VariableManager extends SessionObject implements ICDIExpressionManager {
|
public class VariableManager extends SessionObject implements ICDIVariableManager, IUpdateListener {
|
||||||
|
|
||||||
List elementList;
|
List variableList;
|
||||||
List oosList; // Out of Scope variable lists;
|
boolean autoupdate;
|
||||||
|
|
||||||
/**
|
public VariableManager(Session session) {
|
||||||
* Class container to regroup all info concerning a variable.
|
|
||||||
*/
|
|
||||||
public class Element {
|
|
||||||
public MIVar miVar;
|
|
||||||
public String name;
|
|
||||||
public StackFrame stackframe;
|
|
||||||
public int stackdepth;
|
|
||||||
public Variable variable;
|
|
||||||
}
|
|
||||||
|
|
||||||
public VariableManager(CSession session) {
|
|
||||||
super(session);
|
super(session);
|
||||||
elementList = new ArrayList();
|
variableList = Collections.synchronizedList(new ArrayList());
|
||||||
oosList = new ArrayList();
|
autoupdate = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the element that have the uniq varName.
|
* Return the element that have the uniq varName.
|
||||||
|
* null is return if the element is not in the cache.
|
||||||
*/
|
*/
|
||||||
public Element getElement(String varName) {
|
public Variable getVariable(String varName) {
|
||||||
Element[] elements = getElements();
|
Variable[] vars = getVariables();
|
||||||
for (int i = 0; i < elements.length; i++) {
|
for (int i = 0; i < vars.length; i++) {
|
||||||
if (elements[i].miVar.getVarName().equals(varName)) {
|
if (vars[i].getMIVar().getVarName().equals(varName)) {
|
||||||
return elements[i];
|
return vars[i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the Element with that stackframe, stack, that with this name.
|
* Return the Element with this stackframe, and with this name.
|
||||||
* null is return if the element is not in the cache.
|
* null is return if the element is not in the cache.
|
||||||
*/
|
*/
|
||||||
Element getElement(StackFrame stack, String name) {
|
Variable findVariable(VariableObject v) throws CDIException {
|
||||||
Element[] elements = getElements();
|
ICDIStackFrame stack = v.getStackFrame();
|
||||||
for (int i = 0; i < elements.length; i++) {
|
String name = v.getName();
|
||||||
if (elements[i].name.equals(name)) {
|
int position = v.getPosition();
|
||||||
if (elements[i].stackframe.equals(stack)) {
|
int depth = v.getStackDepth();
|
||||||
int depth = 0;
|
Variable[] vars = getVariables();
|
||||||
CThread thread = stack.getCThread();
|
for (int i = 0; i < vars.length; i++) {
|
||||||
if (thread != null) {
|
if (vars[i].getName().equals(name)) {
|
||||||
try {
|
if (vars[i].getStackFrame().equals(stack)) {
|
||||||
depth = thread.getStackFrameCount();
|
if (vars[i].getVariableObject().getPosition() == position) {
|
||||||
} catch (CDIException e) {
|
if (vars[i].getVariableObject().getStackDepth() == depth) {
|
||||||
|
return vars[i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (elements[i].stackdepth == depth) {
|
|
||||||
return elements[i];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -99,112 +92,36 @@ public class VariableManager extends SessionObject implements ICDIExpressionMana
|
||||||
/**
|
/**
|
||||||
* Make sure an element is not added twice.
|
* Make sure an element is not added twice.
|
||||||
*/
|
*/
|
||||||
void addElement(Element element) {
|
void addVariable(Variable var) {
|
||||||
Element[] elements = getElements();
|
Variable[] vars = getVariables();
|
||||||
for (int i = 0; i < elements.length; i++) {
|
for (int i = 0; i < vars.length; i++) {
|
||||||
String name = elements[i].miVar.getVarName();
|
String name = vars[i].getMIVar().getVarName();
|
||||||
if (name.equals(element.miVar.getVarName())) {
|
if (name.equals(var.getMIVar().getVarName())) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
elementList.add(element);
|
variableList.add(var);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns all the elements that are in the cache.
|
* Returns all the elements that are in the cache.
|
||||||
*/
|
*/
|
||||||
Element[] getElements() {
|
Variable[] getVariables() {
|
||||||
return (Element[]) elementList.toArray(new Element[0]);
|
return (Variable[]) variableList.toArray(new Variable[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
public Variable createVariable(VariableObject v, MIVar mivar) throws CDIException {
|
||||||
* Update the elements in the cache, from the response of the "-var-update *"
|
Variable variable = new Variable(v, mivar);
|
||||||
* mi/command. Out-of-scope elements are removed etc ..
|
addVariable(variable);
|
||||||
* Expression are special they are not remove when out-of-scope is thrown.
|
return variable;
|
||||||
* For all remove element in the cache fires a destroy event.
|
|
||||||
*/
|
|
||||||
void update() throws CDIException {
|
|
||||||
MISession mi = getCSession().getMISession();
|
|
||||||
CommandFactory factory = mi.getCommandFactory();
|
|
||||||
MIVarUpdate update = factory.createMIVarUpdate();
|
|
||||||
try {
|
|
||||||
mi.postCommand(update);
|
|
||||||
MIVarUpdateInfo info = update.getMIVarUpdateInfo();
|
|
||||||
if (info == null) {
|
|
||||||
throw new CDIException("No answer");
|
|
||||||
}
|
|
||||||
MIVarChange[] changes = info.getMIVarChanges();
|
|
||||||
List eventList = new ArrayList(changes.length);
|
|
||||||
for (int i = 0 ; i < changes.length; i++) {
|
|
||||||
String varName = changes[i].getVarName();
|
|
||||||
Element element = getElement(varName);
|
|
||||||
if (element != null) {
|
|
||||||
eventList.add(new MIVarChangedEvent(update.getToken(), varName, changes[i].isInScope()));
|
|
||||||
}
|
|
||||||
if (! changes[i].isInScope()) {
|
|
||||||
// Only remove ICDIVariables.
|
|
||||||
if (! (element.variable instanceof Expression)) {
|
|
||||||
removeElement(changes[i]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
MIEvent[] events = (MIEvent[])eventList.toArray(new MIEvent[0]);
|
|
||||||
mi.fireEvents(events);
|
|
||||||
} catch (MIException e) {
|
|
||||||
throw new MI2CDIException(e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* If element is not in the cache create a new element "-var-create"
|
|
||||||
* for the stackframe(stack).
|
|
||||||
*/
|
|
||||||
Element createElement(StackFrame stack, String name) throws CDIException {
|
|
||||||
Element element = getElement(stack, name);
|
|
||||||
if (element == null) {
|
|
||||||
//stack.getCThread().setCurrentStackFrame(stack);
|
|
||||||
MISession mi = getCSession().getMISession();
|
|
||||||
CommandFactory factory = mi.getCommandFactory();
|
|
||||||
MIVarCreate var = factory.createMIVarCreate(name);
|
|
||||||
try {
|
|
||||||
mi.postCommand(var);
|
|
||||||
MIVarCreateInfo info = var.getMIVarCreateInfo();
|
|
||||||
if (info == null) {
|
|
||||||
throw new CDIException("No answer");
|
|
||||||
}
|
|
||||||
element = new Element();
|
|
||||||
element.miVar = info.getMIVar();
|
|
||||||
element.name = name;
|
|
||||||
element.stackframe = stack;
|
|
||||||
CThread thread = stack.getCThread();
|
|
||||||
if (thread != null) {
|
|
||||||
element.stackdepth = thread.getStackFrameCount();
|
|
||||||
}
|
|
||||||
} catch (MIException e) {
|
|
||||||
throw new MI2CDIException(e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return element;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Remove element from the OutOfscope list(oos).
|
|
||||||
*/
|
|
||||||
public Element removeOutOfScope(String varName) {
|
|
||||||
Element[] oos = (Element[])oosList.toArray(new Element[0]);
|
|
||||||
for (int i = 0; i < oos.length; i++) {
|
|
||||||
if (oos[i].miVar.getVarName().equals(varName)) {
|
|
||||||
return oos[i];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tell gdb to remove the underlying var-object also.
|
* Tell gdb to remove the underlying var-object also.
|
||||||
*/
|
*/
|
||||||
void removeMIVar(MIVar miVar) throws CDIException {
|
void removeMIVar(MIVar miVar) throws CDIException {
|
||||||
MISession mi = getCSession().getMISession();
|
Session session = (Session)getSession();
|
||||||
|
MISession mi = session.getMISession();
|
||||||
CommandFactory factory = mi.getCommandFactory();
|
CommandFactory factory = mi.getCommandFactory();
|
||||||
MIVarDelete var = factory.createMIVarDelete(miVar.getVarName());
|
MIVarDelete var = factory.createMIVarDelete(miVar.getVarName());
|
||||||
try {
|
try {
|
||||||
|
@ -220,146 +137,286 @@ public class VariableManager extends SessionObject implements ICDIExpressionMana
|
||||||
* because they are still needed for the destroy events. The destroy event will
|
* because they are still needed for the destroy events. The destroy event will
|
||||||
* call removeOutOfScope.
|
* call removeOutOfScope.
|
||||||
*/
|
*/
|
||||||
void removeElement(String varName) throws CDIException {
|
public void removeVariable(String varName) throws CDIException {
|
||||||
Element[] elements = getElements();
|
Variable[] vars = getVariables();
|
||||||
for (int i = 0; i < elements.length; i++) {
|
for (int i = 0; i < vars.length; i++) {
|
||||||
if (elements[i].miVar.getVarName().equals(varName)) {
|
if (vars[i].getMIVar().getVarName().equals(varName)) {
|
||||||
elementList.remove(elements[i]);
|
variableList.remove(vars[i]);
|
||||||
oosList.add(elements[i]); // Put on the Out Of Scope list
|
removeMIVar(vars[i].getMIVar());
|
||||||
removeMIVar(elements[i].miVar);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Finds the variable Uniq name and call removeElement().
|
* @see org.eclipse.cdt.debug.core.cdi.ICDIVariableManager#createArgument(ICDIArgumentObject)
|
||||||
*/
|
*/
|
||||||
void removeElement(MIVarChange changed) throws CDIException {
|
public ICDIArgument createArgument(ICDIArgumentObject a) throws CDIException {
|
||||||
String varName = changed.getVarName();
|
if (a instanceof ArgumentObject) {
|
||||||
removeElement(varName);
|
ArgumentObject argObj = (ArgumentObject)a;
|
||||||
|
Variable variable = findVariable(argObj);
|
||||||
|
Argument argument = null;
|
||||||
|
if (variable != null && variable instanceof Argument) {
|
||||||
|
argument = (Argument)variable;
|
||||||
|
}
|
||||||
|
if (argument == null) {
|
||||||
|
StackFrame stack = argObj.getStackFrame();
|
||||||
|
String name = argObj.getName();
|
||||||
|
Session session = (Session)getSession();
|
||||||
|
ICDITarget currentTarget = session.getCurrentTarget();
|
||||||
|
Thread currentThread = (Thread)currentTarget.getCurrentThread();
|
||||||
|
StackFrame currentFrame = (StackFrame)currentThread.getCurrentStackFrame();
|
||||||
|
((Thread)stack.getThread()).setCurrentStackFrame(stack, false);
|
||||||
|
try {
|
||||||
|
MISession mi = session.getMISession();
|
||||||
|
CommandFactory factory = mi.getCommandFactory();
|
||||||
|
MIVarCreate var = factory.createMIVarCreate(name);
|
||||||
|
mi.postCommand(var);
|
||||||
|
MIVarCreateInfo info = var.getMIVarCreateInfo();
|
||||||
|
if (info == null) {
|
||||||
|
throw new CDIException("No answer");
|
||||||
|
}
|
||||||
|
argument = new Argument(argObj, info.getMIVar());
|
||||||
|
addVariable(argument);
|
||||||
|
} catch (MIException e) {
|
||||||
|
throw new MI2CDIException(e);
|
||||||
|
} finally {
|
||||||
|
currentThread.setCurrentStackFrame(currentFrame, false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return argument;
|
||||||
|
}
|
||||||
|
throw new CDIException("Wrong variable type");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove the Element.
|
* @see org.eclipse.cdt.debug.core.cdi.ICDIVariableManager#getArgumentObject(ICDIStackFrame, String)
|
||||||
*/
|
*/
|
||||||
void removeElement(Variable variable) throws CDIException {
|
public ICDIArgumentObject getArgumentObject(ICDIStackFrame stack, String name)
|
||||||
String varName = ((Variable)variable).getMIVar().getVarName();
|
|
||||||
removeElement(varName);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Remove the elements.
|
|
||||||
*/
|
|
||||||
void removeElements(Variable[] variables) throws CDIException {
|
|
||||||
for (int i = 0; i < variables.length; i++) {
|
|
||||||
removeElement(variables[i]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public ICDIVariable createVariable(StackFrame stack, String name) throws CDIException {
|
|
||||||
Element element = createElement(stack, name);
|
|
||||||
Variable var;
|
|
||||||
if (element.variable != null) {
|
|
||||||
var = element.variable;
|
|
||||||
} else {
|
|
||||||
var = new Variable(stack, name, element.miVar);
|
|
||||||
element.variable = var;
|
|
||||||
addElement(element);
|
|
||||||
// Fire an created Event.
|
|
||||||
MISession mi = getCSession().getMISession();
|
|
||||||
mi.fireEvent(new MIVarCreatedEvent(element.miVar.getVarName()));
|
|
||||||
}
|
|
||||||
return var;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Variable createVariable(StackFrame stack, String name, MIVar miVar )
|
|
||||||
throws CDIException {
|
throws CDIException {
|
||||||
Element element = new Element();
|
ICDIArgumentObject[] argsObjects = getArgumentObjects(stack);
|
||||||
element.miVar = miVar;
|
for (int i = 0; i < argsObjects.length; i++) {
|
||||||
element.name = name;
|
if (argsObjects[i].getName().equals(name)) {
|
||||||
element.stackframe = stack;
|
return argsObjects[i];
|
||||||
Variable var = new Variable(stack, name, miVar);
|
|
||||||
element.variable = var;
|
|
||||||
addElement(element);
|
|
||||||
// Fire an created Event.
|
|
||||||
MISession mi = getCSession().getMISession();
|
|
||||||
mi.fireEvent(new MIVarCreatedEvent(miVar.getVarName()));
|
|
||||||
return var;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ICDIArgument createArgument(StackFrame stack, String name) throws CDIException {
|
|
||||||
Element element = createElement(stack, name);
|
|
||||||
Argument carg;
|
|
||||||
if (element.variable != null && element.variable instanceof Argument) {
|
|
||||||
carg = (Argument)element.variable;
|
|
||||||
} else {
|
|
||||||
carg = new Argument(stack, name,element.miVar);
|
|
||||||
element.variable = carg;
|
|
||||||
addElement(element);
|
|
||||||
// Fire an created Event.
|
|
||||||
MISession mi = getCSession().getMISession();
|
|
||||||
mi.fireEvent(new MIVarCreatedEvent(element.miVar.getVarName()));
|
|
||||||
}
|
|
||||||
return carg;
|
|
||||||
}
|
|
||||||
|
|
||||||
ICDIExpression createExpression(StackFrame stack, String name) throws CDIException {
|
|
||||||
Element element = createElement(stack, name);
|
|
||||||
Expression cexp;
|
|
||||||
if (element.variable != null && element.variable instanceof Expression) {
|
|
||||||
cexp = (Expression)element.variable;
|
|
||||||
} else {
|
|
||||||
cexp = new Expression(stack, name, element.miVar);
|
|
||||||
element.variable = cexp;
|
|
||||||
addElement(element);
|
|
||||||
// Fire an created Event.
|
|
||||||
MISession mi = getCSession().getMISession();
|
|
||||||
mi.fireEvent(new MIVarCreatedEvent(element.miVar.getVarName()));
|
|
||||||
}
|
|
||||||
return cexp;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see org.eclipse.cdt.debug.core.cdi.ICDIExpressionManager#createExpression(String)
|
|
||||||
*/
|
|
||||||
public ICDIExpression createExpression(String name) throws CDIException {
|
|
||||||
CTarget target = getCSession().getCTarget();
|
|
||||||
StackFrame frame = ((CThread)target.getCurrentThread()).getCurrentStackFrame();
|
|
||||||
return createExpression(frame, name);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see org.eclipse.cdt.debug.core.cdi.ICDIExpressionManager#getExpressions()
|
|
||||||
*/
|
|
||||||
public ICDIExpression[] getExpressions() throws CDIException {
|
|
||||||
Element[] elements = getElements();
|
|
||||||
List aList = new ArrayList(elements.length);
|
|
||||||
for (int i = 0; i < elements.length; i++) {
|
|
||||||
if (elements[i].variable instanceof ICDIExpression) {
|
|
||||||
aList.add(elements[i].variable);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return (ICDIExpression[])aList.toArray(new ICDIExpression[0]);
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see org.eclipse.cdt.debug.core.cdi.ICDIExpressionManager#removeExpression(ICDIExpression)
|
* @see org.eclipse.cdt.debug.core.cdi.ICDIVariableManager#getArgumentObjects(ICDIStackFrame)
|
||||||
*/
|
*/
|
||||||
public void removeExpression(ICDIExpression expression)
|
public ICDIArgumentObject[] getArgumentObjects(ICDIStackFrame frame) throws CDIException {
|
||||||
throws CDIException {
|
if (!(frame instanceof StackFrame)) {
|
||||||
if (expression instanceof Variable) {
|
return new ICDIArgumentObject[0];
|
||||||
removeElement((Variable)expression);
|
}
|
||||||
|
List argObjects = new ArrayList();
|
||||||
|
Session session = (Session)getSession();
|
||||||
|
ICDITarget currentTarget = session.getCurrentTarget();
|
||||||
|
Thread currentThread = (Thread)currentTarget.getCurrentThread();
|
||||||
|
StackFrame currentFrame = (StackFrame)currentThread.getCurrentStackFrame();
|
||||||
|
((Thread)(frame.getThread())).setCurrentStackFrame((StackFrame)frame, false);
|
||||||
|
try {
|
||||||
|
MISession mi = session.getMISession();
|
||||||
|
CommandFactory factory = mi.getCommandFactory();
|
||||||
|
int depth = frame.getThread().getStackFrameCount();
|
||||||
|
int level = frame.getLevel();
|
||||||
|
MIStackListArguments listArgs =
|
||||||
|
factory.createMIStackListArguments(false, level, level);
|
||||||
|
MIArg[] args = null;
|
||||||
|
mi.postCommand(listArgs);
|
||||||
|
MIStackListArgumentsInfo info = listArgs.getMIStackListArgumentsInfo();
|
||||||
|
if (info == null) {
|
||||||
|
throw new CDIException("No answer");
|
||||||
|
}
|
||||||
|
MIFrame[] miFrames = info.getMIFrames();
|
||||||
|
if (miFrames != null && miFrames.length == 1) {
|
||||||
|
args = miFrames[0].getArgs();
|
||||||
|
}
|
||||||
|
if (args != null) {
|
||||||
|
for (int i = 0; i < args.length; i++) {
|
||||||
|
ArgumentObject arg = new ArgumentObject(args[i].getName(),
|
||||||
|
(StackFrame)frame, args.length - i, depth);
|
||||||
|
argObjects.add(arg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (MIException e) {
|
||||||
|
throw new MI2CDIException(e);
|
||||||
|
} finally {
|
||||||
|
currentThread.setCurrentStackFrame(currentFrame);
|
||||||
|
}
|
||||||
|
return (ICDIArgumentObject[])argObjects.toArray(new ICDIArgumentObject[0]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see org.eclipse.cdt.debug.core.cdi.ICDIVariableManager#getVariableObject(ICDIStackFrame, String)
|
||||||
|
*/
|
||||||
|
public ICDIVariableObject getVariableObject(ICDIStackFrame stack, String name) throws CDIException {
|
||||||
|
ICDIVariableObject[] varObjects = getVariableObjects(stack);
|
||||||
|
for (int i = 0; i < varObjects.length; i++) {
|
||||||
|
if (varObjects[i].getName().equals(name)) {
|
||||||
|
return varObjects[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see org.eclipse.cdt.debug.core.cdi.ICDIVariableManager#getVariableObject(String, String, String)
|
||||||
|
*/
|
||||||
|
public ICDIVariableObject getVariableObject(String filename, String function, String name) throws CDIException {
|
||||||
|
if (filename == null) {
|
||||||
|
filename = new String();
|
||||||
|
}
|
||||||
|
if (function == null) {
|
||||||
|
function = new String();
|
||||||
|
}
|
||||||
|
if (name == null) {
|
||||||
|
name = new String();
|
||||||
|
}
|
||||||
|
StringBuffer buffer = new StringBuffer();
|
||||||
|
if (filename.length() > 0) {
|
||||||
|
buffer.append('\'').append(filename).append('\'').append("::");
|
||||||
|
}
|
||||||
|
if (function.length() > 0) {
|
||||||
|
buffer.append(function).append("::");
|
||||||
|
}
|
||||||
|
buffer.append(name);
|
||||||
|
return new VariableObject(buffer.toString(), null, 0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see org.eclipse.cdt.debug.core.cdi.ICDIVariableManager#getVariableObjects(ICDIStackFrame)
|
||||||
|
*/
|
||||||
|
public ICDIVariableObject[] getVariableObjects(ICDIStackFrame frame) throws CDIException {
|
||||||
|
if (!(frame instanceof StackFrame)) {
|
||||||
|
return new ICDIVariableObject[0];
|
||||||
|
}
|
||||||
|
List varObjects = new ArrayList();
|
||||||
|
Session session = (Session)getSession();
|
||||||
|
ICDITarget currentTarget = session.getCurrentTarget();
|
||||||
|
Thread currentThread = (Thread)currentTarget.getCurrentThread();
|
||||||
|
StackFrame currentFrame = (StackFrame)currentThread.getCurrentStackFrame();
|
||||||
|
((Thread)(frame.getThread())).setCurrentStackFrame((StackFrame)frame, false);
|
||||||
|
try {
|
||||||
|
MISession mi = session.getMISession();
|
||||||
|
CommandFactory factory = mi.getCommandFactory();
|
||||||
|
int depth = frame.getThread().getStackFrameCount();
|
||||||
|
MIArg[] args = null;
|
||||||
|
MIStackListLocals locals = factory.createMIStackListLocals(false);
|
||||||
|
mi.postCommand(locals);
|
||||||
|
MIStackListLocalsInfo info = locals.getMIStackListLocalsInfo();
|
||||||
|
if (info == null) {
|
||||||
|
throw new CDIException("No answer");
|
||||||
|
}
|
||||||
|
args = info.getLocals();
|
||||||
|
if (args != null) {
|
||||||
|
for (int i = 0; i < args.length; i++) {
|
||||||
|
VariableObject varObj = new VariableObject(args[i].getName(),
|
||||||
|
(StackFrame)frame, args.length - i, depth);
|
||||||
|
varObjects.add(varObj);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (MIException e) {
|
||||||
|
throw new MI2CDIException(e);
|
||||||
|
} finally {
|
||||||
|
currentThread.setCurrentStackFrame((StackFrame)currentFrame, false);
|
||||||
|
}
|
||||||
|
return (ICDIVariableObject[])varObjects.toArray(new ICDIVariableObject[0]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see org.eclipse.cdt.debug.core.cdi.ICDIVariableManager#createVariable(ICDIVariableObject)
|
||||||
|
*/
|
||||||
|
public ICDIVariable createVariable(ICDIVariableObject v) throws CDIException {
|
||||||
|
if (v instanceof VariableObject) {
|
||||||
|
VariableObject varObj = (VariableObject)v;
|
||||||
|
Variable variable = findVariable(varObj);
|
||||||
|
if (variable == null) {
|
||||||
|
StackFrame stack = varObj.getStackFrame();
|
||||||
|
String name = varObj.getName();
|
||||||
|
Session session = (Session)getSession();
|
||||||
|
ICDITarget currentTarget = session.getCurrentTarget();
|
||||||
|
Thread currentThread = (Thread)currentTarget.getCurrentThread();
|
||||||
|
StackFrame currentFrame = (StackFrame)currentThread.getCurrentStackFrame();
|
||||||
|
((Thread)stack.getThread()).setCurrentStackFrame(stack, false);
|
||||||
|
try {
|
||||||
|
MISession mi = session.getMISession();
|
||||||
|
CommandFactory factory = mi.getCommandFactory();
|
||||||
|
MIVarCreate var = factory.createMIVarCreate(name);
|
||||||
|
mi.postCommand(var);
|
||||||
|
MIVarCreateInfo info = var.getMIVarCreateInfo();
|
||||||
|
if (info == null) {
|
||||||
|
throw new CDIException("No answer");
|
||||||
|
}
|
||||||
|
variable = new Variable(varObj, info.getMIVar());
|
||||||
|
addVariable(variable);
|
||||||
|
} catch (MIException e) {
|
||||||
|
throw new MI2CDIException(e);
|
||||||
|
} finally {
|
||||||
|
currentThread.setCurrentStackFrame(currentFrame, false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return variable;
|
||||||
|
}
|
||||||
|
throw new CDIException("Wrong variable type");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see org.eclipse.cdt.debug.core.cdi.ICDIVariableManager#destroyVariable(ICDIVariable)
|
||||||
|
*/
|
||||||
|
public void destroyVariable(ICDIVariable var) throws CDIException {
|
||||||
|
if (var instanceof Variable) {
|
||||||
|
// Fire a destroyEvent ?
|
||||||
|
Variable variable = (Variable)var;
|
||||||
|
MIVarChangedEvent change = new MIVarChangedEvent(0, variable.getMIVar().getVarName(), false);
|
||||||
|
Session session = (Session)getSession();
|
||||||
|
MISession mi = session.getMISession();
|
||||||
|
mi.fireEvent(change);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see org.eclipse.cdt.debug.core.cdi.ICDIExpressionManager#removeExpressions(ICDIExpression[])
|
* @see org.eclipse.cdt.debug.mi.core.cdi.IVarUpdateListener#changeList(MIVarChange[])
|
||||||
*/
|
*/
|
||||||
public void removeExpressions(ICDIExpression[] expressions)
|
public void changeList(MIVarChange[] changes) {
|
||||||
throws CDIException {
|
List eventList = new ArrayList(changes.length);
|
||||||
for (int i = 0; i < expressions.length; i++) {
|
for (int i = 0 ; i < changes.length; i++) {
|
||||||
removeExpression(expressions[i]);
|
String varName = changes[i].getVarName();
|
||||||
|
Variable variable = getVariable(varName);
|
||||||
|
if (variable != null) {
|
||||||
|
eventList.add(new MIVarChangedEvent(0, varName, changes[i].isInScope()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Session session = (Session)getSession();
|
||||||
|
MISession mi = session.getMISession();
|
||||||
|
MIEvent[] events = (MIEvent[])eventList.toArray(new MIEvent[0]);
|
||||||
|
mi.fireEvents(events);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see org.eclipse.cdt.debug.core.cdi.ICDIVariableManager#isAutoUpdate()
|
||||||
|
*/
|
||||||
|
public boolean isAutoUpdate() {
|
||||||
|
return autoupdate;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see org.eclipse.cdt.debug.core.cdi.ICDIVariableManager#setAutoUpdate(boolean)
|
||||||
|
*/
|
||||||
|
public void setAutoUpdate(boolean update) {
|
||||||
|
autoupdate = update;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update the elements in the cache, from the response of the "-var-update *"
|
||||||
|
* mi/command.
|
||||||
|
*
|
||||||
|
* @see org.eclipse.cdt.debug.core.cdi.ICDIVariableManager#createArgument(ICDIArgumentObject)
|
||||||
|
*/
|
||||||
|
public void update() throws CDIException {
|
||||||
|
Session session = (Session)getSession();
|
||||||
|
UpdateManager mgr = session.getUpdateManager();
|
||||||
|
mgr.update();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,47 @@
|
||||||
|
/*
|
||||||
|
*(c) Copyright QNX Software Systems Ltd. 2002.
|
||||||
|
* All Rights Reserved.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
package org.eclipse.cdt.debug.mi.core.cdi;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.debug.core.cdi.ICDIVariableObject;
|
||||||
|
import org.eclipse.cdt.debug.mi.core.cdi.model.StackFrame;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*/
|
||||||
|
public class VariableObject implements ICDIVariableObject {
|
||||||
|
|
||||||
|
String name;
|
||||||
|
int position;
|
||||||
|
StackFrame frame;
|
||||||
|
int stackdepth;
|
||||||
|
|
||||||
|
public VariableObject(String n, StackFrame stack, int pos, int depth) {
|
||||||
|
name = n;
|
||||||
|
frame = stack;
|
||||||
|
position = pos;
|
||||||
|
stackdepth = depth;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public StackFrame getStackFrame() {
|
||||||
|
return frame;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getPosition() {
|
||||||
|
return position;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getStackDepth() {
|
||||||
|
return stackdepth;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see org.eclipse.cdt.debug.core.cdi.ICDIVariableObject#getName()
|
||||||
|
*/
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -16,7 +16,7 @@ public class WatchpointScope extends SessionObject implements ICDIWatchpointScop
|
||||||
|
|
||||||
MIWatchpointScopeEvent watchEvent;
|
MIWatchpointScopeEvent watchEvent;
|
||||||
|
|
||||||
public WatchpointScope(CSession session, MIWatchpointScopeEvent e) {
|
public WatchpointScope(Session session, MIWatchpointScopeEvent e) {
|
||||||
super(session);
|
super(session);
|
||||||
watchEvent = e;
|
watchEvent = e;
|
||||||
}
|
}
|
||||||
|
@ -27,7 +27,7 @@ public class WatchpointScope extends SessionObject implements ICDIWatchpointScop
|
||||||
public ICDIWatchpoint getWatchpoint() {
|
public ICDIWatchpoint getWatchpoint() {
|
||||||
int number = watchEvent.getNumber();
|
int number = watchEvent.getNumber();
|
||||||
// Ask the breakpointManager for the breakpoint
|
// Ask the breakpointManager for the breakpoint
|
||||||
BreakpointManager mgr = (BreakpointManager)getCSession().getBreakpointManager();
|
BreakpointManager mgr = (BreakpointManager)getSession().getBreakpointManager();
|
||||||
// We need to return the same object as the reason.
|
// We need to return the same object as the reason.
|
||||||
Watchpoint point = mgr.getWatchpoint(number);
|
Watchpoint point = mgr.getWatchpoint(number);
|
||||||
// FIXME: if point ==null ??? Create a new breakpoint ?
|
// FIXME: if point ==null ??? Create a new breakpoint ?
|
||||||
|
|
|
@ -16,7 +16,7 @@ public class WatchpointTrigger extends SessionObject implements ICDIWatchpointTr
|
||||||
|
|
||||||
MIWatchpointTriggerEvent watchEvent;
|
MIWatchpointTriggerEvent watchEvent;
|
||||||
|
|
||||||
public WatchpointTrigger(CSession session, MIWatchpointTriggerEvent e) {
|
public WatchpointTrigger(Session session, MIWatchpointTriggerEvent e) {
|
||||||
super(session);
|
super(session);
|
||||||
watchEvent = e;
|
watchEvent = e;
|
||||||
}
|
}
|
||||||
|
@ -41,7 +41,7 @@ public class WatchpointTrigger extends SessionObject implements ICDIWatchpointTr
|
||||||
public ICDIWatchpoint getWatchpoint() {
|
public ICDIWatchpoint getWatchpoint() {
|
||||||
int number = watchEvent.getNumber();
|
int number = watchEvent.getNumber();
|
||||||
// Ask the breakpointManager for the breakpoint
|
// Ask the breakpointManager for the breakpoint
|
||||||
BreakpointManager mgr = (BreakpointManager)getCSession().getBreakpointManager();
|
BreakpointManager mgr = (BreakpointManager)getSession().getBreakpointManager();
|
||||||
// We need to return the same object as the reason.
|
// We need to return the same object as the reason.
|
||||||
Watchpoint point = mgr.getWatchpoint(number);
|
Watchpoint point = mgr.getWatchpoint(number);
|
||||||
// FIXME: if point ==null ??? Create a new breakpoint ?
|
// FIXME: if point ==null ??? Create a new breakpoint ?
|
||||||
|
|
|
@ -23,7 +23,7 @@ public class Breakpoint extends CObject implements ICDILocationBreakpoint {
|
||||||
BreakpointManager mgr;
|
BreakpointManager mgr;
|
||||||
|
|
||||||
public Breakpoint(BreakpointManager m, MIBreakpoint miBreak) {
|
public Breakpoint(BreakpointManager m, MIBreakpoint miBreak) {
|
||||||
super(m.getCSession().getCTarget());
|
super(m.getSession().getCurrentTarget());
|
||||||
miBreakpoint = miBreak;
|
miBreakpoint = miBreak;
|
||||||
mgr = m;
|
mgr = m;
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,9 +11,9 @@ import org.eclipse.cdt.debug.core.cdi.model.ICDITarget;
|
||||||
*/
|
*/
|
||||||
public class CObject implements ICDIObject {
|
public class CObject implements ICDIObject {
|
||||||
|
|
||||||
CTarget target;
|
ICDITarget target;
|
||||||
|
|
||||||
public CObject(CTarget t) {
|
public CObject(ICDITarget t) {
|
||||||
target = t;
|
target = t;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -24,8 +24,4 @@ public class CObject implements ICDIObject {
|
||||||
return target;
|
return target;
|
||||||
}
|
}
|
||||||
|
|
||||||
public CTarget getCTarget() {
|
|
||||||
return target;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,13 +6,14 @@
|
||||||
package org.eclipse.cdt.debug.mi.core.cdi.model;
|
package org.eclipse.cdt.debug.mi.core.cdi.model;
|
||||||
|
|
||||||
import org.eclipse.cdt.debug.core.cdi.model.ICDIExpression;
|
import org.eclipse.cdt.debug.core.cdi.model.ICDIExpression;
|
||||||
|
import org.eclipse.cdt.debug.mi.core.cdi.VariableObject;
|
||||||
import org.eclipse.cdt.debug.mi.core.output.MIVar;
|
import org.eclipse.cdt.debug.mi.core.output.MIVar;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*/
|
*/
|
||||||
public class Expression extends Variable implements ICDIExpression {
|
public class Expression extends Variable implements ICDIExpression {
|
||||||
|
|
||||||
public Expression(StackFrame stackframe, String name, MIVar var) {
|
public Expression(VariableObject obj, MIVar var) {
|
||||||
super(stackframe, name, var);
|
super(obj, var);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
package org.eclipse.cdt.debug.mi.core.cdi.model;
|
package org.eclipse.cdt.debug.mi.core.cdi.model;
|
||||||
|
|
||||||
import org.eclipse.cdt.debug.core.cdi.model.ICDIInstruction;
|
import org.eclipse.cdt.debug.core.cdi.model.ICDIInstruction;
|
||||||
|
import org.eclipse.cdt.debug.core.cdi.model.ICDITarget;
|
||||||
import org.eclipse.cdt.debug.mi.core.output.MIAsm;
|
import org.eclipse.cdt.debug.mi.core.output.MIAsm;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -14,7 +15,7 @@ public class Instruction extends CObject implements ICDIInstruction {
|
||||||
|
|
||||||
MIAsm asm;
|
MIAsm asm;
|
||||||
|
|
||||||
public Instruction(CTarget target, MIAsm a) {
|
public Instruction(ICDITarget target, MIAsm a) {
|
||||||
super(target);
|
super(target);
|
||||||
asm = a;
|
asm = a;
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,11 +5,13 @@ import java.util.List;
|
||||||
|
|
||||||
import org.eclipse.cdt.debug.core.cdi.CDIException;
|
import org.eclipse.cdt.debug.core.cdi.CDIException;
|
||||||
import org.eclipse.cdt.debug.core.cdi.model.ICDIMemoryBlock;
|
import org.eclipse.cdt.debug.core.cdi.model.ICDIMemoryBlock;
|
||||||
|
import org.eclipse.cdt.debug.core.cdi.model.ICDITarget;
|
||||||
import org.eclipse.cdt.debug.mi.core.MIException;
|
import org.eclipse.cdt.debug.mi.core.MIException;
|
||||||
import org.eclipse.cdt.debug.mi.core.MIFormat;
|
import org.eclipse.cdt.debug.mi.core.MIFormat;
|
||||||
import org.eclipse.cdt.debug.mi.core.MISession;
|
import org.eclipse.cdt.debug.mi.core.MISession;
|
||||||
import org.eclipse.cdt.debug.mi.core.cdi.MI2CDIException;
|
import org.eclipse.cdt.debug.mi.core.cdi.MI2CDIException;
|
||||||
import org.eclipse.cdt.debug.mi.core.cdi.MemoryManager;
|
import org.eclipse.cdt.debug.mi.core.cdi.MemoryManager;
|
||||||
|
import org.eclipse.cdt.debug.mi.core.cdi.Session;
|
||||||
import org.eclipse.cdt.debug.mi.core.command.CommandFactory;
|
import org.eclipse.cdt.debug.mi.core.command.CommandFactory;
|
||||||
import org.eclipse.cdt.debug.mi.core.command.MIDataWriteMemory;
|
import org.eclipse.cdt.debug.mi.core.command.MIDataWriteMemory;
|
||||||
import org.eclipse.cdt.debug.mi.core.output.MIDataReadMemoryInfo;
|
import org.eclipse.cdt.debug.mi.core.output.MIDataReadMemoryInfo;
|
||||||
|
@ -25,7 +27,7 @@ public class MemoryBlock extends CObject implements ICDIMemoryBlock {
|
||||||
boolean frozen;
|
boolean frozen;
|
||||||
boolean dirty;
|
boolean dirty;
|
||||||
|
|
||||||
public MemoryBlock(CTarget target, String exp, MIDataReadMemoryInfo info) {
|
public MemoryBlock(ICDITarget target, String exp, MIDataReadMemoryInfo info) {
|
||||||
super(target);
|
super(target);
|
||||||
expression = exp;
|
expression = exp;
|
||||||
mem = info;
|
mem = info;
|
||||||
|
@ -115,7 +117,7 @@ public class MemoryBlock extends CObject implements ICDIMemoryBlock {
|
||||||
* @see org.eclipse.cdt.debug.core.cdi.model.ICDIMemoryBlock#refresh()
|
* @see org.eclipse.cdt.debug.core.cdi.model.ICDIMemoryBlock#refresh()
|
||||||
*/
|
*/
|
||||||
public void refresh() throws CDIException {
|
public void refresh() throws CDIException {
|
||||||
MemoryManager mgr = (MemoryManager)getCTarget().getCSession().getMemoryManager();
|
MemoryManager mgr = (MemoryManager)getTarget().getSession().getMemoryManager();
|
||||||
setDirty(true);
|
setDirty(true);
|
||||||
Long[] addresses = mgr.update(this, null);
|
Long[] addresses = mgr.update(this, null);
|
||||||
// Check if this affects other blocks.
|
// Check if this affects other blocks.
|
||||||
|
@ -165,7 +167,8 @@ public class MemoryBlock extends CObject implements ICDIMemoryBlock {
|
||||||
if (offset >= getLength() || offset + bytes.length > getLength()) {
|
if (offset >= getLength() || offset + bytes.length > getLength()) {
|
||||||
throw new CDIException("Bad Offset");
|
throw new CDIException("Bad Offset");
|
||||||
}
|
}
|
||||||
MISession mi = getCTarget().getCSession().getMISession();
|
Session session = (Session)getTarget().getSession();
|
||||||
|
MISession mi = session.getMISession();
|
||||||
CommandFactory factory = mi.getCommandFactory();
|
CommandFactory factory = mi.getCommandFactory();
|
||||||
for (int i = 0; i < bytes.length; i++) {
|
for (int i = 0; i < bytes.length; i++) {
|
||||||
long l = new Byte(bytes[i]).longValue() & 0xff;
|
long l = new Byte(bytes[i]).longValue() & 0xff;
|
||||||
|
|
|
@ -7,6 +7,7 @@ package org.eclipse.cdt.debug.mi.core.cdi.model;
|
||||||
|
|
||||||
import org.eclipse.cdt.debug.core.cdi.model.ICDIInstruction;
|
import org.eclipse.cdt.debug.core.cdi.model.ICDIInstruction;
|
||||||
import org.eclipse.cdt.debug.core.cdi.model.ICDIMixedInstruction;
|
import org.eclipse.cdt.debug.core.cdi.model.ICDIMixedInstruction;
|
||||||
|
import org.eclipse.cdt.debug.core.cdi.model.ICDITarget;
|
||||||
import org.eclipse.cdt.debug.mi.core.output.MIAsm;
|
import org.eclipse.cdt.debug.mi.core.output.MIAsm;
|
||||||
import org.eclipse.cdt.debug.mi.core.output.MISrcAsm;
|
import org.eclipse.cdt.debug.mi.core.output.MISrcAsm;
|
||||||
|
|
||||||
|
@ -16,7 +17,7 @@ public class MixedInstruction extends CObject implements ICDIMixedInstruction {
|
||||||
|
|
||||||
MISrcAsm srcAsm;
|
MISrcAsm srcAsm;
|
||||||
|
|
||||||
public MixedInstruction (CTarget target, MISrcAsm a) {
|
public MixedInstruction (ICDITarget target, MISrcAsm a) {
|
||||||
super(target);
|
super(target);
|
||||||
srcAsm = a;
|
srcAsm = a;
|
||||||
}
|
}
|
||||||
|
@ -35,7 +36,7 @@ public class MixedInstruction extends CObject implements ICDIMixedInstruction {
|
||||||
MIAsm[] asms = srcAsm.getMIAsms();
|
MIAsm[] asms = srcAsm.getMIAsms();
|
||||||
ICDIInstruction[] instructions = new ICDIInstruction[asms.length];
|
ICDIInstruction[] instructions = new ICDIInstruction[asms.length];
|
||||||
for (int i = 0; i < asms.length; i++) {
|
for (int i = 0; i < asms.length; i++) {
|
||||||
instructions[i] = new Instruction(getCTarget(), asms[i]);
|
instructions[i] = new Instruction(getTarget(), asms[i]);
|
||||||
}
|
}
|
||||||
return instructions;
|
return instructions;
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,6 +12,8 @@ import java.util.StringTokenizer;
|
||||||
import org.eclipse.cdt.debug.core.cdi.CDIException;
|
import org.eclipse.cdt.debug.core.cdi.CDIException;
|
||||||
import org.eclipse.cdt.debug.core.cdi.ICDIRegisterObject;
|
import org.eclipse.cdt.debug.core.cdi.ICDIRegisterObject;
|
||||||
import org.eclipse.cdt.debug.core.cdi.model.ICDIRegister;
|
import org.eclipse.cdt.debug.core.cdi.model.ICDIRegister;
|
||||||
|
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.ICDIValue;
|
import org.eclipse.cdt.debug.core.cdi.model.ICDIValue;
|
||||||
import org.eclipse.cdt.debug.core.cdi.model.ICDIVariable;
|
import org.eclipse.cdt.debug.core.cdi.model.ICDIVariable;
|
||||||
import org.eclipse.cdt.debug.mi.core.MIException;
|
import org.eclipse.cdt.debug.mi.core.MIException;
|
||||||
|
@ -20,6 +22,7 @@ import org.eclipse.cdt.debug.mi.core.MISession;
|
||||||
import org.eclipse.cdt.debug.mi.core.cdi.Format;
|
import org.eclipse.cdt.debug.mi.core.cdi.Format;
|
||||||
import org.eclipse.cdt.debug.mi.core.cdi.MI2CDIException;
|
import org.eclipse.cdt.debug.mi.core.cdi.MI2CDIException;
|
||||||
import org.eclipse.cdt.debug.mi.core.cdi.RegisterObject;
|
import org.eclipse.cdt.debug.mi.core.cdi.RegisterObject;
|
||||||
|
import org.eclipse.cdt.debug.mi.core.cdi.Session;
|
||||||
import org.eclipse.cdt.debug.mi.core.command.CommandFactory;
|
import org.eclipse.cdt.debug.mi.core.command.CommandFactory;
|
||||||
import org.eclipse.cdt.debug.mi.core.command.MIDataListRegisterValues;
|
import org.eclipse.cdt.debug.mi.core.command.MIDataListRegisterValues;
|
||||||
import org.eclipse.cdt.debug.mi.core.command.MIDataWriteRegisterValues;
|
import org.eclipse.cdt.debug.mi.core.command.MIDataWriteRegisterValues;
|
||||||
|
@ -43,12 +46,12 @@ public class Register extends CObject implements ICDIRegister, ICDIValue {
|
||||||
* gdb/mi -data-list-register-values returns the value like this
|
* gdb/mi -data-list-register-values returns the value like this
|
||||||
* value="{f = {0x0, 0x0, 0x0, 0x0}}"
|
* value="{f = {0x0, 0x0, 0x0, 0x0}}"
|
||||||
* we'll parse() it and change it to:
|
* we'll parse() it and change it to:
|
||||||
* Argument[0] = { "xmm0", "{f = {0x0, 0x0, 0x0, 0x0}}"
|
* Argument[0] = { "xmm0", "{f = {0x0, 0x1, 0x2, 0x3}}"}
|
||||||
* Argument[1] = { "xmm0.f", "{0x0, 0x0, 0x0, 0x0}"}
|
* Argument[1] = { "xmm0.f", "{0x0, 0x1, 0x2, 0x3}"}
|
||||||
* Argument[2] = { "xmm0.f.0", "0x0"}
|
* Argument[2] = { "xmm0.f.0", "0x0"}
|
||||||
* Argument[3] = { "xmm0.f.1", "0x0"}
|
* Argument[3] = { "xmm0.f.1", "0x1"}
|
||||||
* Argument[4] = { "xmm0.f.2", "0x0"}
|
* Argument[4] = { "xmm0.f.2", "0x2"}
|
||||||
* Argument[5] = { "xmm0.f.3", "0x0"}
|
* Argument[5] = { "xmm0.f.3", "0x3"}
|
||||||
* see @parse()
|
* see @parse()
|
||||||
*/
|
*/
|
||||||
class Argument {
|
class Argument {
|
||||||
|
@ -66,7 +69,7 @@ public class Register extends CObject implements ICDIRegister, ICDIValue {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public Register(CTarget target, ICDIRegisterObject r) {
|
public Register(ICDITarget target, ICDIRegisterObject r) {
|
||||||
super(target);
|
super(target);
|
||||||
parent = null;
|
parent = null;
|
||||||
lastname = r.getName();
|
lastname = r.getName();
|
||||||
|
@ -74,7 +77,7 @@ public class Register extends CObject implements ICDIRegister, ICDIValue {
|
||||||
}
|
}
|
||||||
|
|
||||||
public Register(Register p, String n) {
|
public Register(Register p, String n) {
|
||||||
super(p.getCTarget());
|
super(p.getTarget());
|
||||||
parent = p;
|
parent = p;
|
||||||
lastname = n;
|
lastname = n;
|
||||||
}
|
}
|
||||||
|
@ -83,7 +86,7 @@ public class Register extends CObject implements ICDIRegister, ICDIValue {
|
||||||
* return the MI regno.
|
* return the MI regno.
|
||||||
*/
|
*/
|
||||||
public int getID() {
|
public int getID() {
|
||||||
return regObject.getId();
|
return regObject.getPosition();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -151,9 +154,10 @@ public class Register extends CObject implements ICDIRegister, ICDIValue {
|
||||||
*/
|
*/
|
||||||
public String getValueString() throws CDIException {
|
public String getValueString() throws CDIException {
|
||||||
if (parent == null) {
|
if (parent == null) {
|
||||||
MISession mi = getCTarget().getCSession().getMISession();
|
Session session = (Session)getTarget().getSession();
|
||||||
|
MISession mi = session.getMISession();
|
||||||
CommandFactory factory = mi.getCommandFactory();
|
CommandFactory factory = mi.getCommandFactory();
|
||||||
int[] regno = new int[]{regObject.getId()};
|
int[] regno = new int[]{regObject.getPosition()};
|
||||||
MIDataListRegisterValues registers =
|
MIDataListRegisterValues registers =
|
||||||
factory.createMIDataListRegisterValues(format, regno);
|
factory.createMIDataListRegisterValues(format, regno);
|
||||||
try {
|
try {
|
||||||
|
@ -204,9 +208,10 @@ public class Register extends CObject implements ICDIRegister, ICDIValue {
|
||||||
* @see org.eclipse.cdt.debug.core.cdi.model.ICDIVariable#setValue(String)
|
* @see org.eclipse.cdt.debug.core.cdi.model.ICDIVariable#setValue(String)
|
||||||
*/
|
*/
|
||||||
public void setValue(String expression) throws CDIException {
|
public void setValue(String expression) throws CDIException {
|
||||||
MISession mi = getCTarget().getCSession().getMISession();
|
Session session = (Session)getTarget().getSession();
|
||||||
|
MISession mi = session.getMISession();
|
||||||
CommandFactory factory = mi.getCommandFactory();
|
CommandFactory factory = mi.getCommandFactory();
|
||||||
int[] regnos = new int[]{regObject.getId()};
|
int[] regnos = new int[]{regObject.getPosition()};
|
||||||
String[] values = new String[]{expression};
|
String[] values = new String[]{expression};
|
||||||
MIDataWriteRegisterValues registers =
|
MIDataWriteRegisterValues registers =
|
||||||
factory.createMIDataWriteRegisterValues(format, regnos, values);
|
factory.createMIDataWriteRegisterValues(format, regnos, values);
|
||||||
|
@ -221,7 +226,7 @@ public class Register extends CObject implements ICDIRegister, ICDIValue {
|
||||||
}
|
}
|
||||||
// If the assign was succesfull fire a MIRegisterChangedEvent()
|
// If the assign was succesfull fire a MIRegisterChangedEvent()
|
||||||
MIRegisterChangedEvent change = new MIRegisterChangedEvent(registers.getToken(),
|
MIRegisterChangedEvent change = new MIRegisterChangedEvent(registers.getToken(),
|
||||||
regObject.getName(), regObject.getId());
|
regObject.getName(), regObject.getPosition());
|
||||||
mi.fireEvent(change);
|
mi.fireEvent(change);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -317,4 +322,12 @@ public class Register extends CObject implements ICDIRegister, ICDIValue {
|
||||||
}
|
}
|
||||||
return (Argument[])aList.toArray(new Argument[0]);
|
return (Argument[])aList.toArray(new Argument[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see org.eclipse.cdt.debug.core.cdi.model.ICDIVariable#getStackFrame()
|
||||||
|
*/
|
||||||
|
public ICDIStackFrame getStackFrame() throws CDIException {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,7 +20,7 @@ public class SharedLibrary extends CObject implements ICDISharedLibrary {
|
||||||
MIShared miShared;
|
MIShared miShared;
|
||||||
|
|
||||||
public SharedLibrary(SharedLibraryManager m, MIShared slib) {
|
public SharedLibrary(SharedLibraryManager m, MIShared slib) {
|
||||||
super(m.getCSession().getCTarget());
|
super(m.getSession().getCurrentTarget());
|
||||||
mgr = m;
|
mgr = m;
|
||||||
miShared = slib;
|
miShared = slib;
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
package org.eclipse.cdt.debug.mi.core.cdi.model;
|
package org.eclipse.cdt.debug.mi.core.cdi.model;
|
||||||
|
|
||||||
import org.eclipse.cdt.debug.core.cdi.model.ICDISignal;
|
import org.eclipse.cdt.debug.core.cdi.model.ICDISignal;
|
||||||
|
import org.eclipse.cdt.debug.core.cdi.model.ICDITarget;
|
||||||
import org.eclipse.cdt.debug.mi.core.event.MISignalEvent;
|
import org.eclipse.cdt.debug.mi.core.event.MISignalEvent;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -13,7 +14,7 @@ import org.eclipse.cdt.debug.mi.core.event.MISignalEvent;
|
||||||
public class Signal extends CObject implements ICDISignal {
|
public class Signal extends CObject implements ICDISignal {
|
||||||
|
|
||||||
MISignalEvent event;
|
MISignalEvent event;
|
||||||
public Signal(CTarget target, MISignalEvent e) {
|
public Signal(ICDITarget target, MISignalEvent e) {
|
||||||
super(target);
|
super(target);
|
||||||
event = e;
|
event = e;
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,36 +5,28 @@
|
||||||
*/
|
*/
|
||||||
package org.eclipse.cdt.debug.mi.core.cdi.model;
|
package org.eclipse.cdt.debug.mi.core.cdi.model;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import org.eclipse.cdt.debug.core.cdi.CDIException;
|
import org.eclipse.cdt.debug.core.cdi.CDIException;
|
||||||
|
import org.eclipse.cdt.debug.core.cdi.ICDIArgumentObject;
|
||||||
import org.eclipse.cdt.debug.core.cdi.ICDILocation;
|
import org.eclipse.cdt.debug.core.cdi.ICDILocation;
|
||||||
|
import org.eclipse.cdt.debug.core.cdi.ICDIVariableObject;
|
||||||
import org.eclipse.cdt.debug.core.cdi.model.ICDIArgument;
|
import org.eclipse.cdt.debug.core.cdi.model.ICDIArgument;
|
||||||
import org.eclipse.cdt.debug.core.cdi.model.ICDIStackFrame;
|
import org.eclipse.cdt.debug.core.cdi.model.ICDIStackFrame;
|
||||||
|
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.ICDIVariable;
|
||||||
import org.eclipse.cdt.debug.mi.core.MIException;
|
import org.eclipse.cdt.debug.mi.core.cdi.Session;
|
||||||
import org.eclipse.cdt.debug.mi.core.MISession;
|
|
||||||
import org.eclipse.cdt.debug.mi.core.cdi.CSession;
|
|
||||||
import org.eclipse.cdt.debug.mi.core.cdi.Location;
|
import org.eclipse.cdt.debug.mi.core.cdi.Location;
|
||||||
import org.eclipse.cdt.debug.mi.core.cdi.VariableManager;
|
import org.eclipse.cdt.debug.mi.core.cdi.VariableManager;
|
||||||
import org.eclipse.cdt.debug.mi.core.command.CommandFactory;
|
|
||||||
import org.eclipse.cdt.debug.mi.core.command.MIStackListArguments;
|
|
||||||
import org.eclipse.cdt.debug.mi.core.command.MIStackListLocals;
|
|
||||||
import org.eclipse.cdt.debug.mi.core.output.MIArg;
|
|
||||||
import org.eclipse.cdt.debug.mi.core.output.MIFrame;
|
import org.eclipse.cdt.debug.mi.core.output.MIFrame;
|
||||||
import org.eclipse.cdt.debug.mi.core.output.MIStackListArgumentsInfo;
|
|
||||||
import org.eclipse.cdt.debug.mi.core.output.MIStackListLocalsInfo;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*/
|
*/
|
||||||
public class StackFrame extends CObject implements ICDIStackFrame {
|
public class StackFrame extends CObject implements ICDIStackFrame {
|
||||||
|
|
||||||
MIFrame frame;
|
MIFrame frame;
|
||||||
CThread cthread;
|
Thread cthread;
|
||||||
|
|
||||||
public StackFrame(CThread thread, MIFrame f) {
|
public StackFrame(Thread thread, MIFrame f) {
|
||||||
super(thread.getCTarget());
|
super(thread.getTarget());
|
||||||
cthread = thread;
|
cthread = thread;
|
||||||
frame = f;
|
frame = f;
|
||||||
}
|
}
|
||||||
|
@ -43,7 +35,10 @@ public class StackFrame extends CObject implements ICDIStackFrame {
|
||||||
return frame;
|
return frame;
|
||||||
}
|
}
|
||||||
|
|
||||||
public CThread getCThread() {
|
/**
|
||||||
|
* @see org.eclipse.cdt.debug.core.cdi.model.ICDIStackFrame#getThread()
|
||||||
|
*/
|
||||||
|
public ICDIThread getThread() {
|
||||||
return cthread;
|
return cthread;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -51,82 +46,28 @@ public class StackFrame extends CObject implements ICDIStackFrame {
|
||||||
* @see org.eclipse.cdt.debug.core.cdi.model.ICDIStackFrame#getArguments()
|
* @see org.eclipse.cdt.debug.core.cdi.model.ICDIStackFrame#getArguments()
|
||||||
*/
|
*/
|
||||||
public ICDIArgument[] getArguments() throws CDIException {
|
public ICDIArgument[] getArguments() throws CDIException {
|
||||||
List cdiList = new ArrayList();
|
Session session = (Session)getTarget().getSession();
|
||||||
if (frame != null) {
|
VariableManager mgr = (VariableManager)session.getVariableManager();
|
||||||
CSession session = getCTarget().getCSession();
|
ICDIArgumentObject[] argObjs = mgr.getArgumentObjects(this);
|
||||||
VariableManager mgr = (VariableManager)session.getVariableManager();
|
ICDIArgument[] args = new ICDIArgument[argObjs.length];
|
||||||
MISession mi = session.getMISession();
|
for (int i = 0; i < args.length; i++) {
|
||||||
CommandFactory factory = mi.getCommandFactory();
|
args[i] = mgr.createArgument(argObjs[i]);
|
||||||
int level = frame.getLevel();
|
|
||||||
MIStackListArguments listArgs =
|
|
||||||
factory.createMIStackListArguments(false, level, level);
|
|
||||||
try {
|
|
||||||
cthread.setCurrentStackFrame(this);
|
|
||||||
MIArg[] args = null;
|
|
||||||
mi.postCommand(listArgs);
|
|
||||||
MIStackListArgumentsInfo info =
|
|
||||||
listArgs.getMIStackListArgumentsInfo();
|
|
||||||
if (info == null) {
|
|
||||||
throw new CDIException("No answer");
|
|
||||||
}
|
|
||||||
MIFrame[] miFrames = info.getMIFrames();
|
|
||||||
if (miFrames != null && miFrames.length == 1) {
|
|
||||||
args = miFrames[0].getArgs();
|
|
||||||
}
|
|
||||||
if (args != null) {
|
|
||||||
for (int i = 0; i < args.length; i++) {
|
|
||||||
try {
|
|
||||||
cdiList.add(mgr.createArgument(this, args[i].getName()));
|
|
||||||
} catch (CDIException e) {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (MIException e) {
|
|
||||||
//throw new CDIException(e.getMessage());
|
|
||||||
//System.err.println(e);
|
|
||||||
} catch (CDIException e) {
|
|
||||||
//throw e;
|
|
||||||
//System.err.println(e);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return (ICDIArgument[])cdiList.toArray(new ICDIArgument[0]);
|
return args;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see org.eclipse.cdt.debug.core.cdi.model.ICDIStackFrame#getLocalVariables()
|
* @see org.eclipse.cdt.debug.core.cdi.model.ICDIStackFrame#getLocalVariables()
|
||||||
*/
|
*/
|
||||||
public ICDIVariable[] getLocalVariables() throws CDIException {
|
public ICDIVariable[] getLocalVariables() throws CDIException {
|
||||||
List cdiList = new ArrayList();
|
Session session = (Session)getTarget().getSession();
|
||||||
CSession session = getCTarget().getCSession();
|
|
||||||
VariableManager mgr = (VariableManager)session.getVariableManager();
|
VariableManager mgr = (VariableManager)session.getVariableManager();
|
||||||
MISession mi = session.getMISession();
|
ICDIVariableObject[] varObjs = mgr.getVariableObjects(this);
|
||||||
CommandFactory factory = mi.getCommandFactory();
|
ICDIVariable[] vars = new ICDIVariable[varObjs.length];
|
||||||
MIStackListLocals locals = factory.createMIStackListLocals(false);
|
for (int i = 0; i < vars.length; i++) {
|
||||||
try {
|
vars[i] = mgr.createVariable(varObjs[i]);
|
||||||
cthread.setCurrentStackFrame(this);
|
|
||||||
MIArg[] args = null;
|
|
||||||
mi.postCommand(locals);
|
|
||||||
MIStackListLocalsInfo info = locals.getMIStackListLocalsInfo();
|
|
||||||
if (info == null) {
|
|
||||||
throw new CDIException("No answer");
|
|
||||||
}
|
|
||||||
args = info.getLocals();
|
|
||||||
if (args != null) {
|
|
||||||
for (int i = 0; i < args.length; i++) {
|
|
||||||
try {
|
|
||||||
cdiList.add(mgr.createVariable(this, args[i].getName()));
|
|
||||||
} catch (CDIException e) {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (MIException e) {
|
|
||||||
//throw new CDIException(e.getMessage());
|
|
||||||
//System.err.println(e);
|
|
||||||
} catch (CDIException e) {
|
|
||||||
//throw e;
|
|
||||||
//System.err.println(e);
|
|
||||||
}
|
}
|
||||||
return (ICDIVariable[])cdiList.toArray(new ICDIVariable[0]);
|
return vars;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -156,7 +97,7 @@ public class StackFrame extends CObject implements ICDIStackFrame {
|
||||||
if (stackframe instanceof StackFrame) {
|
if (stackframe instanceof StackFrame) {
|
||||||
StackFrame stack = (StackFrame)stackframe;
|
StackFrame stack = (StackFrame)stackframe;
|
||||||
return cthread != null &&
|
return cthread != null &&
|
||||||
cthread.equals(stack.getCThread()) &&
|
cthread.equals(stack.getThread()) &&
|
||||||
frame != null &&
|
frame != null &&
|
||||||
frame.getLevel() == stack.getMIFrame().getLevel() &&
|
frame.getLevel() == stack.getMIFrame().getLevel() &&
|
||||||
frame.getFile().equals(stack.getMIFrame().getFile()) &&
|
frame.getFile().equals(stack.getMIFrame().getFile()) &&
|
||||||
|
|
|
@ -10,18 +10,18 @@ import java.util.List;
|
||||||
|
|
||||||
import org.eclipse.cdt.debug.core.cdi.CDIException;
|
import org.eclipse.cdt.debug.core.cdi.CDIException;
|
||||||
import org.eclipse.cdt.debug.core.cdi.ICDILocation;
|
import org.eclipse.cdt.debug.core.cdi.ICDILocation;
|
||||||
|
import org.eclipse.cdt.debug.core.cdi.ICDIRegisterManager;
|
||||||
import org.eclipse.cdt.debug.core.cdi.ICDIRegisterObject;
|
import org.eclipse.cdt.debug.core.cdi.ICDIRegisterObject;
|
||||||
import org.eclipse.cdt.debug.core.cdi.ICDISession;
|
import org.eclipse.cdt.debug.core.cdi.ICDISession;
|
||||||
import org.eclipse.cdt.debug.core.cdi.model.ICDIGlobalVariable;
|
|
||||||
import org.eclipse.cdt.debug.core.cdi.model.ICDIRegister;
|
import org.eclipse.cdt.debug.core.cdi.model.ICDIRegister;
|
||||||
import org.eclipse.cdt.debug.core.cdi.model.ICDISharedLibrary;
|
import org.eclipse.cdt.debug.core.cdi.model.ICDISharedLibrary;
|
||||||
import org.eclipse.cdt.debug.core.cdi.model.ICDITarget;
|
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.ICDIThread;
|
||||||
import org.eclipse.cdt.debug.mi.core.MIException;
|
import org.eclipse.cdt.debug.mi.core.MIException;
|
||||||
import org.eclipse.cdt.debug.mi.core.MISession;
|
import org.eclipse.cdt.debug.mi.core.MISession;
|
||||||
import org.eclipse.cdt.debug.mi.core.cdi.CSession;
|
|
||||||
import org.eclipse.cdt.debug.mi.core.cdi.MI2CDIException;
|
import org.eclipse.cdt.debug.mi.core.cdi.MI2CDIException;
|
||||||
import org.eclipse.cdt.debug.mi.core.cdi.RegisterManager;
|
import org.eclipse.cdt.debug.mi.core.cdi.RegisterManager;
|
||||||
|
import org.eclipse.cdt.debug.mi.core.cdi.Session;
|
||||||
import org.eclipse.cdt.debug.mi.core.command.CommandFactory;
|
import org.eclipse.cdt.debug.mi.core.command.CommandFactory;
|
||||||
import org.eclipse.cdt.debug.mi.core.command.MIDataEvaluateExpression;
|
import org.eclipse.cdt.debug.mi.core.command.MIDataEvaluateExpression;
|
||||||
import org.eclipse.cdt.debug.mi.core.command.MIExecContinue;
|
import org.eclipse.cdt.debug.mi.core.command.MIExecContinue;
|
||||||
|
@ -45,20 +45,20 @@ import org.eclipse.cdt.debug.mi.core.output.MIThreadSelectInfo;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*/
|
*/
|
||||||
public class CTarget implements ICDITarget {
|
public class Target implements ICDITarget {
|
||||||
|
|
||||||
CSession session;
|
Session session;
|
||||||
CThread[] noThreads = new CThread[0];
|
Thread[] noThreads = new Thread[0];
|
||||||
CThread[] currentThreads;
|
Thread[] currentThreads;
|
||||||
int currentThreadId;
|
int currentThreadId;
|
||||||
int lastExecutionToken;
|
int lastExecutionToken;
|
||||||
|
|
||||||
public CTarget(CSession s) {
|
public Target(Session s) {
|
||||||
session = s;
|
session = s;
|
||||||
currentThreads = noThreads;
|
currentThreads = noThreads;
|
||||||
}
|
}
|
||||||
|
|
||||||
public CSession getCSession() {
|
public Session getCSession() {
|
||||||
return session;
|
return session;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -84,19 +84,27 @@ public class CTarget implements ICDITarget {
|
||||||
* @see org.eclipse.cdt.debug.core.cdi.model.ICDITarget#setCurrentThread(ICDIThread)
|
* @see org.eclipse.cdt.debug.core.cdi.model.ICDITarget#setCurrentThread(ICDIThread)
|
||||||
*/
|
*/
|
||||||
public void setCurrentThread(ICDIThread cthread) throws CDIException {
|
public void setCurrentThread(ICDIThread cthread) throws CDIException {
|
||||||
setCurrentThread(cthread, true);
|
if (cthread instanceof Thread) {
|
||||||
|
setCurrentThread(cthread, true);
|
||||||
|
} else {
|
||||||
|
throw new CDIException("unknown thread");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setCurrentThread(ICDIThread cthread, boolean doUpdate) throws CDIException {
|
public void setCurrentThread(ICDIThread cthread, boolean doUpdate) throws CDIException {
|
||||||
if (cthread instanceof CThread) {
|
if (cthread instanceof Thread) {
|
||||||
setCurrentThread((CThread)cthread, doUpdate);
|
setCurrentThread((Thread)cthread, doUpdate);
|
||||||
|
} else {
|
||||||
|
throw new CDIException("unknown thread");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*/
|
*/
|
||||||
public void setCurrentThread(CThread cthread, boolean doUpdate) throws CDIException {
|
public void setCurrentThread(Thread cthread, boolean doUpdate) throws CDIException {
|
||||||
|
// set us as the current target.
|
||||||
session.setCurrentTarget(this);
|
session.setCurrentTarget(this);
|
||||||
|
|
||||||
int id = cthread.getId();
|
int id = cthread.getId();
|
||||||
// No need to set thread id 0, it is a dummy thread.
|
// No need to set thread id 0, it is a dummy thread.
|
||||||
if (id == 0) {
|
if (id == 0) {
|
||||||
|
@ -122,7 +130,7 @@ public class CTarget implements ICDITarget {
|
||||||
// some variables like Register. Send an update
|
// some variables like Register. Send an update
|
||||||
// To generate changeEvents.
|
// To generate changeEvents.
|
||||||
if (doUpdate) {
|
if (doUpdate) {
|
||||||
RegisterManager regMgr = session.getRegisterManager();
|
RegisterManager regMgr = (RegisterManager)session.getRegisterManager();
|
||||||
regMgr.update();
|
regMgr.update();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -140,75 +148,74 @@ public class CTarget implements ICDITarget {
|
||||||
* Called when stopping because of breakpoints etc ..
|
* Called when stopping because of breakpoints etc ..
|
||||||
*/
|
*/
|
||||||
public void updateState(int newThreadId) {
|
public void updateState(int newThreadId) {
|
||||||
CThread[] oldThreads = currentThreads;
|
Thread[] oldThreads = currentThreads;
|
||||||
|
|
||||||
// If we use "info threads" in getCThreads() this
|
// If we use "info threads" in getCThreads() this
|
||||||
// will be overwritten. However if we use -stack-list-threads
|
// will be overwritten. However if we use -stack-list-threads
|
||||||
// it does not provide to the current thread
|
// it does not provide to the current thread
|
||||||
currentThreadId = newThreadId;
|
currentThreadId = newThreadId;
|
||||||
// get the new Threads.
|
|
||||||
CThread[] newThreads = getCThreads();
|
|
||||||
|
|
||||||
currentThreads = newThreads;
|
// get the new Threads.
|
||||||
|
currentThreads = getCThreads();
|
||||||
|
|
||||||
// Fire CreatedEvent for new threads.
|
// Fire CreatedEvent for new threads.
|
||||||
if (newThreads != null && newThreads.length > 0) {
|
// Replace the new threads with the old thread object
|
||||||
List cList = new ArrayList(newThreads.length);
|
// User may have old on to the old Thread object.
|
||||||
for (int i = 0; i < newThreads.length; i++) {
|
List cList = new ArrayList(currentThreads.length);
|
||||||
boolean found = false;
|
for (int i = 0; i < currentThreads.length; i++) {
|
||||||
for (int j = 0; oldThreads != null && j < oldThreads.length; j++) {
|
boolean found = false;
|
||||||
if (newThreads[i].getId() == ((CThread)oldThreads[j]).getId()) {
|
for (int j = 0; j < oldThreads.length; j++) {
|
||||||
found = true;
|
if (currentThreads[i].getId() == oldThreads[j].getId()) {
|
||||||
break;
|
oldThreads[j].clearState();
|
||||||
}
|
currentThreads[i] = oldThreads[j];
|
||||||
}
|
found = true;
|
||||||
if (!found) {
|
break;
|
||||||
cList.add(new Integer(newThreads[i].getId()));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!cList.isEmpty()) {
|
if (!found) {
|
||||||
MIThreadCreatedEvent[] events = new MIThreadCreatedEvent[cList.size()];
|
cList.add(new Integer(currentThreads[i].getId()));
|
||||||
for (int j = 0; j < events.length; j++) {
|
|
||||||
int id = ((Integer)cList.get(j)).intValue();
|
|
||||||
events[j] = new MIThreadCreatedEvent(id);
|
|
||||||
}
|
|
||||||
MISession miSession = session.getMISession();
|
|
||||||
miSession.fireEvents(events);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (!cList.isEmpty()) {
|
||||||
|
MIThreadCreatedEvent[] events = new MIThreadCreatedEvent[cList.size()];
|
||||||
|
for (int j = 0; j < events.length; j++) {
|
||||||
|
int id = ((Integer)cList.get(j)).intValue();
|
||||||
|
events[j] = new MIThreadCreatedEvent(id);
|
||||||
|
}
|
||||||
|
MISession miSession = session.getMISession();
|
||||||
|
miSession.fireEvents(events);
|
||||||
|
}
|
||||||
|
|
||||||
// Fire destroyedEvent for old threads.
|
// Fire destroyedEvent for old threads.
|
||||||
if (oldThreads != null && oldThreads.length > 0) {
|
List dList = new ArrayList(oldThreads.length);
|
||||||
List dList = new ArrayList(oldThreads.length);
|
for (int i = 0; i < oldThreads.length; i++) {
|
||||||
for (int i = 0; i < oldThreads.length; i++) {
|
boolean found = false;
|
||||||
boolean found = false;
|
for (int j = 0; j < currentThreads.length; j++) {
|
||||||
for (int j = 0; newThreads != null && j < newThreads.length; j++) {
|
if (currentThreads[j].getId() == oldThreads[i].getId()) {
|
||||||
if (newThreads[j].getId() == ((CThread)oldThreads[i]).getId()) {
|
found = true;
|
||||||
found = true;
|
break;
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!found) {
|
|
||||||
dList.add(new Integer(oldThreads[i].getId()));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!dList.isEmpty()) {
|
if (!found) {
|
||||||
MIThreadExitEvent[] events = new MIThreadExitEvent[dList.size()];
|
dList.add(new Integer(oldThreads[i].getId()));
|
||||||
for (int j = 0; j < events.length; j++) {
|
|
||||||
int id = ((Integer)dList.get(j)).intValue();
|
|
||||||
events[j] = new MIThreadExitEvent(id);
|
|
||||||
}
|
|
||||||
MISession miSession = session.getMISession();
|
|
||||||
miSession.fireEvents(events);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (!dList.isEmpty()) {
|
||||||
|
MIThreadExitEvent[] events = new MIThreadExitEvent[dList.size()];
|
||||||
|
for (int j = 0; j < events.length; j++) {
|
||||||
|
int id = ((Integer)dList.get(j)).intValue();
|
||||||
|
events[j] = new MIThreadExitEvent(id);
|
||||||
|
}
|
||||||
|
MISession miSession = session.getMISession();
|
||||||
|
miSession.fireEvents(events);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Do the real work of call -thread-list-ids.
|
* Do the real work of call -thread-list-ids.
|
||||||
*/
|
*/
|
||||||
public CThread[] getCThreads() { //throws CDIException {
|
public Thread[] getCThreads() { //throws CDIException {
|
||||||
CThread[] cthreads = noThreads;
|
Thread[] cthreads = noThreads;
|
||||||
MISession mi = session.getMISession();
|
MISession mi = session.getMISession();
|
||||||
CommandFactory factory = mi.getCommandFactory();
|
CommandFactory factory = mi.getCommandFactory();
|
||||||
MIInfoThreads tids = factory.createMIInfoThreads();
|
MIInfoThreads tids = factory.createMIInfoThreads();
|
||||||
|
@ -227,14 +234,14 @@ public class CTarget implements ICDITarget {
|
||||||
ids = info.getThreadIds();
|
ids = info.getThreadIds();
|
||||||
}
|
}
|
||||||
if (ids != null && ids.length > 0) {
|
if (ids != null && ids.length > 0) {
|
||||||
cthreads = new CThread[ids.length];
|
cthreads = new Thread[ids.length];
|
||||||
// Ok that means it is a multiThreaded.
|
// Ok that means it is a multiThreaded.
|
||||||
for (int i = 0; i < ids.length; i++) {
|
for (int i = 0; i < ids.length; i++) {
|
||||||
cthreads[i] = new CThread(this, ids[i]);
|
cthreads[i] = new Thread(this, ids[i]);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Provide a dummy.
|
// Provide a dummy.
|
||||||
cthreads = new CThread[]{new CThread(this, 0)};
|
cthreads = new Thread[]{new Thread(this, 0)};
|
||||||
}
|
}
|
||||||
currentThreadId = info.getCurrentThread();
|
currentThreadId = info.getCurrentThread();
|
||||||
} catch (MIException e) {
|
} catch (MIException e) {
|
||||||
|
@ -250,7 +257,7 @@ public class CTarget implements ICDITarget {
|
||||||
public ICDIThread getCurrentThread() throws CDIException {
|
public ICDIThread getCurrentThread() throws CDIException {
|
||||||
ICDIThread[] threads = getThreads();
|
ICDIThread[] threads = getThreads();
|
||||||
for (int i = 0; i < threads.length; i++) {
|
for (int i = 0; i < threads.length; i++) {
|
||||||
CThread cthread = (CThread)threads[i];
|
Thread cthread = (Thread)threads[i];
|
||||||
if (cthread.getId() == currentThreadId) {
|
if (cthread.getId() == currentThreadId) {
|
||||||
return cthread;
|
return cthread;
|
||||||
}
|
}
|
||||||
|
@ -269,10 +276,10 @@ public class CTarget implements ICDITarget {
|
||||||
}
|
}
|
||||||
|
|
||||||
public ICDIThread getThread(int tid) {
|
public ICDIThread getThread(int tid) {
|
||||||
CThread th = null;
|
Thread th = null;
|
||||||
if (currentThreads != null) {
|
if (currentThreads != null) {
|
||||||
for (int i = 0; i < currentThreads.length; i++) {
|
for (int i = 0; i < currentThreads.length; i++) {
|
||||||
CThread cthread = (CThread)currentThreads[i];
|
Thread cthread = (Thread)currentThreads[i];
|
||||||
if (cthread.getId() == tid) {
|
if (cthread.getId() == tid) {
|
||||||
th = cthread;
|
th = cthread;
|
||||||
break;
|
break;
|
||||||
|
@ -561,18 +568,11 @@ public class CTarget implements ICDITarget {
|
||||||
return session.getMISession().getMIInferior().isRunning();
|
return session.getMISession().getMIInferior().isRunning();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @see org.eclipse.cdt.debug.core.cdi.model.ICDITarget#getGlobalVariables()
|
|
||||||
*/
|
|
||||||
public ICDIGlobalVariable[] getGlobalVariables() throws CDIException {
|
|
||||||
return new ICDIGlobalVariable[0];
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see org.eclipse.cdt.debug.core.cdi.model.ICDITarget#getRegisterObjects()
|
* @see org.eclipse.cdt.debug.core.cdi.model.ICDITarget#getRegisterObjects()
|
||||||
*/
|
*/
|
||||||
public ICDIRegisterObject[] getRegisterObjects() throws CDIException {
|
public ICDIRegisterObject[] getRegisterObjects() throws CDIException {
|
||||||
RegisterManager mgr = session.getRegisterManager();
|
ICDIRegisterManager mgr = session.getRegisterManager();
|
||||||
return mgr.getRegisterObjects();
|
return mgr.getRegisterObjects();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -581,7 +581,7 @@ public class CTarget implements ICDITarget {
|
||||||
*/
|
*/
|
||||||
public ICDIRegister[] getRegisters(ICDIRegisterObject[] regs) throws CDIException {
|
public ICDIRegister[] getRegisters(ICDIRegisterObject[] regs) throws CDIException {
|
||||||
ICDIRegister[] registers = null;
|
ICDIRegister[] registers = null;
|
||||||
RegisterManager mgr = session.getRegisterManager();
|
ICDIRegisterManager mgr = session.getRegisterManager();
|
||||||
registers = new ICDIRegister[regs.length];
|
registers = new ICDIRegister[regs.length];
|
||||||
for (int i = 0; i < registers.length; i++) {
|
for (int i = 0; i < registers.length; i++) {
|
||||||
registers[i] = mgr.createRegister(regs[i]);
|
registers[i] = mgr.createRegister(regs[i]);
|
|
@ -8,12 +8,13 @@ package org.eclipse.cdt.debug.mi.core.cdi.model;
|
||||||
import org.eclipse.cdt.debug.core.cdi.CDIException;
|
import org.eclipse.cdt.debug.core.cdi.CDIException;
|
||||||
import org.eclipse.cdt.debug.core.cdi.ICDILocation;
|
import org.eclipse.cdt.debug.core.cdi.ICDILocation;
|
||||||
import org.eclipse.cdt.debug.core.cdi.model.ICDIStackFrame;
|
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.ICDIThread;
|
||||||
import org.eclipse.cdt.debug.mi.core.MIException;
|
import org.eclipse.cdt.debug.mi.core.MIException;
|
||||||
import org.eclipse.cdt.debug.mi.core.MISession;
|
import org.eclipse.cdt.debug.mi.core.MISession;
|
||||||
import org.eclipse.cdt.debug.mi.core.cdi.CSession;
|
|
||||||
import org.eclipse.cdt.debug.mi.core.cdi.MI2CDIException;
|
import org.eclipse.cdt.debug.mi.core.cdi.MI2CDIException;
|
||||||
import org.eclipse.cdt.debug.mi.core.cdi.RegisterManager;
|
import org.eclipse.cdt.debug.mi.core.cdi.RegisterManager;
|
||||||
|
import org.eclipse.cdt.debug.mi.core.cdi.Session;
|
||||||
import org.eclipse.cdt.debug.mi.core.command.CommandFactory;
|
import org.eclipse.cdt.debug.mi.core.command.CommandFactory;
|
||||||
import org.eclipse.cdt.debug.mi.core.command.MIStackInfoDepth;
|
import org.eclipse.cdt.debug.mi.core.command.MIStackInfoDepth;
|
||||||
import org.eclipse.cdt.debug.mi.core.command.MIStackListFrames;
|
import org.eclipse.cdt.debug.mi.core.command.MIStackListFrames;
|
||||||
|
@ -25,13 +26,14 @@ import org.eclipse.cdt.debug.mi.core.output.MIStackListFramesInfo;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*/
|
*/
|
||||||
public class CThread extends CObject implements ICDIThread {
|
public class Thread extends CObject implements ICDIThread {
|
||||||
|
|
||||||
int id;
|
|
||||||
static StackFrame[] noStack = new StackFrame[0];
|
static StackFrame[] noStack = new StackFrame[0];
|
||||||
|
int id;
|
||||||
StackFrame currentFrame;
|
StackFrame currentFrame;
|
||||||
|
int stackdepth = 0;
|
||||||
|
|
||||||
public CThread(CTarget target, int threadId) {
|
public Thread(ICDITarget target, int threadId) {
|
||||||
super(target);
|
super(target);
|
||||||
id = threadId;
|
id = threadId;
|
||||||
}
|
}
|
||||||
|
@ -40,11 +42,16 @@ public class CThread extends CObject implements ICDIThread {
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void clearState() {
|
||||||
|
stackdepth = 0;
|
||||||
|
currentFrame = null;
|
||||||
|
}
|
||||||
|
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return Integer.toString(id);
|
return Integer.toString(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
public StackFrame getCurrentStackFrame() throws CDIException {
|
public ICDIStackFrame getCurrentStackFrame() throws CDIException {
|
||||||
if (currentFrame == null) {
|
if (currentFrame == null) {
|
||||||
ICDIStackFrame[] frames = getStackFrames(0, 0);
|
ICDIStackFrame[] frames = getStackFrames(0, 0);
|
||||||
if (frames.length > 0) {
|
if (frames.length > 0) {
|
||||||
|
@ -59,94 +66,113 @@ public class CThread extends CObject implements ICDIThread {
|
||||||
*/
|
*/
|
||||||
public ICDIStackFrame[] getStackFrames() throws CDIException {
|
public ICDIStackFrame[] getStackFrames() throws CDIException {
|
||||||
|
|
||||||
StackFrame[] stack = noStack;
|
StackFrame[] stacks = noStack;
|
||||||
CSession session = getCTarget().getCSession();
|
Session session = (Session)getTarget().getSession();
|
||||||
|
Target currentTarget = (Target)session.getCurrentTarget();
|
||||||
MISession mi = session.getMISession();
|
ICDIThread currentThread = currentTarget.getCurrentThread();
|
||||||
CommandFactory factory = mi.getCommandFactory();
|
currentTarget.setCurrentThread(this, false);
|
||||||
MIStackListFrames frames = factory.createMIStackListFrames();
|
|
||||||
try {
|
try {
|
||||||
ICDIThread oldThread = getCTarget().getCurrentThread();
|
MISession mi = session.getMISession();
|
||||||
getCTarget().setCurrentThread(this, false);
|
CommandFactory factory = mi.getCommandFactory();
|
||||||
|
MIStackListFrames frames = factory.createMIStackListFrames();
|
||||||
mi.postCommand(frames);
|
mi.postCommand(frames);
|
||||||
MIStackListFramesInfo info = frames.getMIStackListFramesInfo();
|
MIStackListFramesInfo info = frames.getMIStackListFramesInfo();
|
||||||
if (info == null) {
|
if (info == null) {
|
||||||
throw new CDIException("No answer");
|
throw new CDIException("No answer");
|
||||||
}
|
}
|
||||||
MIFrame[] miFrames = info.getMIFrames();
|
MIFrame[] miFrames = info.getMIFrames();
|
||||||
stack = new StackFrame[miFrames.length];
|
stacks = new StackFrame[miFrames.length];
|
||||||
for (int i = 0; i < stack.length; i++) {
|
for (int i = 0; i < stacks.length; i++) {
|
||||||
stack[i] = new StackFrame(this, miFrames[i]);
|
stacks[i] = new StackFrame(this, miFrames[i]);
|
||||||
}
|
}
|
||||||
getCTarget().setCurrentThread(oldThread, false);
|
|
||||||
return stack;
|
|
||||||
} catch (MIException e) {
|
} catch (MIException e) {
|
||||||
//throw new CDIException(e.getMessage());
|
//throw new CDIException(e.getMessage());
|
||||||
//System.out.println(e);
|
//System.out.println(e);
|
||||||
} catch (CDIException e) {
|
} catch (CDIException e) {
|
||||||
//throw e;
|
//throw e;
|
||||||
//System.out.println(e);
|
//System.out.println(e);
|
||||||
|
} finally {
|
||||||
|
currentTarget.setCurrentThread(currentThread, false);
|
||||||
}
|
}
|
||||||
return stack;
|
if (currentFrame == null) {
|
||||||
|
for (int i = 0; i < stacks.length; i++) {
|
||||||
|
if (stacks[i].getLevel() == 0) {
|
||||||
|
currentFrame = stacks[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return stacks;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see org.eclipse.cdt.debug.core.cdi.model.ICDIThread#getStackFrames()
|
* @see org.eclipse.cdt.debug.core.cdi.model.ICDIThread#getStackFrames()
|
||||||
*/
|
*/
|
||||||
public int getStackFrameCount() throws CDIException {
|
public int getStackFrameCount() throws CDIException {
|
||||||
CSession session = getCTarget().getCSession();
|
if (stackdepth == 0) {
|
||||||
MISession mi = session.getMISession();
|
Session session = (Session)(getTarget().getSession());
|
||||||
CommandFactory factory = mi.getCommandFactory();
|
Target currentTarget = (Target)session.getCurrentTarget();
|
||||||
MIStackInfoDepth depth = factory.createMIStackInfoDepth();
|
ICDIThread currentThread = currentTarget.getCurrentThread();
|
||||||
try {
|
currentTarget.setCurrentThread(this, false);
|
||||||
ICDIThread oldThread = getCTarget().getCurrentThread();
|
try {
|
||||||
getCTarget().setCurrentThread(this, false);
|
MISession mi = session.getMISession();
|
||||||
mi.postCommand(depth);
|
CommandFactory factory = mi.getCommandFactory();
|
||||||
MIStackInfoDepthInfo info = depth.getMIStackInfoDepthInfo();
|
MIStackInfoDepth depth = factory.createMIStackInfoDepth();
|
||||||
if (info == null) {
|
mi.postCommand(depth);
|
||||||
throw new CDIException("No answer");
|
MIStackInfoDepthInfo info = depth.getMIStackInfoDepthInfo();
|
||||||
|
if (info == null) {
|
||||||
|
throw new CDIException("No answer");
|
||||||
|
}
|
||||||
|
stackdepth = info.getDepth();
|
||||||
|
} catch (MIException e) {
|
||||||
|
throw new MI2CDIException(e);
|
||||||
|
//System.out.println(e);
|
||||||
|
} finally {
|
||||||
|
currentTarget.setCurrentThread(currentThread, false);
|
||||||
}
|
}
|
||||||
getCTarget().setCurrentThread(oldThread, false);
|
|
||||||
return info.getDepth();
|
|
||||||
} catch (MIException e) {
|
|
||||||
throw new MI2CDIException(e);
|
|
||||||
//System.out.println(e);
|
|
||||||
}
|
}
|
||||||
|
return stackdepth;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see org.eclipse.cdt.debug.core.cdi.model.ICDIThread#getStackFrames()
|
* @see org.eclipse.cdt.debug.core.cdi.model.ICDIThread#getStackFrames()
|
||||||
*/
|
*/
|
||||||
public ICDIStackFrame[] getStackFrames(int low, int high) throws CDIException {
|
public ICDIStackFrame[] getStackFrames(int low, int high) throws CDIException {
|
||||||
StackFrame[] stack = noStack;
|
StackFrame[] stacks = noStack;
|
||||||
CSession session = getCTarget().getCSession();
|
Session session = (Session)getTarget().getSession();
|
||||||
|
Target currentTarget = (Target)session.getCurrentTarget();
|
||||||
MISession mi = session.getMISession();
|
ICDIThread currentThread = currentTarget.getCurrentThread();
|
||||||
CommandFactory factory = mi.getCommandFactory();
|
currentTarget.setCurrentThread(this, false);
|
||||||
MIStackListFrames frames = factory.createMIStackListFrames(low, high);
|
|
||||||
try {
|
try {
|
||||||
ICDIThread oldThread = getCTarget().getCurrentThread();
|
MISession mi = session.getMISession();
|
||||||
getCTarget().setCurrentThread(this, false);
|
CommandFactory factory = mi.getCommandFactory();
|
||||||
|
MIStackListFrames frames = factory.createMIStackListFrames(low, high);
|
||||||
mi.postCommand(frames);
|
mi.postCommand(frames);
|
||||||
MIStackListFramesInfo info = frames.getMIStackListFramesInfo();
|
MIStackListFramesInfo info = frames.getMIStackListFramesInfo();
|
||||||
if (info == null) {
|
if (info == null) {
|
||||||
throw new CDIException("No answer");
|
throw new CDIException("No answer");
|
||||||
}
|
}
|
||||||
MIFrame[] miFrames = info.getMIFrames();
|
MIFrame[] miFrames = info.getMIFrames();
|
||||||
stack = new StackFrame[miFrames.length];
|
stacks = new StackFrame[miFrames.length];
|
||||||
for (int i = 0; i < stack.length; i++) {
|
for (int i = 0; i < stacks.length; i++) {
|
||||||
stack[i] = new StackFrame(this, miFrames[i]);
|
stacks[i] = new StackFrame(this, miFrames[i]);
|
||||||
}
|
}
|
||||||
getCTarget().setCurrentThread(oldThread, false);
|
|
||||||
return stack;
|
|
||||||
} catch (MIException e) {
|
} catch (MIException e) {
|
||||||
//throw new CDIException(e.getMessage());
|
//throw new CDIException(e.getMessage());
|
||||||
//System.out.println(e);
|
//System.out.println(e);
|
||||||
} catch (CDIException e) {
|
} catch (CDIException e) {
|
||||||
//throw e;
|
//throw e;
|
||||||
//System.out.println(e);
|
//System.out.println(e);
|
||||||
|
} finally {
|
||||||
|
currentTarget.setCurrentThread(currentThread, false);
|
||||||
}
|
}
|
||||||
return stack;
|
if (currentFrame == null) {
|
||||||
|
for (int i = 0; i < stacks.length; i++) {
|
||||||
|
if (stacks[i].getLevel() == 0) {
|
||||||
|
currentFrame = stacks[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return stacks;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -155,42 +181,48 @@ public class CThread extends CObject implements ICDIThread {
|
||||||
public void setCurrentStackFrame(ICDIStackFrame stackframe) throws CDIException {
|
public void setCurrentStackFrame(ICDIStackFrame stackframe) throws CDIException {
|
||||||
if (stackframe instanceof StackFrame) {
|
if (stackframe instanceof StackFrame) {
|
||||||
setCurrentStackFrame((StackFrame)stackframe);
|
setCurrentStackFrame((StackFrame)stackframe);
|
||||||
|
} else {
|
||||||
|
throw new CDIException("Unknown stackframe");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setCurrentStackFrame(StackFrame stackframe) throws CDIException {
|
public void setCurrentStackFrame(StackFrame stackframe) throws CDIException {
|
||||||
CSession session = getCTarget().getCSession();
|
setCurrentStackFrame(stackframe, true);
|
||||||
MISession mi = session.getMISession();
|
}
|
||||||
CommandFactory factory = mi.getCommandFactory();
|
|
||||||
|
public void setCurrentStackFrame(StackFrame stackframe, boolean doUpdate) throws CDIException {
|
||||||
int frameNum = 0;
|
int frameNum = 0;
|
||||||
if (stackframe != null) {
|
if (stackframe != null) {
|
||||||
frameNum = stackframe.getLevel();
|
frameNum = stackframe.getLevel();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check to see if we are already at this level
|
// Check to see if we are already at this level
|
||||||
StackFrame current = getCurrentStackFrame();
|
ICDIStackFrame current = getCurrentStackFrame();
|
||||||
if (current != null && current.getLevel() == frameNum) {
|
if (current != null && current.getLevel() == frameNum) {
|
||||||
// noop
|
// noop
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
MIStackSelectFrame frame = factory.createMIStackSelectFrame(frameNum);
|
|
||||||
try {
|
try {
|
||||||
|
Session session = (Session)getTarget().getSession();
|
||||||
|
MISession mi = session.getMISession();
|
||||||
|
CommandFactory factory = mi.getCommandFactory();
|
||||||
|
MIStackSelectFrame frame = factory.createMIStackSelectFrame(frameNum);
|
||||||
// Set ourself as the current thread first.
|
// Set ourself as the current thread first.
|
||||||
getCTarget().setCurrentThread(this);
|
((Target)getTarget()).setCurrentThread(this, doUpdate);
|
||||||
mi.postCommand(frame);
|
mi.postCommand(frame);
|
||||||
MIInfo info = frame.getMIInfo();
|
MIInfo info = frame.getMIInfo();
|
||||||
if (info == null) {
|
if (info == null) {
|
||||||
throw new CDIException("No answer");
|
throw new CDIException("No answer");
|
||||||
}
|
}
|
||||||
currentFrame = stackframe;
|
currentFrame = stackframe;
|
||||||
|
// Resetting stackframe may change the value of
|
||||||
// Resetting threads may change the value of
|
// some variables like registers. Send an update
|
||||||
// some variables like Register. Send an update
|
|
||||||
// To generate changeEvents.
|
// To generate changeEvents.
|
||||||
RegisterManager regMgr = session.getRegisterManager();
|
if (doUpdate) {
|
||||||
regMgr.update();
|
RegisterManager regMgr = (RegisterManager)session.getRegisterManager();
|
||||||
|
regMgr.update();
|
||||||
|
}
|
||||||
} catch (MIException e) {
|
} catch (MIException e) {
|
||||||
throw new MI2CDIException(e);
|
throw new MI2CDIException(e);
|
||||||
}
|
}
|
||||||
|
@ -207,7 +239,7 @@ public class CThread extends CObject implements ICDIThread {
|
||||||
* @see org.eclipse.cdt.debug.core.cdi.model.ICDIThread#finish()
|
* @see org.eclipse.cdt.debug.core.cdi.model.ICDIThread#finish()
|
||||||
*/
|
*/
|
||||||
public void finish() throws CDIException {
|
public void finish() throws CDIException {
|
||||||
getCTarget().setCurrentThread(this);
|
getTarget().setCurrentThread(this);
|
||||||
getTarget().finish();
|
getTarget().finish();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -215,6 +247,7 @@ public class CThread extends CObject implements ICDIThread {
|
||||||
* @see org.eclipse.cdt.debug.core.cdi.model.ICDIThread#resume()
|
* @see org.eclipse.cdt.debug.core.cdi.model.ICDIThread#resume()
|
||||||
*/
|
*/
|
||||||
public void resume() throws CDIException {
|
public void resume() throws CDIException {
|
||||||
|
getTarget().setCurrentThread(this);
|
||||||
getTarget().resume();
|
getTarget().resume();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -222,7 +255,7 @@ public class CThread extends CObject implements ICDIThread {
|
||||||
* @see org.eclipse.cdt.debug.core.cdi.model.ICDIThread#stepInto()
|
* @see org.eclipse.cdt.debug.core.cdi.model.ICDIThread#stepInto()
|
||||||
*/
|
*/
|
||||||
public void stepInto() throws CDIException {
|
public void stepInto() throws CDIException {
|
||||||
getCTarget().setCurrentThread(this);
|
getTarget().setCurrentThread(this);
|
||||||
getTarget().stepInto();
|
getTarget().stepInto();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -230,7 +263,7 @@ public class CThread extends CObject implements ICDIThread {
|
||||||
* @see org.eclipse.cdt.debug.core.cdi.model.ICDIThread#stepIntoInstruction()
|
* @see org.eclipse.cdt.debug.core.cdi.model.ICDIThread#stepIntoInstruction()
|
||||||
*/
|
*/
|
||||||
public void stepIntoInstruction() throws CDIException {
|
public void stepIntoInstruction() throws CDIException {
|
||||||
getCTarget().setCurrentThread(this);
|
getTarget().setCurrentThread(this);
|
||||||
getTarget().stepIntoInstruction();
|
getTarget().stepIntoInstruction();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -238,7 +271,7 @@ public class CThread extends CObject implements ICDIThread {
|
||||||
* @see org.eclipse.cdt.debug.core.cdi.model.ICDIThread#stepOver()
|
* @see org.eclipse.cdt.debug.core.cdi.model.ICDIThread#stepOver()
|
||||||
*/
|
*/
|
||||||
public void stepOver() throws CDIException {
|
public void stepOver() throws CDIException {
|
||||||
getCTarget().setCurrentThread(this);
|
getTarget().setCurrentThread(this);
|
||||||
getTarget().stepOver();
|
getTarget().stepOver();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -246,7 +279,7 @@ public class CThread extends CObject implements ICDIThread {
|
||||||
* @see org.eclipse.cdt.debug.core.cdi.model.ICDIThread#stepOverInstruction()
|
* @see org.eclipse.cdt.debug.core.cdi.model.ICDIThread#stepOverInstruction()
|
||||||
*/
|
*/
|
||||||
public void stepOverInstruction() throws CDIException {
|
public void stepOverInstruction() throws CDIException {
|
||||||
getCTarget().setCurrentThread(this);
|
getTarget().setCurrentThread(this);
|
||||||
getTarget().stepOverInstruction();
|
getTarget().stepOverInstruction();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -254,7 +287,7 @@ public class CThread extends CObject implements ICDIThread {
|
||||||
* @see org.eclipse.cdt.debug.core.cdi.model.ICDIThread#stepReturn()
|
* @see org.eclipse.cdt.debug.core.cdi.model.ICDIThread#stepReturn()
|
||||||
*/
|
*/
|
||||||
public void stepReturn() throws CDIException {
|
public void stepReturn() throws CDIException {
|
||||||
getCTarget().setCurrentThread(this);
|
getTarget().setCurrentThread(this);
|
||||||
getTarget().stepReturn();
|
getTarget().stepReturn();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -262,7 +295,7 @@ public class CThread extends CObject implements ICDIThread {
|
||||||
* @see org.eclipse.cdt.debug.core.cdi.model.ICDIThread#runUntil(ICDILocation)
|
* @see org.eclipse.cdt.debug.core.cdi.model.ICDIThread#runUntil(ICDILocation)
|
||||||
*/
|
*/
|
||||||
public void runUntil(ICDILocation location) throws CDIException {
|
public void runUntil(ICDILocation location) throws CDIException {
|
||||||
getCTarget().setCurrentThread(this);
|
getTarget().setCurrentThread(this);
|
||||||
getTarget().runUntil(location);
|
getTarget().runUntil(location);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -270,7 +303,7 @@ public class CThread extends CObject implements ICDIThread {
|
||||||
* @see org.eclipse.cdt.debug.core.cdi.model.ICDIThread#suspend()
|
* @see org.eclipse.cdt.debug.core.cdi.model.ICDIThread#suspend()
|
||||||
*/
|
*/
|
||||||
public void suspend() throws CDIException {
|
public void suspend() throws CDIException {
|
||||||
getCTarget().setCurrentThread(this);
|
getTarget().setCurrentThread(this);
|
||||||
getTarget().suspend();
|
getTarget().suspend();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -278,8 +311,8 @@ public class CThread extends CObject implements ICDIThread {
|
||||||
* @see org.eclipse.cdt.debug.core.cdi.model.ICDIThread#equals(ICDIThread)
|
* @see org.eclipse.cdt.debug.core.cdi.model.ICDIThread#equals(ICDIThread)
|
||||||
*/
|
*/
|
||||||
public boolean equals(ICDIThread thread) {
|
public boolean equals(ICDIThread thread) {
|
||||||
if (thread instanceof CThread) {
|
if (thread instanceof Thread) {
|
||||||
CThread cthread = (CThread) thread;
|
Thread cthread = (Thread) thread;
|
||||||
return id == cthread.getId();
|
return id == cthread.getId();
|
||||||
}
|
}
|
||||||
return super.equals(thread);
|
return super.equals(thread);
|
|
@ -10,9 +10,10 @@ import org.eclipse.cdt.debug.core.cdi.model.ICDIValue;
|
||||||
import org.eclipse.cdt.debug.core.cdi.model.ICDIVariable;
|
import org.eclipse.cdt.debug.core.cdi.model.ICDIVariable;
|
||||||
import org.eclipse.cdt.debug.mi.core.MIException;
|
import org.eclipse.cdt.debug.mi.core.MIException;
|
||||||
import org.eclipse.cdt.debug.mi.core.MISession;
|
import org.eclipse.cdt.debug.mi.core.MISession;
|
||||||
import org.eclipse.cdt.debug.mi.core.cdi.CSession;
|
|
||||||
import org.eclipse.cdt.debug.mi.core.cdi.MI2CDIException;
|
import org.eclipse.cdt.debug.mi.core.cdi.MI2CDIException;
|
||||||
|
import org.eclipse.cdt.debug.mi.core.cdi.Session;
|
||||||
import org.eclipse.cdt.debug.mi.core.cdi.VariableManager;
|
import org.eclipse.cdt.debug.mi.core.cdi.VariableManager;
|
||||||
|
import org.eclipse.cdt.debug.mi.core.cdi.VariableObject;
|
||||||
import org.eclipse.cdt.debug.mi.core.command.CommandFactory;
|
import org.eclipse.cdt.debug.mi.core.command.CommandFactory;
|
||||||
import org.eclipse.cdt.debug.mi.core.command.MIVarEvaluateExpression;
|
import org.eclipse.cdt.debug.mi.core.command.MIVarEvaluateExpression;
|
||||||
import org.eclipse.cdt.debug.mi.core.command.MIVarListChildren;
|
import org.eclipse.cdt.debug.mi.core.command.MIVarListChildren;
|
||||||
|
@ -27,7 +28,7 @@ public class Value extends CObject implements ICDIValue {
|
||||||
Variable variable;
|
Variable variable;
|
||||||
|
|
||||||
public Value(Variable v) {
|
public Value(Variable v) {
|
||||||
super(v.getCTarget());
|
super(v.getTarget());
|
||||||
variable = v;
|
variable = v;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -43,7 +44,7 @@ public class Value extends CObject implements ICDIValue {
|
||||||
*/
|
*/
|
||||||
public String getValueString() throws CDIException {
|
public String getValueString() throws CDIException {
|
||||||
String result = "";
|
String result = "";
|
||||||
MISession mi = getCTarget().getCSession().getMISession();
|
MISession mi = ((Session)(getTarget().getSession())).getMISession();
|
||||||
CommandFactory factory = mi.getCommandFactory();
|
CommandFactory factory = mi.getCommandFactory();
|
||||||
MIVarEvaluateExpression var =
|
MIVarEvaluateExpression var =
|
||||||
factory.createMIVarEvaluateExpression(variable.getMIVar().getVarName());
|
factory.createMIVarEvaluateExpression(variable.getMIVar().getVarName());
|
||||||
|
@ -96,7 +97,7 @@ public class Value extends CObject implements ICDIValue {
|
||||||
*/
|
*/
|
||||||
public ICDIVariable[] getVariables() throws CDIException {
|
public ICDIVariable[] getVariables() throws CDIException {
|
||||||
Variable[] variables = null;
|
Variable[] variables = null;
|
||||||
CSession session = getCTarget().getCSession();
|
Session session = (Session)(getTarget().getSession());
|
||||||
MISession mi = session.getMISession();
|
MISession mi = session.getMISession();
|
||||||
VariableManager mgr = (VariableManager)session.getVariableManager();
|
VariableManager mgr = (VariableManager)session.getVariableManager();
|
||||||
CommandFactory factory = mi.getCommandFactory();
|
CommandFactory factory = mi.getCommandFactory();
|
||||||
|
@ -111,8 +112,10 @@ public class Value extends CObject implements ICDIValue {
|
||||||
MIVar[] vars = info.getMIVars();
|
MIVar[] vars = info.getMIVars();
|
||||||
variables = new Variable[vars.length];
|
variables = new Variable[vars.length];
|
||||||
for (int i = 0; i < vars.length; i++) {
|
for (int i = 0; i < vars.length; i++) {
|
||||||
variables[i] = mgr.createVariable(variable.getStackFrame(),
|
VariableObject varObj = new VariableObject(vars[i].getExp(),
|
||||||
vars[i].getExp(), vars[i]);
|
(StackFrame)variable.getStackFrame(), variable.getVariableObject().getPosition(),
|
||||||
|
variable.getVariableObject().getStackDepth());
|
||||||
|
variables[i] = mgr.createVariable(varObj, vars[i]);
|
||||||
|
|
||||||
}
|
}
|
||||||
} catch (MIException e) {
|
} catch (MIException e) {
|
||||||
|
|
|
@ -6,12 +6,15 @@
|
||||||
package org.eclipse.cdt.debug.mi.core.cdi.model;
|
package org.eclipse.cdt.debug.mi.core.cdi.model;
|
||||||
|
|
||||||
import org.eclipse.cdt.debug.core.cdi.CDIException;
|
import org.eclipse.cdt.debug.core.cdi.CDIException;
|
||||||
|
import org.eclipse.cdt.debug.core.cdi.model.ICDIStackFrame;
|
||||||
import org.eclipse.cdt.debug.core.cdi.model.ICDIValue;
|
import org.eclipse.cdt.debug.core.cdi.model.ICDIValue;
|
||||||
import org.eclipse.cdt.debug.core.cdi.model.ICDIVariable;
|
import org.eclipse.cdt.debug.core.cdi.model.ICDIVariable;
|
||||||
import org.eclipse.cdt.debug.mi.core.MIException;
|
import org.eclipse.cdt.debug.mi.core.MIException;
|
||||||
import org.eclipse.cdt.debug.mi.core.MISession;
|
import org.eclipse.cdt.debug.mi.core.MISession;
|
||||||
import org.eclipse.cdt.debug.mi.core.cdi.Format;
|
import org.eclipse.cdt.debug.mi.core.cdi.Format;
|
||||||
import org.eclipse.cdt.debug.mi.core.cdi.MI2CDIException;
|
import org.eclipse.cdt.debug.mi.core.cdi.MI2CDIException;
|
||||||
|
import org.eclipse.cdt.debug.mi.core.cdi.Session;
|
||||||
|
import org.eclipse.cdt.debug.mi.core.cdi.VariableObject;
|
||||||
import org.eclipse.cdt.debug.mi.core.command.CommandFactory;
|
import org.eclipse.cdt.debug.mi.core.command.CommandFactory;
|
||||||
import org.eclipse.cdt.debug.mi.core.command.MIVarAssign;
|
import org.eclipse.cdt.debug.mi.core.command.MIVarAssign;
|
||||||
import org.eclipse.cdt.debug.mi.core.command.MIVarSetFormat;
|
import org.eclipse.cdt.debug.mi.core.command.MIVarSetFormat;
|
||||||
|
@ -26,30 +29,28 @@ import org.eclipse.cdt.debug.mi.core.output.MIVarShowAttributesInfo;
|
||||||
public class Variable extends CObject implements ICDIVariable {
|
public class Variable extends CObject implements ICDIVariable {
|
||||||
|
|
||||||
MIVar miVar;
|
MIVar miVar;
|
||||||
String name;
|
|
||||||
Value value;
|
Value value;
|
||||||
StackFrame stack;
|
VariableObject varObj;
|
||||||
|
|
||||||
public Variable(StackFrame stackframe, String n, MIVar v) {
|
public Variable(VariableObject obj, MIVar v) {
|
||||||
super(stackframe.getCTarget());
|
super(obj.getStackFrame().getTarget());
|
||||||
stack = stackframe;
|
|
||||||
name = n;
|
|
||||||
miVar = v;
|
miVar = v;
|
||||||
}
|
varObj = obj;
|
||||||
|
|
||||||
StackFrame getStackFrame() {
|
|
||||||
return stack;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public MIVar getMIVar() {
|
public MIVar getMIVar() {
|
||||||
return miVar;
|
return miVar;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public VariableObject getVariableObject() {
|
||||||
|
return varObj;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see org.eclipse.cdt.debug.core.cdi.model.ICDIVariable#getName()
|
* @see org.eclipse.cdt.debug.core.cdi.model.ICDIVariable#getName()
|
||||||
*/
|
*/
|
||||||
public String getName() throws CDIException {
|
public String getName() throws CDIException {
|
||||||
return name;
|
return varObj.getName();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -80,7 +81,7 @@ public class Variable extends CObject implements ICDIVariable {
|
||||||
* @see org.eclipse.cdt.debug.core.cdi.model.ICDIVariable#setValue(String)
|
* @see org.eclipse.cdt.debug.core.cdi.model.ICDIVariable#setValue(String)
|
||||||
*/
|
*/
|
||||||
public void setValue(String expression) throws CDIException {
|
public void setValue(String expression) throws CDIException {
|
||||||
MISession mi = getCTarget().getCSession().getMISession();
|
MISession mi = ((Session)(getTarget().getSession())).getMISession();
|
||||||
CommandFactory factory = mi.getCommandFactory();
|
CommandFactory factory = mi.getCommandFactory();
|
||||||
MIVarAssign var = factory.createMIVarAssign(miVar.getVarName(), expression);
|
MIVarAssign var = factory.createMIVarAssign(miVar.getVarName(), expression);
|
||||||
try {
|
try {
|
||||||
|
@ -102,7 +103,7 @@ public class Variable extends CObject implements ICDIVariable {
|
||||||
* @see org.eclipse.cdt.debug.core.cdi.model.ICDIVariable#isEditable()
|
* @see org.eclipse.cdt.debug.core.cdi.model.ICDIVariable#isEditable()
|
||||||
*/
|
*/
|
||||||
public boolean isEditable() throws CDIException {
|
public boolean isEditable() throws CDIException {
|
||||||
MISession mi = getCTarget().getCSession().getMISession();
|
MISession mi = ((Session)(getTarget().getSession())).getMISession();
|
||||||
CommandFactory factory = mi.getCommandFactory();
|
CommandFactory factory = mi.getCommandFactory();
|
||||||
MIVarShowAttributes var = factory.createMIVarShowAttributes(miVar.getVarName());
|
MIVarShowAttributes var = factory.createMIVarShowAttributes(miVar.getVarName());
|
||||||
try {
|
try {
|
||||||
|
@ -122,7 +123,7 @@ public class Variable extends CObject implements ICDIVariable {
|
||||||
*/
|
*/
|
||||||
public void setFormat(int format) throws CDIException {
|
public void setFormat(int format) throws CDIException {
|
||||||
int fmt = Format.toMIFormat(format);
|
int fmt = Format.toMIFormat(format);
|
||||||
MISession mi = getCTarget().getCSession().getMISession();
|
MISession mi = ((Session)(getTarget().getSession())).getMISession();
|
||||||
CommandFactory factory = mi.getCommandFactory();
|
CommandFactory factory = mi.getCommandFactory();
|
||||||
MIVarSetFormat var = factory.createMIVarSetFormat(miVar.getVarName(), fmt);
|
MIVarSetFormat var = factory.createMIVarSetFormat(miVar.getVarName(), fmt);
|
||||||
try {
|
try {
|
||||||
|
@ -146,4 +147,12 @@ public class Variable extends CObject implements ICDIVariable {
|
||||||
}
|
}
|
||||||
return super.equals(var);
|
return super.equals(var);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see org.eclipse.cdt.debug.core.cdi.model.ICDIVariable#getStackFrame()
|
||||||
|
*/
|
||||||
|
public ICDIStackFrame getStackFrame() throws CDIException {
|
||||||
|
return varObj.getStackFrame();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue