mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-23 17:05:26 +02:00
Framework to deferred breakpoint
This commit is contained in:
parent
931d4076e1
commit
115e1208c3
13 changed files with 413 additions and 59 deletions
|
@ -33,11 +33,21 @@ public class CygwinGDBDebugger extends GDBDebugger {
|
||||||
|
|
||||||
protected void initializeLibraries(ILaunchConfiguration config, Session session) throws CDIException {
|
protected void initializeLibraries(ILaunchConfiguration config, Session session) throws CDIException {
|
||||||
try {
|
try {
|
||||||
ICDISharedLibraryManager mgr = session.getSharedLibraryManager();
|
ICDISharedLibraryManager manager = session.getSharedLibraryManager();
|
||||||
if (mgr instanceof SharedLibraryManager) {
|
if (manager instanceof SharedLibraryManager) {
|
||||||
|
SharedLibraryManager mgr = (SharedLibraryManager)manager;
|
||||||
boolean stopOnSolibEvents = config.getAttribute(IMILaunchConfigurationConstants.ATTR_DEBUGGER_STOP_ON_SOLIB_EVENTS, false);
|
boolean stopOnSolibEvents = config.getAttribute(IMILaunchConfigurationConstants.ATTR_DEBUGGER_STOP_ON_SOLIB_EVENTS, false);
|
||||||
try {
|
try {
|
||||||
((SharedLibraryManager)mgr).setStopOnSolibEvents(stopOnSolibEvents);
|
mgr.setStopOnSolibEvents(stopOnSolibEvents);
|
||||||
|
// By default, we provide with the capability of deferred breakpoints
|
||||||
|
// And we set setStopOnSolib events for them(but they should not see the dll events ).
|
||||||
|
//
|
||||||
|
// If the user explicitly set stopOnSolibEvents well it probably
|
||||||
|
// means that they wanted to see those events so do no do deferred breakpoints.
|
||||||
|
if (!stopOnSolibEvents) {
|
||||||
|
mgr.setStopOnSolibEvents(true);
|
||||||
|
mgr.setDeferredBreakpoint(true);
|
||||||
|
}
|
||||||
} catch (CDIException e) {
|
} catch (CDIException e) {
|
||||||
// Ignore this error
|
// Ignore this error
|
||||||
// it seems to be a real problem on many gdb platform
|
// it seems to be a real problem on many gdb platform
|
||||||
|
@ -45,11 +55,11 @@ public class CygwinGDBDebugger extends GDBDebugger {
|
||||||
}
|
}
|
||||||
List p = config.getAttribute(IMILaunchConfigurationConstants.ATTR_DEBUGGER_SOLIB_PATH, Collections.EMPTY_LIST);
|
List p = config.getAttribute(IMILaunchConfigurationConstants.ATTR_DEBUGGER_SOLIB_PATH, Collections.EMPTY_LIST);
|
||||||
if (p.size() > 0) {
|
if (p.size() > 0) {
|
||||||
String[] oldPaths = mgr.getSharedLibraryPaths();
|
String[] oldPaths = manager.getSharedLibraryPaths();
|
||||||
String[] paths = new String[oldPaths.length + p.size()];
|
String[] paths = new String[oldPaths.length + p.size()];
|
||||||
System.arraycopy((String[])p.toArray(new String[p.size()]), 0, paths, 0, p.size());
|
System.arraycopy((String[])p.toArray(new String[p.size()]), 0, paths, 0, p.size());
|
||||||
System.arraycopy(oldPaths, 0, paths, p.size(), oldPaths.length);
|
System.arraycopy(oldPaths, 0, paths, p.size(), oldPaths.length);
|
||||||
mgr.setSharedLibraryPaths(paths);
|
manager.setSharedLibraryPaths(paths);
|
||||||
}
|
}
|
||||||
} catch (CoreException e) {
|
} catch (CoreException e) {
|
||||||
throw new CDIException("Error initializing shared library options: " + e.getMessage());
|
throw new CDIException("Error initializing shared library options: " + e.getMessage());
|
||||||
|
@ -77,6 +87,7 @@ public class CygwinGDBDebugger extends GDBDebugger {
|
||||||
// We ignore this exception, for example
|
// We ignore this exception, for example
|
||||||
// on GNU/Linux the new-console is an error.
|
// on GNU/Linux the new-console is an error.
|
||||||
}
|
}
|
||||||
|
initializeLibraries(config, session);
|
||||||
return session;
|
return session;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -88,6 +99,7 @@ public class CygwinGDBDebugger extends GDBDebugger {
|
||||||
Session session =
|
Session session =
|
||||||
(Session) super.createAttachSession(config, exe, pid);
|
(Session) super.createAttachSession(config, exe, pid);
|
||||||
session.getMISession().setCommandFactory(commandFactory);
|
session.getMISession().setCommandFactory(commandFactory);
|
||||||
|
initializeLibraries(config, session);
|
||||||
return session;
|
return session;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -99,6 +111,7 @@ public class CygwinGDBDebugger extends GDBDebugger {
|
||||||
Session session =
|
Session session =
|
||||||
(Session) super.createCoreSession(config, exe, corefile);
|
(Session) super.createCoreSession(config, exe, corefile);
|
||||||
session.getMISession().setCommandFactory(commandFactory);
|
session.getMISession().setCommandFactory(commandFactory);
|
||||||
|
initializeLibraries(config, session);
|
||||||
return session;
|
return session;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,13 +24,24 @@ public class GDBDebugger implements ICDebugger {
|
||||||
|
|
||||||
protected void initializeLibraries(ILaunchConfiguration config, Session session) throws CDIException {
|
protected void initializeLibraries(ILaunchConfiguration config, Session session) throws CDIException {
|
||||||
try {
|
try {
|
||||||
ICDISharedLibraryManager mgr = session.getSharedLibraryManager();
|
ICDISharedLibraryManager manager = session.getSharedLibraryManager();
|
||||||
if (mgr instanceof SharedLibraryManager) {
|
if (manager instanceof SharedLibraryManager) {
|
||||||
|
SharedLibraryManager mgr = (SharedLibraryManager)manager;
|
||||||
boolean autolib = config.getAttribute(IMILaunchConfigurationConstants.ATTR_DEBUGGER_AUTO_SOLIB, false);
|
boolean autolib = config.getAttribute(IMILaunchConfigurationConstants.ATTR_DEBUGGER_AUTO_SOLIB, false);
|
||||||
boolean stopOnSolibEvents = config.getAttribute(IMILaunchConfigurationConstants.ATTR_DEBUGGER_STOP_ON_SOLIB_EVENTS, false);
|
boolean stopOnSolibEvents = config.getAttribute(IMILaunchConfigurationConstants.ATTR_DEBUGGER_STOP_ON_SOLIB_EVENTS, false);
|
||||||
try {
|
try {
|
||||||
((SharedLibraryManager)mgr).setAutoLoadSymbols(autolib);
|
mgr.setAutoLoadSymbols(autolib);
|
||||||
((SharedLibraryManager)mgr).setStopOnSolibEvents(stopOnSolibEvents);
|
mgr.setStopOnSolibEvents(stopOnSolibEvents);
|
||||||
|
// The idea is that if the user set autolib, by default
|
||||||
|
// we provide with the capability of deferred breakpoints
|
||||||
|
// And we set setStopOnSolib events for them(but they should not see those things.
|
||||||
|
//
|
||||||
|
// If the user explicitly set stopOnSolibEvents well it probably
|
||||||
|
// means that they wanted to see those events so do no do deferred breakpoints.
|
||||||
|
if (autolib && !stopOnSolibEvents) {
|
||||||
|
mgr.setDeferredBreakpoint(true);
|
||||||
|
mgr.setStopOnSolibEvents(true);
|
||||||
|
}
|
||||||
} catch (CDIException e) {
|
} catch (CDIException e) {
|
||||||
// Ignore this error
|
// Ignore this error
|
||||||
// it seems to be a real problem on many gdb platform
|
// it seems to be a real problem on many gdb platform
|
||||||
|
@ -38,11 +49,11 @@ public class GDBDebugger implements ICDebugger {
|
||||||
}
|
}
|
||||||
List p = config.getAttribute(IMILaunchConfigurationConstants.ATTR_DEBUGGER_SOLIB_PATH, Collections.EMPTY_LIST);
|
List p = config.getAttribute(IMILaunchConfigurationConstants.ATTR_DEBUGGER_SOLIB_PATH, Collections.EMPTY_LIST);
|
||||||
if (p.size() > 0) {
|
if (p.size() > 0) {
|
||||||
String[] oldPaths = mgr.getSharedLibraryPaths();
|
String[] oldPaths = manager.getSharedLibraryPaths();
|
||||||
String[] paths = new String[oldPaths.length + p.size()];
|
String[] paths = new String[oldPaths.length + p.size()];
|
||||||
System.arraycopy((String[])p.toArray(new String[p.size()]), 0, paths, 0, p.size());
|
System.arraycopy((String[])p.toArray(new String[p.size()]), 0, paths, 0, p.size());
|
||||||
System.arraycopy(oldPaths, 0, paths, p.size(), oldPaths.length);
|
System.arraycopy(oldPaths, 0, paths, p.size(), oldPaths.length);
|
||||||
mgr.setSharedLibraryPaths(paths);
|
manager.setSharedLibraryPaths(paths);
|
||||||
}
|
}
|
||||||
} catch (CoreException e) {
|
} catch (CoreException e) {
|
||||||
throw new CDIException("Error initializing shared library options: " + e.getMessage());
|
throw new CDIException("Error initializing shared library options: " + e.getMessage());
|
||||||
|
|
|
@ -12,9 +12,11 @@ import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.eclipse.cdt.debug.mi.core.command.Command;
|
import org.eclipse.cdt.debug.mi.core.command.Command;
|
||||||
|
import org.eclipse.cdt.debug.mi.core.command.MIExecContinue;
|
||||||
import org.eclipse.cdt.debug.mi.core.command.MIExecFinish;
|
import org.eclipse.cdt.debug.mi.core.command.MIExecFinish;
|
||||||
import org.eclipse.cdt.debug.mi.core.command.MIExecNext;
|
import org.eclipse.cdt.debug.mi.core.command.MIExecNext;
|
||||||
import org.eclipse.cdt.debug.mi.core.command.MIExecNextInstruction;
|
import org.eclipse.cdt.debug.mi.core.command.MIExecNextInstruction;
|
||||||
|
import org.eclipse.cdt.debug.mi.core.command.MIExecReturn;
|
||||||
import org.eclipse.cdt.debug.mi.core.command.MIExecStep;
|
import org.eclipse.cdt.debug.mi.core.command.MIExecStep;
|
||||||
import org.eclipse.cdt.debug.mi.core.command.MIExecStepInstruction;
|
import org.eclipse.cdt.debug.mi.core.command.MIExecStepInstruction;
|
||||||
import org.eclipse.cdt.debug.mi.core.command.MIExecUntil;
|
import org.eclipse.cdt.debug.mi.core.command.MIExecUntil;
|
||||||
|
@ -146,6 +148,10 @@ public class RxThread extends Thread {
|
||||||
type = MIRunningEvent.UNTIL;
|
type = MIRunningEvent.UNTIL;
|
||||||
} else if (cmd instanceof MIExecFinish) {
|
} else if (cmd instanceof MIExecFinish) {
|
||||||
type = MIRunningEvent.FINISH;
|
type = MIRunningEvent.FINISH;
|
||||||
|
} else if (cmd instanceof MIExecReturn) {
|
||||||
|
type = MIRunningEvent.RETURN;
|
||||||
|
} else if (cmd instanceof MIExecContinue) {
|
||||||
|
type = MIRunningEvent.CONTINUE;
|
||||||
} else {
|
} else {
|
||||||
type = MIRunningEvent.CONTINUE;
|
type = MIRunningEvent.CONTINUE;
|
||||||
}
|
}
|
||||||
|
@ -199,6 +205,7 @@ public class RxThread extends Thread {
|
||||||
void processMIOOBRecord(MIOOBRecord oob, List list) {
|
void processMIOOBRecord(MIOOBRecord oob, List list) {
|
||||||
if (oob instanceof MIAsyncRecord) {
|
if (oob instanceof MIAsyncRecord) {
|
||||||
processMIOOBRecord((MIAsyncRecord) oob, list);
|
processMIOOBRecord((MIAsyncRecord) oob, list);
|
||||||
|
oobList.clear();
|
||||||
} else if (oob instanceof MIStreamRecord) {
|
} else if (oob instanceof MIStreamRecord) {
|
||||||
processMIOOBRecord((MIStreamRecord) oob);
|
processMIOOBRecord((MIStreamRecord) oob);
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,6 +14,7 @@ import org.eclipse.cdt.debug.core.cdi.ICDIBreakpointManager;
|
||||||
import org.eclipse.cdt.debug.core.cdi.ICDICatchEvent;
|
import org.eclipse.cdt.debug.core.cdi.ICDICatchEvent;
|
||||||
import org.eclipse.cdt.debug.core.cdi.ICDICondition;
|
import org.eclipse.cdt.debug.core.cdi.ICDICondition;
|
||||||
import org.eclipse.cdt.debug.core.cdi.ICDILocation;
|
import org.eclipse.cdt.debug.core.cdi.ICDILocation;
|
||||||
|
import org.eclipse.cdt.debug.core.cdi.ICDISharedLibraryManager;
|
||||||
import org.eclipse.cdt.debug.core.cdi.model.ICDIBreakpoint;
|
import org.eclipse.cdt.debug.core.cdi.model.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;
|
||||||
|
@ -50,12 +51,14 @@ 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 deferredList;
|
||||||
boolean allowInterrupt;
|
boolean allowInterrupt;
|
||||||
boolean autoupdate;
|
boolean autoupdate;
|
||||||
|
|
||||||
public BreakpointManager(Session session) {
|
public BreakpointManager(Session session) {
|
||||||
super(session);
|
super(session);
|
||||||
breakList = Collections.synchronizedList(new ArrayList());
|
breakList = Collections.synchronizedList(new ArrayList());
|
||||||
|
deferredList = Collections.synchronizedList(new ArrayList());
|
||||||
allowInterrupt = true;
|
allowInterrupt = true;
|
||||||
autoupdate = false;
|
autoupdate = false;
|
||||||
}
|
}
|
||||||
|
@ -265,6 +268,8 @@ public class BreakpointManager extends SessionObject implements ICDIBreakpointMa
|
||||||
// Fire ChangedEvent
|
// Fire ChangedEvent
|
||||||
bp.setMIBreakpoint(newMIBreakpoints[i]);
|
bp.setMIBreakpoint(newMIBreakpoints[i]);
|
||||||
eventList.add(new MIBreakpointChangedEvent(no));
|
eventList.add(new MIBreakpointChangedEvent(no));
|
||||||
|
} else {
|
||||||
|
eventList.add(new MIBreakpointCreatedEvent(no));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// add the new breakpoint and fire CreatedEvent
|
// add the new breakpoint and fire CreatedEvent
|
||||||
|
@ -318,6 +323,14 @@ public class BreakpointManager extends SessionObject implements ICDIBreakpointMa
|
||||||
deleteBreakpoints(new ICDIBreakpoint[] { breakpoint });
|
deleteBreakpoints(new ICDIBreakpoint[] { breakpoint });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void deleteFromDeferredList(Breakpoint bkpt) {
|
||||||
|
deferredList.remove(bkpt);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addToBreakpointList(Breakpoint bkpt) {
|
||||||
|
breakList.add(bkpt);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see org.eclipse.cdt.debug.core.cdi.ICDIBreakpointManager#deleteBreakpoints(ICDIBreakpoint[])
|
* @see org.eclipse.cdt.debug.core.cdi.ICDIBreakpointManager#deleteBreakpoints(ICDIBreakpoint[])
|
||||||
*/
|
*/
|
||||||
|
@ -364,6 +377,10 @@ public class BreakpointManager extends SessionObject implements ICDIBreakpointMa
|
||||||
return (ICDIBreakpoint[]) breakList.toArray(new ICDIBreakpoint[0]);
|
return (ICDIBreakpoint[]) breakList.toArray(new ICDIBreakpoint[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ICDIBreakpoint[] getDeferredBreakpoints() throws CDIException {
|
||||||
|
return (ICDIBreakpoint[]) deferredList.toArray(new ICDIBreakpoint[0]);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see org.eclipse.cdt.debug.core.cdi.ICDIBreakpointManager#setCatchpoint(int, ICDICatchEvent, String, ICDICondition, boolean)
|
* @see org.eclipse.cdt.debug.core.cdi.ICDIBreakpointManager#setCatchpoint(int, ICDICatchEvent, String, ICDICondition, boolean)
|
||||||
*/
|
*/
|
||||||
|
@ -377,18 +394,58 @@ public class BreakpointManager extends SessionObject implements ICDIBreakpointMa
|
||||||
*/
|
*/
|
||||||
public ICDILocationBreakpoint setLocationBreakpoint(int type, ICDILocation location,
|
public ICDILocationBreakpoint setLocationBreakpoint(int type, ICDILocation location,
|
||||||
ICDICondition condition, String threadId) throws CDIException {
|
ICDICondition condition, String threadId) throws CDIException {
|
||||||
|
return setLocationBreakpoint(type, location, condition, threadId, false);
|
||||||
|
}
|
||||||
|
|
||||||
boolean hardware = (type == ICDIBreakpoint.HARDWARE);
|
/**
|
||||||
boolean temporary = (type == ICDIBreakpoint.TEMPORARY);
|
* @see org.eclipse.cdt.debug.core.cdi.ICDIBreakpointManager#setLocationBreakpoint(int, ICDILocation, ICDICondition, boolean, String)
|
||||||
|
*/
|
||||||
|
public ICDILocationBreakpoint setLocationBreakpoint(int type, ICDILocation location,
|
||||||
|
ICDICondition condition, String threadId, boolean deferred) throws CDIException {
|
||||||
|
|
||||||
|
Breakpoint bkpt = new Breakpoint(this, type, location, condition, threadId);
|
||||||
|
try {
|
||||||
|
setLocationBreakpoint(bkpt);
|
||||||
|
breakList.add(bkpt);
|
||||||
|
|
||||||
|
// Fire a created Event.
|
||||||
|
Session session = (Session)getSession();
|
||||||
|
MISession mi = session.getMISession();
|
||||||
|
mi.fireEvent(new MIBreakpointCreatedEvent(bkpt.getMIBreakpoint().getNumber()));
|
||||||
|
} catch (CDIException e) {
|
||||||
|
if (!deferred) {
|
||||||
|
throw e;
|
||||||
|
} else {
|
||||||
|
Session session = (Session)getSession();
|
||||||
|
ICDISharedLibraryManager sharedMgr = session.getSharedLibraryManager();
|
||||||
|
if (sharedMgr instanceof SharedLibraryManager) {
|
||||||
|
SharedLibraryManager mgr = (SharedLibraryManager)sharedMgr;
|
||||||
|
if (mgr.isDeferredBreakpoint()) {
|
||||||
|
deferredList.add(bkpt);
|
||||||
|
} else {
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return bkpt;
|
||||||
|
}
|
||||||
|
|
||||||
|
MIBreakInsert createMIBreakInsert(Breakpoint bkpt) throws CDIException {
|
||||||
|
boolean hardware = bkpt.isHardware();
|
||||||
|
boolean temporary = bkpt.isTemporary();
|
||||||
String exprCond = null;
|
String exprCond = null;
|
||||||
int ignoreCount = 0;
|
int ignoreCount = 0;
|
||||||
StringBuffer line = new StringBuffer();
|
StringBuffer line = new StringBuffer();
|
||||||
if (condition != null) {
|
|
||||||
|
if (bkpt.getCondition() != null) {
|
||||||
|
ICDICondition condition = bkpt.getCondition();
|
||||||
exprCond = condition.getExpression();
|
exprCond = condition.getExpression();
|
||||||
ignoreCount = condition.getIgnoreCount();
|
ignoreCount = condition.getIgnoreCount();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (location != null) {
|
if (bkpt.getLocation() != null) {
|
||||||
|
ICDILocation location = bkpt.getLocation();
|
||||||
String file = location.getFile();
|
String file = location.getFile();
|
||||||
String function = location.getFunction();
|
String function = location.getFunction();
|
||||||
if (file != null && file.length() > 0) {
|
if (file != null && file.length() > 0) {
|
||||||
|
@ -406,13 +463,15 @@ public class BreakpointManager extends SessionObject implements ICDIBreakpointMa
|
||||||
line.append('*').append(location.getAddress());
|
line.append('*').append(location.getAddress());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Session session = (Session)getSession();
|
||||||
|
CommandFactory factory = session.getMISession().getCommandFactory();
|
||||||
|
return factory.createMIBreakInsert(temporary, hardware, exprCond, ignoreCount, line.toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLocationBreakpoint (Breakpoint bkpt) throws CDIException {
|
||||||
Session session = (Session)getSession();
|
Session session = (Session)getSession();
|
||||||
boolean state = suspendInferior(session.getCurrentTarget());
|
boolean state = suspendInferior(session.getCurrentTarget());
|
||||||
CommandFactory factory = session.getMISession().getCommandFactory();
|
MIBreakInsert breakInsert = createMIBreakInsert(bkpt);
|
||||||
MIBreakInsert breakInsert =
|
|
||||||
factory.createMIBreakInsert( temporary, hardware, exprCond,
|
|
||||||
ignoreCount, line.toString());
|
|
||||||
MIBreakpoint[] points = null;
|
MIBreakpoint[] points = null;
|
||||||
try {
|
try {
|
||||||
session.getMISession().postCommand(breakInsert);
|
session.getMISession().postCommand(breakInsert);
|
||||||
|
@ -429,13 +488,8 @@ public class BreakpointManager extends SessionObject implements ICDIBreakpointMa
|
||||||
} finally {
|
} finally {
|
||||||
resumeInferior(session.getCurrentTarget(), state);
|
resumeInferior(session.getCurrentTarget(), state);
|
||||||
}
|
}
|
||||||
Breakpoint bkpt = new Breakpoint(this, points[0]);
|
|
||||||
breakList.add(bkpt);
|
|
||||||
|
|
||||||
// Fire a created Event.
|
bkpt.setMIBreakpoint(points[0]);
|
||||||
MISession mi = session.getMISession();
|
|
||||||
mi.fireEvent(new MIBreakpointCreatedEvent(bkpt.getMIBreakpoint().getNumber()));
|
|
||||||
return bkpt;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -23,7 +23,12 @@ import org.eclipse.cdt.debug.core.cdi.ICDISourceManager;
|
||||||
import org.eclipse.cdt.debug.core.cdi.ICDIVariableManager;
|
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.ICDIBreakpoint;
|
||||||
|
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.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.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;
|
||||||
|
@ -32,8 +37,17 @@ 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.Breakpoint;
|
||||||
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.cdi.model.Target;
|
||||||
|
import org.eclipse.cdt.debug.mi.core.cdi.model.Thread;
|
||||||
|
import org.eclipse.cdt.debug.mi.core.command.Command;
|
||||||
|
import org.eclipse.cdt.debug.mi.core.command.CommandFactory;
|
||||||
|
import org.eclipse.cdt.debug.mi.core.command.MIExecContinue;
|
||||||
|
import org.eclipse.cdt.debug.mi.core.command.MIExecFinish;
|
||||||
|
import org.eclipse.cdt.debug.mi.core.command.MIStackInfoDepth;
|
||||||
|
import org.eclipse.cdt.debug.mi.core.command.MIStackSelectFrame;
|
||||||
|
import org.eclipse.cdt.debug.mi.core.command.MIThreadSelect;
|
||||||
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;
|
||||||
|
@ -52,6 +66,7 @@ import org.eclipse.cdt.debug.mi.core.event.MIRegisterCreatedEvent;
|
||||||
import org.eclipse.cdt.debug.mi.core.event.MIRunningEvent;
|
import org.eclipse.cdt.debug.mi.core.event.MIRunningEvent;
|
||||||
import org.eclipse.cdt.debug.mi.core.event.MISharedLibChangedEvent;
|
import org.eclipse.cdt.debug.mi.core.event.MISharedLibChangedEvent;
|
||||||
import org.eclipse.cdt.debug.mi.core.event.MISharedLibCreatedEvent;
|
import org.eclipse.cdt.debug.mi.core.event.MISharedLibCreatedEvent;
|
||||||
|
import org.eclipse.cdt.debug.mi.core.event.MISharedLibEvent;
|
||||||
import org.eclipse.cdt.debug.mi.core.event.MISharedLibUnloadedEvent;
|
import org.eclipse.cdt.debug.mi.core.event.MISharedLibUnloadedEvent;
|
||||||
import org.eclipse.cdt.debug.mi.core.event.MISignalChangedEvent;
|
import org.eclipse.cdt.debug.mi.core.event.MISignalChangedEvent;
|
||||||
import org.eclipse.cdt.debug.mi.core.event.MIStoppedEvent;
|
import org.eclipse.cdt.debug.mi.core.event.MIStoppedEvent;
|
||||||
|
@ -60,6 +75,8 @@ import org.eclipse.cdt.debug.mi.core.event.MIThreadExitEvent;
|
||||||
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.event.MIVarCreatedEvent;
|
||||||
import org.eclipse.cdt.debug.mi.core.event.MIVarDeletedEvent;
|
import org.eclipse.cdt.debug.mi.core.event.MIVarDeletedEvent;
|
||||||
|
import org.eclipse.cdt.debug.mi.core.output.MIInfo;
|
||||||
|
import org.eclipse.cdt.debug.mi.core.output.MIStackInfoDepthInfo;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*/
|
*/
|
||||||
|
@ -67,6 +84,8 @@ public class EventManager extends SessionObject implements ICDIEventManager, Obs
|
||||||
|
|
||||||
List list = Collections.synchronizedList(new ArrayList(1));
|
List list = Collections.synchronizedList(new ArrayList(1));
|
||||||
List tokenList = new ArrayList(1);
|
List tokenList = new ArrayList(1);
|
||||||
|
MIRunningEvent lastRunningEvent;
|
||||||
|
Command lastUserCommand = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Process the event from MI, do any state work on the CDI,
|
* Process the event from MI, do any state work on the CDI,
|
||||||
|
@ -80,10 +99,12 @@ public class EventManager extends SessionObject implements ICDIEventManager, Obs
|
||||||
if (ignoreEventToken(miEvent.getToken())) {
|
if (ignoreEventToken(miEvent.getToken())) {
|
||||||
// Ignore the event if it is on the ignore list.
|
// Ignore the event if it is on the ignore list.
|
||||||
} else if (miEvent instanceof MIStoppedEvent) {
|
} else if (miEvent instanceof MIStoppedEvent) {
|
||||||
processSuspendedEvent((MIStoppedEvent)miEvent);
|
if (processSuspendedEvent((MIStoppedEvent)miEvent)) {
|
||||||
cdiList.add(new SuspendedEvent(session, miEvent));
|
cdiList.add(new SuspendedEvent(session, miEvent));
|
||||||
|
}
|
||||||
} else if (miEvent instanceof MIRunningEvent) {
|
} else if (miEvent instanceof MIRunningEvent) {
|
||||||
cdiList.add(new ResumedEvent(session, (MIRunningEvent)miEvent));
|
if (processRunningEvent((MIRunningEvent)miEvent))
|
||||||
|
cdiList.add(new ResumedEvent(session, (MIRunningEvent)miEvent));
|
||||||
} else if (miEvent instanceof MIChangedEvent) {
|
} else if (miEvent instanceof MIChangedEvent) {
|
||||||
if (miEvent instanceof MIVarChangedEvent) {
|
if (miEvent instanceof MIVarChangedEvent) {
|
||||||
cdiList.add(new ChangedEvent(session, (MIVarChangedEvent)miEvent));
|
cdiList.add(new ChangedEvent(session, (MIVarChangedEvent)miEvent));
|
||||||
|
@ -238,24 +259,36 @@ public class EventManager extends SessionObject implements ICDIEventManager, Obs
|
||||||
* Alse the variable and the memory needs to be updated and events
|
* Alse the variable and the memory needs to be updated and events
|
||||||
* fired for changes.
|
* fired for changes.
|
||||||
*/
|
*/
|
||||||
void processSuspendedEvent(MIStoppedEvent stopped) {
|
boolean processSuspendedEvent(MIStoppedEvent stopped) {
|
||||||
Session session = (Session)getSession();
|
Session session = (Session)getSession();
|
||||||
ICDITarget currentTarget = session.getCurrentTarget();
|
ICDITarget currentTarget = session.getCurrentTarget();
|
||||||
// Set the current thread.
|
|
||||||
|
if (processSharedLibEvent(stopped)) {
|
||||||
|
// Event was consumed by the shared lib processing bailout
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
int threadId = threadId = stopped.getThreadId();
|
int threadId = threadId = stopped.getThreadId();
|
||||||
if (currentTarget instanceof Target) {
|
if (currentTarget instanceof Target) {
|
||||||
((Target)currentTarget).updateState(threadId);
|
Target cTarget = (Target)currentTarget;
|
||||||
|
cTarget.updateState(threadId);
|
||||||
|
try {
|
||||||
|
cTarget.getCurrentThread().getCurrentStackFrame();
|
||||||
|
} catch (CDIException e1) {
|
||||||
|
//e1.printStackTrace();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update the managers.
|
// Update the managers.
|
||||||
// For the Variable/Expression Managers call only the updateManager.
|
// For the Variable/Expression Managers call only the updateManager.
|
||||||
ICDIVariableManager varMgr = session.getVariableManager();
|
ICDIVariableManager varMgr = session.getVariableManager();
|
||||||
ICDIExpressionManager expMgr = session.getExpressionManager();
|
ICDIExpressionManager expMgr = session.getExpressionManager();
|
||||||
ICDIRegisterManager regMgr = session.getRegisterManager();
|
ICDIRegisterManager regMgr = session.getRegisterManager();
|
||||||
ICDIMemoryManager memMgr = session.getMemoryManager();
|
ICDIMemoryManager memMgr = session.getMemoryManager();
|
||||||
ICDISharedLibraryManager libMgr = session.getSharedLibraryManager();
|
|
||||||
ICDIBreakpointManager bpMgr = session.getBreakpointManager();
|
ICDIBreakpointManager bpMgr = session.getBreakpointManager();
|
||||||
ICDISignalManager sigMgr = session.getSignalManager();
|
ICDISignalManager sigMgr = session.getSignalManager();
|
||||||
ICDISourceManager srcMgr = session.getSourceManager();
|
ICDISourceManager srcMgr = session.getSourceManager();
|
||||||
|
ICDISharedLibraryManager libMgr = session.getSharedLibraryManager();
|
||||||
try {
|
try {
|
||||||
if (varMgr.isAutoUpdate()) {
|
if (varMgr.isAutoUpdate()) {
|
||||||
varMgr.update();
|
varMgr.update();
|
||||||
|
@ -269,29 +302,191 @@ public class EventManager extends SessionObject implements ICDIEventManager, Obs
|
||||||
if (memMgr.isAutoUpdate()) {
|
if (memMgr.isAutoUpdate()) {
|
||||||
memMgr.update();
|
memMgr.update();
|
||||||
}
|
}
|
||||||
if (libMgr.isAutoUpdate()) {
|
|
||||||
libMgr.update();
|
|
||||||
}
|
|
||||||
if (bpMgr.isAutoUpdate()) {
|
if (bpMgr.isAutoUpdate()) {
|
||||||
bpMgr.update();
|
bpMgr.update();
|
||||||
}
|
}
|
||||||
if (sigMgr.isAutoUpdate()) {
|
if (sigMgr.isAutoUpdate()) {
|
||||||
sigMgr.update();
|
sigMgr.update();
|
||||||
}
|
}
|
||||||
|
if (libMgr.isAutoUpdate()) {
|
||||||
|
libMgr.update();
|
||||||
|
}
|
||||||
if (srcMgr.isAutoUpdate()) {
|
if (srcMgr.isAutoUpdate()) {
|
||||||
srcMgr.update();
|
srcMgr.update();
|
||||||
}
|
}
|
||||||
} catch (CDIException e) {
|
} catch (CDIException e) {
|
||||||
//System.out.println(e);
|
//System.out.println(e);
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* If the deferredBreakpoint processing is set
|
||||||
|
* catch the shared-lib-event go to the last known
|
||||||
|
* stackframe and try to finish.
|
||||||
|
* Save the last user command and issue it again.
|
||||||
|
* @param stopped
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
boolean processSharedLibEvent(MIStoppedEvent stopped) {
|
||||||
|
Session session = (Session)getSession();
|
||||||
|
MISession mi = session.getMISession();
|
||||||
|
|
||||||
|
ICDITarget currentTarget = session.getCurrentTarget();
|
||||||
|
ICDISharedLibraryManager libMgr = session.getSharedLibraryManager();
|
||||||
|
SharedLibraryManager mgr = null;
|
||||||
|
|
||||||
|
if (libMgr instanceof SharedLibraryManager) {
|
||||||
|
mgr = (SharedLibraryManager)libMgr;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mgr !=null && mgr.isDeferredBreakpoint()) {
|
||||||
|
if (stopped instanceof MISharedLibEvent) {
|
||||||
|
// Check if we have a new library loaded
|
||||||
|
List eventList = null;
|
||||||
|
try {
|
||||||
|
eventList = mgr.updateState();
|
||||||
|
} catch (CDIException e3) {
|
||||||
|
eventList = Collections.EMPTY_LIST;
|
||||||
|
}
|
||||||
|
// A new Libraries loaded, try to set the breakpoints.
|
||||||
|
if (eventList.size() > 0) {
|
||||||
|
boolean breakpointSet = false;
|
||||||
|
ICDIBreakpointManager manager = session.getBreakpointManager();
|
||||||
|
if (manager instanceof BreakpointManager) {
|
||||||
|
BreakpointManager bpMgr = (BreakpointManager)manager;
|
||||||
|
ICDIBreakpoint bpoints[] = null;
|
||||||
|
try {
|
||||||
|
bpoints = bpMgr.getDeferredBreakpoints();
|
||||||
|
} catch (CDIException e) {
|
||||||
|
bpoints = new ICDIBreakpoint[0];
|
||||||
|
}
|
||||||
|
for (int i = 0; i < bpoints.length; i++) {
|
||||||
|
if (bpoints[i] instanceof Breakpoint) {
|
||||||
|
Breakpoint bkpt = (Breakpoint)bpoints[i];
|
||||||
|
try {
|
||||||
|
bpMgr.setLocationBreakpoint(bkpt);
|
||||||
|
bpMgr.deleteFromDeferredList(bkpt);
|
||||||
|
bpMgr.addToBreakpointList(bkpt);
|
||||||
|
eventList.add(new MIBreakpointCreatedEvent(bkpt.getMIBreakpoint().getNumber()));
|
||||||
|
} catch (CDIException e) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
MIEvent[] events = (MIEvent[])eventList.toArray(new MIEvent[0]);
|
||||||
|
mi.fireEvents(events);
|
||||||
|
}
|
||||||
|
CommandFactory factory = mi.getCommandFactory();
|
||||||
|
int type = (lastRunningEvent == null) ? MIRunningEvent.CONTINUE : lastRunningEvent.getType();
|
||||||
|
if (lastUserCommand == null) {
|
||||||
|
switch (type) {
|
||||||
|
case MIRunningEvent.NEXT:
|
||||||
|
lastUserCommand = factory.createMIExecNext();
|
||||||
|
break;
|
||||||
|
case MIRunningEvent.NEXTI:
|
||||||
|
lastUserCommand = factory.createMIExecNextInstruction();
|
||||||
|
break;
|
||||||
|
case MIRunningEvent.STEP:
|
||||||
|
lastUserCommand = factory.createMIExecStep();
|
||||||
|
break;
|
||||||
|
case MIRunningEvent.STEPI:
|
||||||
|
lastUserCommand = factory.createMIExecStepInstruction();
|
||||||
|
break;
|
||||||
|
case MIRunningEvent.FINISH:
|
||||||
|
lastUserCommand = factory.createMIExecFinish();
|
||||||
|
break;
|
||||||
|
case MIRunningEvent.RETURN:
|
||||||
|
lastUserCommand = factory.createMIExecReturn();
|
||||||
|
break;
|
||||||
|
case MIRunningEvent.CONTINUE: {
|
||||||
|
MIExecContinue cont = factory.createMIExecContinue();
|
||||||
|
try {
|
||||||
|
mi.postCommand(cont);
|
||||||
|
MIInfo info = cont.getMIInfo();
|
||||||
|
if (info == null) {
|
||||||
|
// throw new CDIException("Target is not responding");
|
||||||
|
}
|
||||||
|
} catch (MIException e) {
|
||||||
|
// throw new MI2CDIException(e);
|
||||||
|
}
|
||||||
|
return true; // for the continue bailout early no need to the stuff below
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int miLevel = 0;
|
||||||
|
int tid = 0;
|
||||||
|
ICDIThread currentThread = null;
|
||||||
|
try {
|
||||||
|
currentThread = currentTarget.getCurrentThread();
|
||||||
|
} catch (CDIException e1) {
|
||||||
|
}
|
||||||
|
if (currentThread instanceof Thread) {
|
||||||
|
tid = ((Thread)currentThread).getId();
|
||||||
|
}
|
||||||
|
ICDIStackFrame frame = null;
|
||||||
|
try {
|
||||||
|
frame = currentThread.getCurrentStackFrame();
|
||||||
|
} catch (CDIException e2) {
|
||||||
|
}
|
||||||
|
int count = 0;
|
||||||
|
try {
|
||||||
|
MIStackInfoDepth depth = factory.createMIStackInfoDepth();
|
||||||
|
mi.postCommand(depth);
|
||||||
|
MIStackInfoDepthInfo info = depth.getMIStackInfoDepthInfo();
|
||||||
|
if (info == null) {
|
||||||
|
//throw new CDIException("No answer");
|
||||||
|
}
|
||||||
|
count = info.getDepth();
|
||||||
|
} catch (MIException e) {
|
||||||
|
//throw new MI2CDIException(e);
|
||||||
|
//System.out.println(e);
|
||||||
|
}
|
||||||
|
if (frame != null) {
|
||||||
|
// Fortunately the ICDIStackFrame store the level
|
||||||
|
// in ascending level the higher the stack the higher the level
|
||||||
|
// GDB does the opposite the highest stack is 0.
|
||||||
|
// This allow us to do some calculation, in figure out the
|
||||||
|
// level of the old stack. The -1 is because gdb level is zero-based
|
||||||
|
miLevel = count - frame.getLevel() - 1;
|
||||||
|
}
|
||||||
|
if (tid > 0) {
|
||||||
|
MIThreadSelect selectThread = factory.createMIThreadSelect(tid);
|
||||||
|
try {
|
||||||
|
mi.postCommand(selectThread);
|
||||||
|
} catch (MIException e) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (miLevel > 0) {
|
||||||
|
MIStackSelectFrame selectFrame = factory.createMIStackSelectFrame(miLevel);
|
||||||
|
MIExecFinish finish = factory.createMIExecFinish();
|
||||||
|
try {
|
||||||
|
mi.postCommand(selectFrame);
|
||||||
|
mi.postCommand(finish);
|
||||||
|
} catch (MIException e) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
} else if (lastUserCommand != null) {
|
||||||
|
Command cmd = lastUserCommand;
|
||||||
|
lastUserCommand = null;
|
||||||
|
try {
|
||||||
|
mi.postCommand(cmd);
|
||||||
|
} catch (MIException e) {
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Do any processing of before a running event.
|
* Do any processing of before a running event.
|
||||||
*/
|
*/
|
||||||
void processRunningEvent() {
|
boolean processRunningEvent(MIRunningEvent running) {
|
||||||
//Target target = getCSession().getCTarget();
|
lastRunningEvent = running;
|
||||||
//target.clearState();
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,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;
|
||||||
|
@ -41,6 +42,7 @@ public class SharedLibraryManager extends SessionObject implements ICDISharedLib
|
||||||
|
|
||||||
List sharedList;
|
List sharedList;
|
||||||
boolean autoupdate;
|
boolean autoupdate;
|
||||||
|
boolean isDeferred;
|
||||||
|
|
||||||
public SharedLibraryManager (Session session) {
|
public SharedLibraryManager (Session session) {
|
||||||
super(session);
|
super(session);
|
||||||
|
@ -70,14 +72,22 @@ public class SharedLibraryManager extends SessionObject implements ICDISharedLib
|
||||||
* @see org.eclipse.cdt.debug.core.cdi.ICDISharedLibraryManager#update()
|
* @see org.eclipse.cdt.debug.core.cdi.ICDISharedLibraryManager#update()
|
||||||
*/
|
*/
|
||||||
public void update() throws CDIException {
|
public void update() throws CDIException {
|
||||||
|
Session session = (Session)getSession();
|
||||||
|
MISession mi = session.getMISession();
|
||||||
|
List eventList = updateState();
|
||||||
|
MIEvent[] events = (MIEvent[])eventList.toArray(new MIEvent[0]);
|
||||||
|
mi.fireEvents(events);
|
||||||
|
}
|
||||||
|
|
||||||
|
public List updateState() throws CDIException {
|
||||||
Session session = (Session)getSession();
|
Session session = (Session)getSession();
|
||||||
ICDIConfiguration conf = session.getConfiguration();
|
ICDIConfiguration conf = session.getConfiguration();
|
||||||
if (!conf.supportsSharedLibrary()) {
|
if (!conf.supportsSharedLibrary()) {
|
||||||
return; // Bail out early;
|
return Collections.EMPTY_LIST; // Bail out early;
|
||||||
}
|
}
|
||||||
|
|
||||||
MIShared[] miLibs = getMIShareds();
|
MIShared[] miLibs = getMIShareds();
|
||||||
List eventList = new ArrayList(miLibs.length);
|
ArrayList eventList = new ArrayList(miLibs.length);
|
||||||
for (int i = 0; i < miLibs.length; i++) {
|
for (int i = 0; i < miLibs.length; i++) {
|
||||||
ICDISharedLibrary sharedlib = getSharedLibrary(miLibs[i].getName());
|
ICDISharedLibrary sharedlib = getSharedLibrary(miLibs[i].getName());
|
||||||
if (sharedlib != null) {
|
if (sharedlib != null) {
|
||||||
|
@ -107,9 +117,7 @@ public class SharedLibraryManager extends SessionObject implements ICDISharedLib
|
||||||
eventList.add(new MISharedLibUnloadedEvent(oldlibs[i].getFileName()));
|
eventList.add(new MISharedLibUnloadedEvent(oldlibs[i].getFileName()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
MISession mi = session.getMISession();
|
return eventList;
|
||||||
MIEvent[] events = (MIEvent[])eventList.toArray(new MIEvent[0]);
|
|
||||||
mi.fireEvents(events);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean hasSharedLibChanged(ICDISharedLibrary lib, MIShared miLib) {
|
public boolean hasSharedLibChanged(ICDISharedLibrary lib, MIShared miLib) {
|
||||||
|
@ -133,6 +141,14 @@ public class SharedLibraryManager extends SessionObject implements ICDISharedLib
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setDeferredBreakpoint (boolean set) {
|
||||||
|
isDeferred = set;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isDeferredBreakpoint() {
|
||||||
|
return isDeferred;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see org.eclipse.cdt.debug.core.cdi.ICDISharedLibraryManager#setSharedLibraryPaths(String[])
|
* @see org.eclipse.cdt.debug.core.cdi.ICDISharedLibraryManager#setSharedLibraryPaths(String[])
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -58,13 +58,11 @@ public class ResumedEvent implements ICDIResumedEvent {
|
||||||
cdiType = ICDIResumedEvent.STEP_INTO_INSTRUCTION;
|
cdiType = ICDIResumedEvent.STEP_INTO_INSTRUCTION;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case MIRunningEvent.RETURN:
|
||||||
case MIRunningEvent.FINISH:
|
case MIRunningEvent.FINISH:
|
||||||
cdiType = ICDIResumedEvent.STEP_RETURN;
|
cdiType = ICDIResumedEvent.STEP_RETURN;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
//MIRunningEvent.UNTIL:
|
|
||||||
//cdiType = ICDIResumedEvent.STEP_UNTIL;
|
|
||||||
//break;
|
|
||||||
}
|
}
|
||||||
return cdiType;
|
return cdiType;
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,6 +7,7 @@ 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.ICDICondition;
|
import org.eclipse.cdt.debug.core.cdi.ICDICondition;
|
||||||
import org.eclipse.cdt.debug.core.cdi.ICDILocation;
|
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.ICDILocationBreakpoint;
|
import org.eclipse.cdt.debug.core.cdi.model.ICDILocationBreakpoint;
|
||||||
import org.eclipse.cdt.debug.mi.core.cdi.BreakpointManager;
|
import org.eclipse.cdt.debug.mi.core.cdi.BreakpointManager;
|
||||||
import org.eclipse.cdt.debug.mi.core.cdi.Condition;
|
import org.eclipse.cdt.debug.mi.core.cdi.Condition;
|
||||||
|
@ -21,6 +22,17 @@ public class Breakpoint extends CObject implements ICDILocationBreakpoint {
|
||||||
ICDICondition condition;
|
ICDICondition condition;
|
||||||
MIBreakpoint miBreakpoint;
|
MIBreakpoint miBreakpoint;
|
||||||
BreakpointManager mgr;
|
BreakpointManager mgr;
|
||||||
|
int type;
|
||||||
|
String tid;
|
||||||
|
|
||||||
|
public Breakpoint(BreakpointManager m, int kind, ICDILocation loc, ICDICondition cond, String threadId) {
|
||||||
|
super(m.getSession().getCurrentTarget());
|
||||||
|
mgr = m;
|
||||||
|
type = kind;
|
||||||
|
location = loc;
|
||||||
|
condition = cond;
|
||||||
|
tid = threadId;
|
||||||
|
}
|
||||||
|
|
||||||
public Breakpoint(BreakpointManager m, MIBreakpoint miBreak) {
|
public Breakpoint(BreakpointManager m, MIBreakpoint miBreak) {
|
||||||
super(m.getSession().getCurrentTarget());
|
super(m.getSession().getCurrentTarget());
|
||||||
|
@ -39,13 +51,17 @@ public class Breakpoint extends CObject implements ICDILocationBreakpoint {
|
||||||
condition = null;
|
condition = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isDeferred() {
|
||||||
|
return (miBreakpoint == null);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see org.eclipse.cdt.debug.core.cdi.ICDIBreakpoint#getCondition()
|
* @see org.eclipse.cdt.debug.core.cdi.ICDIBreakpoint#getCondition()
|
||||||
*/
|
*/
|
||||||
public ICDICondition getCondition() throws CDIException {
|
public ICDICondition getCondition() throws CDIException {
|
||||||
if (condition == null) {
|
if (condition == null) {
|
||||||
condition = new Condition(miBreakpoint.getIgnoreCount(),
|
if (miBreakpoint != null)
|
||||||
miBreakpoint.getCondition());
|
condition = new Condition(miBreakpoint.getIgnoreCount(), miBreakpoint.getCondition());
|
||||||
}
|
}
|
||||||
return condition;
|
return condition;
|
||||||
}
|
}
|
||||||
|
@ -54,28 +70,36 @@ public class Breakpoint extends CObject implements ICDILocationBreakpoint {
|
||||||
* @see org.eclipse.cdt.debug.core.cdi.ICDIBreakpoint#getThreadId()
|
* @see org.eclipse.cdt.debug.core.cdi.ICDIBreakpoint#getThreadId()
|
||||||
*/
|
*/
|
||||||
public String getThreadId() throws CDIException {
|
public String getThreadId() throws CDIException {
|
||||||
return miBreakpoint.getThreadId();
|
if (miBreakpoint != null)
|
||||||
|
return miBreakpoint.getThreadId();
|
||||||
|
return tid;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see org.eclipse.cdt.debug.core.cdi.ICDIBreakpoint#isEnabled()
|
* @see org.eclipse.cdt.debug.core.cdi.ICDIBreakpoint#isEnabled()
|
||||||
*/
|
*/
|
||||||
public boolean isEnabled() throws CDIException {
|
public boolean isEnabled() throws CDIException {
|
||||||
return miBreakpoint.isEnabled();
|
if (miBreakpoint != null)
|
||||||
|
return miBreakpoint.isEnabled();
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see org.eclipse.cdt.debug.core.cdi.ICDIBreakpoint#isHardware()
|
* @see org.eclipse.cdt.debug.core.cdi.ICDIBreakpoint#isHardware()
|
||||||
*/
|
*/
|
||||||
public boolean isHardware() {
|
public boolean isHardware() {
|
||||||
return miBreakpoint.isHardware();
|
if (miBreakpoint != null)
|
||||||
|
return miBreakpoint.isHardware();
|
||||||
|
return (type == ICDIBreakpoint.HARDWARE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see org.eclipse.cdt.debug.core.cdi.ICDIBreakpoint#isTemporary()
|
* @see org.eclipse.cdt.debug.core.cdi.ICDIBreakpoint#isTemporary()
|
||||||
*/
|
*/
|
||||||
public boolean isTemporary() {
|
public boolean isTemporary() {
|
||||||
return miBreakpoint.isTemporary();
|
if (miBreakpoint != null)
|
||||||
|
return miBreakpoint.isTemporary();
|
||||||
|
return (type == ICDIBreakpoint.TEMPORARY);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -104,11 +128,16 @@ public class Breakpoint extends CObject implements ICDILocationBreakpoint {
|
||||||
*/
|
*/
|
||||||
public ICDILocation getLocation() throws CDIException {
|
public ICDILocation getLocation() throws CDIException {
|
||||||
if (location == null) {
|
if (location == null) {
|
||||||
location = new Location (miBreakpoint.getFile(),
|
if (miBreakpoint != null)
|
||||||
|
location = new Location (miBreakpoint.getFile(),
|
||||||
miBreakpoint.getFunction(),
|
miBreakpoint.getFunction(),
|
||||||
miBreakpoint.getLine(),
|
miBreakpoint.getLine(),
|
||||||
miBreakpoint.getAddress());
|
miBreakpoint.getAddress());
|
||||||
}
|
}
|
||||||
return location;
|
return location;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setLocation(ICDILocation loc) {
|
||||||
|
location = loc;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -58,7 +58,7 @@ public class StackFrame extends CObject implements ICDIStackFrame {
|
||||||
level = l;
|
level = l;
|
||||||
}
|
}
|
||||||
|
|
||||||
MIFrame getMIFrame() {
|
public MIFrame getMIFrame() {
|
||||||
return frame;
|
return frame;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -40,7 +40,7 @@ public class Thread extends CObject implements ICDIThread {
|
||||||
id = threadId;
|
id = threadId;
|
||||||
}
|
}
|
||||||
|
|
||||||
int getId() {
|
public int getId() {
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -53,6 +53,13 @@ public class Thread extends CObject implements ICDIThread {
|
||||||
return Integer.toString(id);
|
return Integer.toString(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void updateState() {
|
||||||
|
try {
|
||||||
|
getCurrentStackFrame();
|
||||||
|
} catch (CDIException e) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public ICDIStackFrame getCurrentStackFrame() throws CDIException {
|
public ICDIStackFrame getCurrentStackFrame() throws CDIException {
|
||||||
if (currentFrame == null) {
|
if (currentFrame == null) {
|
||||||
ICDIStackFrame[] frames = getStackFrames(0, 0);
|
ICDIStackFrame[] frames = getStackFrames(0, 0);
|
||||||
|
|
|
@ -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.CDIException;
|
import org.eclipse.cdt.debug.core.cdi.CDIException;
|
||||||
|
import org.eclipse.cdt.debug.core.cdi.ICDICondition;
|
||||||
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.cdi.BreakpointManager;
|
import org.eclipse.cdt.debug.mi.core.cdi.BreakpointManager;
|
||||||
import org.eclipse.cdt.debug.mi.core.output.MIBreakpoint;
|
import org.eclipse.cdt.debug.mi.core.output.MIBreakpoint;
|
||||||
|
@ -14,6 +15,15 @@ import org.eclipse.cdt.debug.mi.core.output.MIBreakpoint;
|
||||||
*/
|
*/
|
||||||
public class Watchpoint extends Breakpoint implements ICDIWatchpoint {
|
public class Watchpoint extends Breakpoint implements ICDIWatchpoint {
|
||||||
|
|
||||||
|
int watchType;
|
||||||
|
String what;
|
||||||
|
|
||||||
|
public Watchpoint(BreakpointManager m, String expression, int type, int wType, ICDICondition cond) {
|
||||||
|
super(m, type, null, cond, "");
|
||||||
|
watchType = wType;
|
||||||
|
what = expression;
|
||||||
|
}
|
||||||
|
|
||||||
public Watchpoint(BreakpointManager m, MIBreakpoint miBreak) {
|
public Watchpoint(BreakpointManager m, MIBreakpoint miBreak) {
|
||||||
super(m, miBreak);
|
super(m, miBreak);
|
||||||
}
|
}
|
||||||
|
@ -22,21 +32,30 @@ public class Watchpoint extends Breakpoint implements ICDIWatchpoint {
|
||||||
* @see org.eclipse.cdt.debug.core.cdi.ICDIWatchpoint#getWatchExpression()
|
* @see org.eclipse.cdt.debug.core.cdi.ICDIWatchpoint#getWatchExpression()
|
||||||
*/
|
*/
|
||||||
public String getWatchExpression() throws CDIException {
|
public String getWatchExpression() throws CDIException {
|
||||||
return getMIBreakpoint().getWhat();
|
MIBreakpoint miPoint = getMIBreakpoint();
|
||||||
|
if (miPoint != null)
|
||||||
|
return getMIBreakpoint().getWhat();
|
||||||
|
return what;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see org.eclipse.cdt.debug.core.cdi.ICDIWatchpoint#isReadType()
|
* @see org.eclipse.cdt.debug.core.cdi.ICDIWatchpoint#isReadType()
|
||||||
*/
|
*/
|
||||||
public boolean isReadType() {
|
public boolean isReadType() {
|
||||||
return getMIBreakpoint().isReadWatchpoint() || getMIBreakpoint().isAccessWatchpoint();
|
MIBreakpoint miPoint = getMIBreakpoint();
|
||||||
|
if (miPoint != null)
|
||||||
|
return getMIBreakpoint().isReadWatchpoint() || getMIBreakpoint().isAccessWatchpoint();
|
||||||
|
return ((watchType & ICDIWatchpoint.READ) == ICDIWatchpoint.READ);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see org.eclipse.cdt.debug.core.cdi.ICDIWatchpoint#isWriteType()
|
* @see org.eclipse.cdt.debug.core.cdi.ICDIWatchpoint#isWriteType()
|
||||||
*/
|
*/
|
||||||
public boolean isWriteType() {
|
public boolean isWriteType() {
|
||||||
return getMIBreakpoint().isAccessWatchpoint() || getMIBreakpoint().isWriteWatchpoint();
|
MIBreakpoint miPoint = getMIBreakpoint();
|
||||||
|
if (miPoint != null)
|
||||||
|
return getMIBreakpoint().isAccessWatchpoint() || getMIBreakpoint().isWriteWatchpoint();
|
||||||
|
return ((watchType & ICDIWatchpoint.WRITE) == ICDIWatchpoint.WRITE);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,6 +20,7 @@ public class MIRunningEvent extends MIEvent {
|
||||||
public static final int STEPI = 4;
|
public static final int STEPI = 4;
|
||||||
public static final int FINISH = 5;
|
public static final int FINISH = 5;
|
||||||
public static final int UNTIL = 6;
|
public static final int UNTIL = 6;
|
||||||
|
public static final int RETURN = 7;
|
||||||
|
|
||||||
int type;
|
int type;
|
||||||
|
|
||||||
|
|
|
@ -72,6 +72,10 @@ public class MIBreakpoint {
|
||||||
return number;
|
return number;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setNumber(int num) {
|
||||||
|
number = num;
|
||||||
|
}
|
||||||
|
|
||||||
public String getType() {
|
public String getType() {
|
||||||
return type;
|
return type;
|
||||||
}
|
}
|
||||||
|
@ -84,7 +88,7 @@ public class MIBreakpoint {
|
||||||
return isWpt;
|
return isWpt;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setWatcpoint(boolean w) {
|
public void setWatchpoint(boolean w) {
|
||||||
isWpt = w;
|
isWpt = w;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue