mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-09-02 13:13:36 +02:00
reimplement getRegister()
This commit is contained in:
parent
ec0c3f13bd
commit
1dbcbfd908
1 changed files with 21 additions and 6 deletions
|
@ -24,6 +24,7 @@ import org.eclipse.cdt.debug.mi.core.command.MIVarCreate;
|
||||||
import org.eclipse.cdt.debug.mi.core.command.MIVarUpdate;
|
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.MIRegisterChangedEvent;
|
import org.eclipse.cdt.debug.mi.core.event.MIRegisterChangedEvent;
|
||||||
|
import org.eclipse.cdt.debug.mi.core.event.MIVarChangedEvent;
|
||||||
import org.eclipse.cdt.debug.mi.core.output.MIDataListChangedRegistersInfo;
|
import org.eclipse.cdt.debug.mi.core.output.MIDataListChangedRegistersInfo;
|
||||||
import org.eclipse.cdt.debug.mi.core.output.MIDataListRegisterNamesInfo;
|
import org.eclipse.cdt.debug.mi.core.output.MIDataListRegisterNamesInfo;
|
||||||
import org.eclipse.cdt.debug.mi.core.output.MIVar;
|
import org.eclipse.cdt.debug.mi.core.output.MIVar;
|
||||||
|
@ -136,12 +137,19 @@ public class RegisterManager extends SessionObject implements ICDIRegisterManage
|
||||||
/**
|
/**
|
||||||
* Use by the eventManager to find the Register;
|
* Use by the eventManager to find the Register;
|
||||||
*/
|
*/
|
||||||
public Register getRegister(String name) throws CDIException {
|
public Register getRegister(String varName) {
|
||||||
Register[] regs = getRegisters();
|
Register[] regs = getRegisters();
|
||||||
for (int i = 0; i < regs.length; i++) {
|
for (int i = 0; i < regs.length; i++) {
|
||||||
if (regs[i].getName().equals(name)) {
|
if (regs[i].getMIVar().getVarName().equals(varName)) {
|
||||||
return regs[i];
|
return regs[i];
|
||||||
}
|
}
|
||||||
|
try {
|
||||||
|
Register r = (Register)regs[i].getChild(varName);
|
||||||
|
if (r != null) {
|
||||||
|
return r;
|
||||||
|
}
|
||||||
|
} catch (ClassCastException e) {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -149,7 +157,7 @@ public class RegisterManager extends SessionObject implements ICDIRegisterManage
|
||||||
/**
|
/**
|
||||||
* Use by the eventManager to find the Register;
|
* Use by the eventManager to find the Register;
|
||||||
*/
|
*/
|
||||||
public Register getRegister(int regno) throws CDIException {
|
public Register getRegister(int regno) {
|
||||||
Register[] regs = getRegisters();
|
Register[] regs = getRegisters();
|
||||||
for (int i = 0; i < regs.length; i++) {
|
for (int i = 0; i < regs.length; i++) {
|
||||||
if (regs[i].getVariableObject().getPosition() == regno) {
|
if (regs[i].getVariableObject().getPosition() == regno) {
|
||||||
|
@ -158,6 +166,7 @@ public class RegisterManager extends SessionObject implements ICDIRegisterManage
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Call the by the EventManager when the target is suspended.
|
* Call the by the EventManager when the target is suspended.
|
||||||
*/
|
*/
|
||||||
|
@ -195,10 +204,16 @@ public class RegisterManager extends SessionObject implements ICDIRegisterManage
|
||||||
//throw new MI2CDIException(e);
|
//throw new MI2CDIException(e);
|
||||||
//eventList.add(new MIVarDeletedEvent(varName));
|
//eventList.add(new MIVarDeletedEvent(varName));
|
||||||
}
|
}
|
||||||
for (int j = 0 ; j < changes.length; j++) {
|
if (changes.length != 0) {
|
||||||
if (changes[j].isInScope()) {
|
for (int j = 0 ; j < changes.length; j++) {
|
||||||
eventList.add(new MIRegisterChangedEvent(update.getToken(), reg.getName(), regnos[i]));
|
String n = changes[j].getVarName();
|
||||||
|
if (changes[j].isInScope()) {
|
||||||
|
eventList.add(new MIVarChangedEvent(n));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
// Fall back to the register number.
|
||||||
|
eventList.add(new MIRegisterChangedEvent(update.getToken(), reg.getName(), regnos[i]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue