mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-07 17:56:01 +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
|
2004-11-19 Alain Magloire
|
||||||
Use the qualified name when creating a register.
|
Use the qualified name when creating a register.
|
||||||
Destroy the corresponding gdb variable on register's disposal.
|
Destroy the corresponding gdb variable on register's disposal.
|
||||||
|
|
|
@ -253,16 +253,6 @@ public class RegisterManager extends Manager {
|
||||||
return new Register[0];
|
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.
|
* Return the Element with this thread/stackframe, and with this name.
|
||||||
* null is return if the element is not in the cache.
|
* 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 {
|
public String getTypeNameFromVariable(StackFrame frame, String variable) throws CDIException {
|
||||||
Target target = (Target)frame.getTarget();
|
Target target = (Target)frame.getTarget();
|
||||||
Thread currentThread = null;
|
Thread currentThread = (Thread)target.getCurrentThread();
|
||||||
StackFrame currentFrame = null;
|
StackFrame currentFrame = currentThread.getCurrentStackFrame();
|
||||||
if (frame != null) {
|
target.setCurrentThread(frame.getThread(), false);
|
||||||
currentThread = (Thread)target.getCurrentThread();
|
((Thread)frame.getThread()).setCurrentStackFrame(frame, false);
|
||||||
currentFrame = currentThread.getCurrentStackFrame();
|
try {
|
||||||
target.setCurrentThread(frame.getThread(), false);
|
return getTypeName(target, variable);
|
||||||
((Thread)frame.getThread()).setCurrentStackFrame(frame, false);
|
} finally {
|
||||||
|
target.setCurrentThread(currentThread, false);
|
||||||
|
currentThread.setCurrentStackFrame(currentFrame, false);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTypeName(Target target, String variable) throws CDIException {
|
||||||
try {
|
try {
|
||||||
MISession mi = target.getMISession();
|
MISession mi = target.getMISession();
|
||||||
CommandFactory factory = mi.getCommandFactory();
|
CommandFactory factory = mi.getCommandFactory();
|
||||||
|
@ -449,13 +454,6 @@ public class SourceManager extends Manager {
|
||||||
return info.getType();
|
return info.getType();
|
||||||
} catch (MIException e) {
|
} catch (MIException e) {
|
||||||
throw new MI2CDIException(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();
|
Session session = (Session) target.getSession();
|
||||||
SourceManager sourceMgr = session.getSourceManager();
|
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;
|
return fTypename;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue