mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-23 22:52:11 +02:00
Check for register also and cleanup
This commit is contained in:
parent
7b9a6f5d07
commit
0728b66c10
2 changed files with 30 additions and 51 deletions
|
@ -4,7 +4,6 @@
|
|||
*/
|
||||
package org.eclipse.cdt.debug.mi.core.cdi.event;
|
||||
|
||||
import org.eclipse.cdt.debug.core.cdi.CDIException;
|
||||
import org.eclipse.cdt.debug.core.cdi.event.ICDIChangedEvent;
|
||||
import org.eclipse.cdt.debug.core.cdi.model.ICDIBreakpoint;
|
||||
import org.eclipse.cdt.debug.core.cdi.model.ICDIObject;
|
||||
|
@ -18,8 +17,6 @@ import org.eclipse.cdt.debug.mi.core.cdi.SharedLibraryManager;
|
|||
import org.eclipse.cdt.debug.mi.core.cdi.SignalManager;
|
||||
import org.eclipse.cdt.debug.mi.core.cdi.VariableManager;
|
||||
import org.eclipse.cdt.debug.mi.core.cdi.model.CObject;
|
||||
import org.eclipse.cdt.debug.mi.core.cdi.model.Register;
|
||||
import org.eclipse.cdt.debug.mi.core.cdi.model.Variable;
|
||||
import org.eclipse.cdt.debug.mi.core.event.MIBreakpointChangedEvent;
|
||||
import org.eclipse.cdt.debug.mi.core.event.MIRegisterChangedEvent;
|
||||
import org.eclipse.cdt.debug.mi.core.event.MISharedLibChangedEvent;
|
||||
|
@ -35,19 +32,27 @@ public class ChangedEvent implements ICDIChangedEvent {
|
|||
|
||||
public ChangedEvent(Session s, MIVarChangedEvent var) {
|
||||
session = s;
|
||||
|
||||
// Try the Variable manager.
|
||||
VariableManager mgr = (VariableManager)session.getVariableManager();
|
||||
String varName = var.getVarName();
|
||||
Variable variable = mgr.getVariable(varName);
|
||||
if (variable != null) {
|
||||
source = variable;
|
||||
} else {
|
||||
source = mgr.getVariable(varName);
|
||||
|
||||
// Try the Expression manager
|
||||
if (source == null) {
|
||||
ExpressionManager expMgr = (ExpressionManager)session.getExpressionManager();
|
||||
variable = expMgr.getExpression(varName);
|
||||
if (variable != null) {
|
||||
source = variable;
|
||||
} else {
|
||||
source = new CObject(session.getCurrentTarget());
|
||||
}
|
||||
source = expMgr.getExpression(varName);
|
||||
}
|
||||
|
||||
// Try the Register manager
|
||||
if (source == null) {
|
||||
RegisterManager regMgr = (RegisterManager)session.getRegisterManager();
|
||||
source = regMgr.getRegister(varName);
|
||||
}
|
||||
|
||||
// Fall back
|
||||
if (source == null) {
|
||||
source = new CObject(session.getCurrentTarget());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -55,14 +60,8 @@ public class ChangedEvent implements ICDIChangedEvent {
|
|||
session = s;
|
||||
RegisterManager mgr = (RegisterManager)session.getRegisterManager();
|
||||
int regno = var.getNumber();
|
||||
Register reg = null;
|
||||
try {
|
||||
reg = mgr.getRegister(regno);
|
||||
} catch (CDIException e) {
|
||||
}
|
||||
if (reg != null) {
|
||||
source = reg;
|
||||
} else {
|
||||
source = mgr.getRegister(regno);
|
||||
if (source == null) {
|
||||
source = new CObject(session.getCurrentTarget());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,13 +4,9 @@
|
|||
*/
|
||||
package org.eclipse.cdt.debug.mi.core.cdi.event;
|
||||
|
||||
import org.eclipse.cdt.debug.core.cdi.CDIException;
|
||||
import org.eclipse.cdt.debug.core.cdi.event.ICDICreatedEvent;
|
||||
import org.eclipse.cdt.debug.core.cdi.model.ICDIBreakpoint;
|
||||
import org.eclipse.cdt.debug.core.cdi.model.ICDIMemoryBlock;
|
||||
import org.eclipse.cdt.debug.core.cdi.model.ICDIObject;
|
||||
import org.eclipse.cdt.debug.core.cdi.model.ICDISharedLibrary;
|
||||
import org.eclipse.cdt.debug.core.cdi.model.ICDIThread;
|
||||
import org.eclipse.cdt.debug.mi.core.cdi.BreakpointManager;
|
||||
import org.eclipse.cdt.debug.mi.core.cdi.MemoryManager;
|
||||
import org.eclipse.cdt.debug.mi.core.cdi.RegisterManager;
|
||||
|
@ -18,9 +14,7 @@ import org.eclipse.cdt.debug.mi.core.cdi.Session;
|
|||
import org.eclipse.cdt.debug.mi.core.cdi.SharedLibraryManager;
|
||||
import org.eclipse.cdt.debug.mi.core.cdi.VariableManager;
|
||||
import org.eclipse.cdt.debug.mi.core.cdi.model.CObject;
|
||||
import org.eclipse.cdt.debug.mi.core.cdi.model.Register;
|
||||
import org.eclipse.cdt.debug.mi.core.cdi.model.Target;
|
||||
import org.eclipse.cdt.debug.mi.core.cdi.model.Variable;
|
||||
import org.eclipse.cdt.debug.mi.core.event.MIBreakpointCreatedEvent;
|
||||
import org.eclipse.cdt.debug.mi.core.event.MIMemoryCreatedEvent;
|
||||
import org.eclipse.cdt.debug.mi.core.event.MIRegisterCreatedEvent;
|
||||
|
@ -39,10 +33,8 @@ public class CreatedEvent implements ICDICreatedEvent {
|
|||
session = s;
|
||||
BreakpointManager mgr = (BreakpointManager)session.getBreakpointManager();
|
||||
int number = bpoint.getNumber();
|
||||
ICDIBreakpoint breakpoint = mgr.getBreakpoint(number);
|
||||
if (breakpoint != null) {
|
||||
source = breakpoint;
|
||||
} else {
|
||||
source = mgr.getBreakpoint(number);
|
||||
if (source == null) {
|
||||
source = new CObject(session.getCurrentTarget());
|
||||
}
|
||||
}
|
||||
|
@ -51,10 +43,8 @@ public class CreatedEvent implements ICDICreatedEvent {
|
|||
session = s;
|
||||
VariableManager mgr = (VariableManager)session.getVariableManager();
|
||||
String varName = var.getVarName();
|
||||
Variable variable = mgr.getVariable(varName);
|
||||
if (variable != null) {
|
||||
source = variable;
|
||||
} else {
|
||||
source = mgr.getVariable(varName);
|
||||
if (source == null) {
|
||||
source = new CObject(session.getCurrentTarget());
|
||||
}
|
||||
}
|
||||
|
@ -63,14 +53,8 @@ public class CreatedEvent implements ICDICreatedEvent {
|
|||
session = s;
|
||||
RegisterManager mgr = (RegisterManager)session.getRegisterManager();
|
||||
int regno = var.getNumber();
|
||||
Register reg = null;
|
||||
try {
|
||||
reg = mgr.getRegister(regno);
|
||||
} catch (CDIException e) {
|
||||
}
|
||||
if (reg != null) {
|
||||
source = reg;
|
||||
} else {
|
||||
source = mgr.getRegister(regno);
|
||||
if (source == null) {
|
||||
source = new CObject(session.getCurrentTarget());
|
||||
}
|
||||
}
|
||||
|
@ -78,10 +62,8 @@ public class CreatedEvent implements ICDICreatedEvent {
|
|||
public CreatedEvent(Session s, MIThreadCreatedEvent ethread) {
|
||||
session = s;
|
||||
Target target = (Target)session.getCurrentTarget();
|
||||
ICDIThread thread = target.getThread(ethread.getId());
|
||||
if (thread != null) {
|
||||
source = thread;
|
||||
} else {
|
||||
source = target.getThread(ethread.getId());
|
||||
if (source == null) {
|
||||
source = new CObject(session.getCurrentTarget());
|
||||
}
|
||||
}
|
||||
|
@ -106,10 +88,8 @@ public class CreatedEvent implements ICDICreatedEvent {
|
|||
session = s;
|
||||
SharedLibraryManager mgr = (SharedLibraryManager)session.getSharedLibraryManager();
|
||||
String name = slib.getName();
|
||||
ICDISharedLibrary lib = mgr.getSharedLibrary(name);
|
||||
if (lib != null) {
|
||||
source = lib;
|
||||
} else {
|
||||
source = mgr.getSharedLibrary(name);
|
||||
if (source == null) {
|
||||
source = new CObject(session.getCurrentTarget());
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue