1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-06-05 16:56:04 +02:00

2004-11-19 Alain Magloire

Protect agains possible NPE.
	* cdi/org/eclipse/cdt/debug/mi/core/cdi/RegisterManager.java
	* cdi/org/eclipse/cdt/debug/mi/core/cdi/SourceManager.java
	* cdi/org/eclipse/cdt/debug/mi/core/cdi/model/VariableDescriptor.java
This commit is contained in:
Alain Magloire 2004-11-20 04:25:17 +00:00
parent 2c296b89c0
commit b488499fcc
4 changed files with 23 additions and 25 deletions

View file

@ -1,3 +1,9 @@
2004-11-19 Alain Magloire
Protect agains possible NPE.
* cdi/org/eclipse/cdt/debug/mi/core/cdi/RegisterManager.java
* cdi/org/eclipse/cdt/debug/mi/core/cdi/SourceManager.java
* cdi/org/eclipse/cdt/debug/mi/core/cdi/model/VariableDescriptor.java
2004-11-19 Alain Magloire
Use the qualified name when creating a register.
Destroy the corresponding gdb variable on register's disposal.

View file

@ -253,16 +253,6 @@ public class RegisterManager extends Manager {
return new Register[0];
}
// private Register getRegister(RegisterDescriptor regDesc) throws CDIException {
// Register[] regs = getRegisters((Target)regDesc.getTarget());
// for (int i = 0; i < regs.length; i++) {
// if (regDesc.getName().equals(regs[i].getName())) {
// return regs[i];
// }
// }
// return null;
// }
/**
* Return the Element with this thread/stackframe, and with this name.
* null is return if the element is not in the cache.

View file

@ -429,14 +429,19 @@ public class SourceManager extends Manager {
public String getTypeNameFromVariable(StackFrame frame, String variable) throws CDIException {
Target target = (Target)frame.getTarget();
Thread currentThread = null;
StackFrame currentFrame = null;
if (frame != null) {
currentThread = (Thread)target.getCurrentThread();
currentFrame = currentThread.getCurrentStackFrame();
target.setCurrentThread(frame.getThread(), false);
((Thread)frame.getThread()).setCurrentStackFrame(frame, false);
Thread currentThread = (Thread)target.getCurrentThread();
StackFrame currentFrame = currentThread.getCurrentStackFrame();
target.setCurrentThread(frame.getThread(), false);
((Thread)frame.getThread()).setCurrentStackFrame(frame, false);
try {
return getTypeName(target, variable);
} finally {
target.setCurrentThread(currentThread, false);
currentThread.setCurrentStackFrame(currentFrame, false);
}
}
public String getTypeName(Target target, String variable) throws CDIException {
try {
MISession mi = target.getMISession();
CommandFactory factory = mi.getCommandFactory();
@ -449,13 +454,6 @@ public class SourceManager extends Manager {
return info.getType();
} catch (MIException e) {
throw new MI2CDIException(e);
} finally {
if (currentThread != null) {
target.setCurrentThread(currentThread, false);
}
if (currentFrame != null) {
currentThread.setCurrentStackFrame(currentFrame, false);
}
}
}

View file

@ -284,7 +284,11 @@ public abstract class VariableDescriptor extends CObject implements ICDIVariable
}
Session session = (Session) target.getSession();
SourceManager sourceMgr = session.getSourceManager();
fTypename = sourceMgr.getTypeNameFromVariable(frame, getQualifiedName());
if (frame != null) {
fTypename = sourceMgr.getTypeNameFromVariable(frame, getQualifiedName());
} else {
fTypename = sourceMgr.getTypeName(target, getQualifiedName());
}
}
return fTypename;
}