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:
parent
2c296b89c0
commit
b488499fcc
4 changed files with 23 additions and 25 deletions
|
@ -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.
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue