mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-05 07:15:39 +02:00
2004-11-26 Alain Magloire
Final fix for PR 79583 * cdi/org/eclipose/cdt/debug/mi/core/cdi/EventManager.java * cdi/org/eclipose/cdt/debug/mi/core/cdi/SharedLibraryManager.java
This commit is contained in:
parent
5d40a76f55
commit
3264997df6
3 changed files with 46 additions and 43 deletions
|
@ -1,3 +1,8 @@
|
||||||
|
2004-11-26 Alain Magloire
|
||||||
|
Final fix for PR 79583
|
||||||
|
* cdi/org/eclipose/cdt/debug/mi/core/cdi/EventManager.java
|
||||||
|
* cdi/org/eclipose/cdt/debug/mi/core/cdi/SharedLibraryManager.java
|
||||||
|
|
||||||
2004-11-26 Alain Magloire
|
2004-11-26 Alain Magloire
|
||||||
Final fix for PR 79452
|
Final fix for PR 79452
|
||||||
* cdi/org/eclipose/cdt/debug/mi/core/cdi/BreapointManager.java
|
* cdi/org/eclipose/cdt/debug/mi/core/cdi/BreapointManager.java
|
||||||
|
|
|
@ -21,7 +21,6 @@ import org.eclipse.cdt.debug.core.cdi.CDIException;
|
||||||
import org.eclipse.cdt.debug.core.cdi.ICDIEventManager;
|
import org.eclipse.cdt.debug.core.cdi.ICDIEventManager;
|
||||||
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.ICDIStackFrame;
|
||||||
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;
|
||||||
|
@ -33,7 +32,6 @@ 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.cdi.model.Thread;
|
||||||
|
@ -72,7 +70,6 @@ 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.MIBreakpoint;
|
|
||||||
import org.eclipse.cdt.debug.mi.core.output.MIInfo;
|
import org.eclipse.cdt.debug.mi.core.output.MIInfo;
|
||||||
import org.eclipse.cdt.debug.mi.core.output.MIStackInfoDepthInfo;
|
import org.eclipse.cdt.debug.mi.core.output.MIStackInfoDepthInfo;
|
||||||
|
|
||||||
|
@ -370,45 +367,9 @@ public class EventManager extends SessionObject implements ICDIEventManager, Obs
|
||||||
if (mgr.isDeferredBreakpoint()) {
|
if (mgr.isDeferredBreakpoint()) {
|
||||||
if (stopped instanceof MISharedLibEvent) {
|
if (stopped instanceof MISharedLibEvent) {
|
||||||
// Check if we have a new library loaded
|
// Check if we have a new library loaded
|
||||||
List eventList = null;
|
|
||||||
try {
|
try {
|
||||||
eventList = mgr.updateState(currentTarget);
|
mgr.update(currentTarget);
|
||||||
} catch (CDIException e3) {
|
} catch (CDIException e3) {
|
||||||
eventList = Collections.EMPTY_LIST;
|
|
||||||
}
|
|
||||||
// A new Libraries loaded, try to set the breakpoints.
|
|
||||||
if (eventList.size() > 0) {
|
|
||||||
BreakpointManager bpMgr = session.getBreakpointManager();
|
|
||||||
ICDIBreakpoint bpoints[] = null;
|
|
||||||
try {
|
|
||||||
bpoints = bpMgr.getDeferredBreakpoints(currentTarget);
|
|
||||||
} 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 {
|
|
||||||
boolean enable = bkpt.isEnabled();
|
|
||||||
bpMgr.setLocationBreakpoint(bkpt);
|
|
||||||
bpMgr.deleteFromDeferredList(bkpt);
|
|
||||||
bpMgr.addToBreakpointList(bkpt);
|
|
||||||
// If the breakpoint was disable in the IDE
|
|
||||||
// install it but keep it disable
|
|
||||||
if (!enable) {
|
|
||||||
bpMgr.disableBreakpoint(bkpt);
|
|
||||||
}
|
|
||||||
MIBreakpoint[] miBreakpoints = bkpt.getMIBreakpoints();
|
|
||||||
if (miBreakpoints != null && miBreakpoints.length > 0) {
|
|
||||||
eventList.add(new MIBreakpointCreatedEvent(miSession, miBreakpoints[0].getNumber()));
|
|
||||||
}
|
|
||||||
} catch (CDIException e) {
|
|
||||||
// ignore
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
MIEvent[] events = (MIEvent[])eventList.toArray(new MIEvent[0]);
|
|
||||||
miSession.fireEvents(events);
|
|
||||||
}
|
}
|
||||||
CommandFactory factory = miSession.getCommandFactory();
|
CommandFactory factory = miSession.getCommandFactory();
|
||||||
int type = (lastRunningEvent == null) ? MIRunningEvent.CONTINUE : lastRunningEvent.getType();
|
int type = (lastRunningEvent == null) ? MIRunningEvent.CONTINUE : lastRunningEvent.getType();
|
||||||
|
|
|
@ -18,6 +18,7 @@ import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.eclipse.cdt.debug.core.cdi.CDIException;
|
import org.eclipse.cdt.debug.core.cdi.CDIException;
|
||||||
|
import org.eclipse.cdt.debug.core.cdi.model.ICDIBreakpoint;
|
||||||
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.ICDITargetConfiguration;
|
import org.eclipse.cdt.debug.core.cdi.model.ICDITargetConfiguration;
|
||||||
import org.eclipse.cdt.debug.mi.core.IMIConstants;
|
import org.eclipse.cdt.debug.mi.core.IMIConstants;
|
||||||
|
@ -25,6 +26,7 @@ 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.MIPlugin;
|
import org.eclipse.cdt.debug.mi.core.MIPlugin;
|
||||||
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.SharedLibrary;
|
import org.eclipse.cdt.debug.mi.core.cdi.model.SharedLibrary;
|
||||||
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.command.CommandFactory;
|
import org.eclipse.cdt.debug.mi.core.command.CommandFactory;
|
||||||
|
@ -35,10 +37,12 @@ import org.eclipse.cdt.debug.mi.core.command.MIGDBShow;
|
||||||
import org.eclipse.cdt.debug.mi.core.command.MIGDBShowSolibSearchPath;
|
import org.eclipse.cdt.debug.mi.core.command.MIGDBShowSolibSearchPath;
|
||||||
import org.eclipse.cdt.debug.mi.core.command.MIInfoSharedLibrary;
|
import org.eclipse.cdt.debug.mi.core.command.MIInfoSharedLibrary;
|
||||||
import org.eclipse.cdt.debug.mi.core.command.MISharedLibrary;
|
import org.eclipse.cdt.debug.mi.core.command.MISharedLibrary;
|
||||||
|
import org.eclipse.cdt.debug.mi.core.event.MIBreakpointCreatedEvent;
|
||||||
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.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.MISharedLibUnloadedEvent;
|
import org.eclipse.cdt.debug.mi.core.event.MISharedLibUnloadedEvent;
|
||||||
|
import org.eclipse.cdt.debug.mi.core.output.MIBreakpoint;
|
||||||
import org.eclipse.cdt.debug.mi.core.output.MIGDBShowInfo;
|
import org.eclipse.cdt.debug.mi.core.output.MIGDBShowInfo;
|
||||||
import org.eclipse.cdt.debug.mi.core.output.MIGDBShowSolibSearchPathInfo;
|
import org.eclipse.cdt.debug.mi.core.output.MIGDBShowSolibSearchPathInfo;
|
||||||
import org.eclipse.cdt.debug.mi.core.output.MIInfo;
|
import org.eclipse.cdt.debug.mi.core.output.MIInfo;
|
||||||
|
@ -87,13 +91,46 @@ public class SharedLibraryManager extends Manager {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void update(Target target) throws CDIException {
|
public void update(Target target) throws CDIException {
|
||||||
MISession mi = target.getMISession();
|
MISession miSession = target.getMISession();
|
||||||
|
Session session = (Session)target.getSession();
|
||||||
List eventList = updateState(target);
|
List eventList = updateState(target);
|
||||||
|
// A new Libraries loaded or something change, try to set the breakpoints.
|
||||||
|
if (eventList.size() > 0) {
|
||||||
|
BreakpointManager bpMgr = session.getBreakpointManager();
|
||||||
|
ICDIBreakpoint bpoints[] = null;
|
||||||
|
try {
|
||||||
|
bpoints = bpMgr.getDeferredBreakpoints(target);
|
||||||
|
} 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 {
|
||||||
|
boolean enable = bkpt.isEnabled();
|
||||||
|
bpMgr.setLocationBreakpoint(bkpt);
|
||||||
|
bpMgr.deleteFromDeferredList(bkpt);
|
||||||
|
bpMgr.addToBreakpointList(bkpt);
|
||||||
|
// If the breakpoint was disable in the IDE
|
||||||
|
// install it but keep it disable
|
||||||
|
if (!enable) {
|
||||||
|
bpMgr.disableBreakpoint(bkpt);
|
||||||
|
}
|
||||||
|
MIBreakpoint[] miBreakpoints = bkpt.getMIBreakpoints();
|
||||||
|
if (miBreakpoints != null && miBreakpoints.length > 0) {
|
||||||
|
eventList.add(new MIBreakpointCreatedEvent(miSession, miBreakpoints[0].getNumber()));
|
||||||
|
}
|
||||||
|
} catch (CDIException e) {
|
||||||
|
// ignore
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
MIEvent[] events = (MIEvent[])eventList.toArray(new MIEvent[0]);
|
MIEvent[] events = (MIEvent[])eventList.toArray(new MIEvent[0]);
|
||||||
mi.fireEvents(events);
|
miSession.fireEvents(events);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List updateState(Target target) throws CDIException {
|
private List updateState(Target target) throws CDIException {
|
||||||
MISession miSession = target.getMISession();
|
MISession miSession = target.getMISession();
|
||||||
ICDITargetConfiguration conf = target.getConfiguration();
|
ICDITargetConfiguration conf = target.getConfiguration();
|
||||||
if (!conf.supportsSharedLibrary()) {
|
if (!conf.supportsSharedLibrary()) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue