mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-23 14:42:11 +02:00
Bug 215553 - patch for Alena - ensure the target is released in exception scenarios.
This commit is contained in:
parent
0d547afec5
commit
d1561de41d
5 changed files with 68 additions and 37 deletions
|
@ -203,9 +203,12 @@ public class ExpressionManager extends Manager {
|
|||
} catch (MIException e) {
|
||||
throw new MI2CDIException(e);
|
||||
} finally {
|
||||
target.setCurrentThread(currentThread, false);
|
||||
currentThread.setCurrentStackFrame(currentFrame, false);
|
||||
target.releaseTarget();
|
||||
try {
|
||||
target.setCurrentThread(currentThread, false);
|
||||
currentThread.setCurrentStackFrame(currentFrame, false);
|
||||
} finally {
|
||||
target.releaseTarget();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -430,9 +430,12 @@ public class SourceManager extends Manager {
|
|||
((Thread)frame.getThread()).setCurrentStackFrame(frame, false);
|
||||
return getDetailTypeName(target, variable);
|
||||
} finally {
|
||||
target.setCurrentThread(currentThread, false);
|
||||
currentThread.setCurrentStackFrame(currentFrame, false);
|
||||
target.releaseTarget();
|
||||
try {
|
||||
target.setCurrentThread(currentThread, false);
|
||||
currentThread.setCurrentStackFrame(currentFrame, false);
|
||||
} finally {
|
||||
target.releaseTarget();
|
||||
}
|
||||
}
|
||||
}
|
||||
public String getDetailTypeName(Target target, String typename) throws CDIException {
|
||||
|
@ -468,9 +471,12 @@ public class SourceManager extends Manager {
|
|||
((Thread)frame.getThread()).setCurrentStackFrame(frame, false);
|
||||
return getTypeName(target, variable);
|
||||
} finally {
|
||||
target.setCurrentThread(currentThread, false);
|
||||
currentThread.setCurrentStackFrame(currentFrame, false);
|
||||
target.releaseTarget();
|
||||
try {
|
||||
target.setCurrentThread(currentThread, false);
|
||||
currentThread.setCurrentStackFrame(currentFrame, false);
|
||||
} finally {
|
||||
target.releaseTarget();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -192,12 +192,15 @@ public class VariableManager extends Manager {
|
|||
} catch (MIException e) {
|
||||
throw new MI2CDIException(e);
|
||||
} finally {
|
||||
MISession miSession = target.getMISession();
|
||||
RxThread rxThread = miSession.getRxThread();
|
||||
rxThread.setEnableConsole(true);
|
||||
target.setCurrentThread(currentThread, false);
|
||||
currentThread.setCurrentStackFrame(currentFrame, false);
|
||||
target.releaseTarget();
|
||||
try {
|
||||
MISession miSession = target.getMISession();
|
||||
RxThread rxThread = miSession.getRxThread();
|
||||
rxThread.setEnableConsole(true);
|
||||
target.setCurrentThread(currentThread, false);
|
||||
currentThread.setCurrentStackFrame(currentFrame, false);
|
||||
} finally {
|
||||
target.releaseTarget();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
throw new CDIException(CdiResources.getString("cdi.VariableManager.Unknown_type")); //$NON-NLS-1$
|
||||
|
@ -389,9 +392,12 @@ public class VariableManager extends Manager {
|
|||
} catch (MIException e) {
|
||||
throw new MI2CDIException(e);
|
||||
} finally {
|
||||
target.setCurrentThread(currentThread, false);
|
||||
currentThread.setCurrentStackFrame(currentFrame, false);
|
||||
target.releaseTarget();
|
||||
try {
|
||||
target.setCurrentThread(currentThread, false);
|
||||
currentThread.setCurrentStackFrame(currentFrame, false);
|
||||
} finally {
|
||||
target.releaseTarget();
|
||||
}
|
||||
}
|
||||
}
|
||||
return argument;
|
||||
|
@ -432,9 +438,12 @@ public class VariableManager extends Manager {
|
|||
} catch (MIException e) {
|
||||
throw new MI2CDIException(e);
|
||||
} finally {
|
||||
target.setCurrentThread(currentThread, false);
|
||||
currentThread.setCurrentStackFrame(currentFrame, false);
|
||||
target.releaseTarget();
|
||||
try {
|
||||
target.setCurrentThread(currentThread, false);
|
||||
currentThread.setCurrentStackFrame(currentFrame, false);
|
||||
} finally {
|
||||
target.releaseTarget();
|
||||
}
|
||||
}
|
||||
return (ICDIArgumentDescriptor[]) argObjects.toArray(new ICDIArgumentDescriptor[0]);
|
||||
}
|
||||
|
@ -519,9 +528,12 @@ public class VariableManager extends Manager {
|
|||
} catch (MIException e) {
|
||||
throw new MI2CDIException(e);
|
||||
} finally {
|
||||
target.setCurrentThread(currentThread, false);
|
||||
currentThread.setCurrentStackFrame(currentFrame, false);
|
||||
target.releaseTarget();
|
||||
try {
|
||||
target.setCurrentThread(currentThread, false);
|
||||
currentThread.setCurrentStackFrame(currentFrame, false);
|
||||
} finally {
|
||||
target.releaseTarget();
|
||||
}
|
||||
}
|
||||
return (ICDILocalVariableDescriptor[]) varObjects.toArray(new ICDILocalVariableDescriptor[0]);
|
||||
}
|
||||
|
@ -558,9 +570,12 @@ public class VariableManager extends Manager {
|
|||
} catch (MIException e) {
|
||||
throw new MI2CDIException(e);
|
||||
} finally {
|
||||
target.setCurrentThread(currentThread, false);
|
||||
currentThread.setCurrentStackFrame(currentFrame, false);
|
||||
target.releaseTarget();
|
||||
try {
|
||||
target.setCurrentThread(currentThread, false);
|
||||
currentThread.setCurrentStackFrame(currentFrame, false);
|
||||
} finally {
|
||||
target.releaseTarget();
|
||||
}
|
||||
}
|
||||
}
|
||||
return local;
|
||||
|
|
|
@ -272,15 +272,15 @@ public class Target extends SessionObject implements ICDITarget, ICDIBreakpointM
|
|||
// will be overwritten. However if we use -stack-list-threads
|
||||
// it does not provide to the current thread
|
||||
lockTarget();
|
||||
currentThreadId = newThreadId;
|
||||
|
||||
// get the new Threads.
|
||||
try {
|
||||
// get the new Threads.
|
||||
currentThreadId = newThreadId;
|
||||
currentThreads = getCThreads();
|
||||
} catch (CDIException e) {
|
||||
currentThreads = noThreads;
|
||||
} finally {
|
||||
releaseTarget();
|
||||
}
|
||||
releaseTarget();
|
||||
|
||||
// Fire CreatedEvent for new threads.
|
||||
// Replace the new threads with the old thread object
|
||||
|
|
|
@ -131,8 +131,11 @@ public class Thread extends CObject implements ICDIThread {
|
|||
//throw e;
|
||||
//System.out.println(e);
|
||||
} finally {
|
||||
target.setCurrentThread(currentThread, false);
|
||||
target.releaseTarget();
|
||||
try {
|
||||
target.setCurrentThread(currentThread, false);
|
||||
} finally {
|
||||
target.releaseTarget();
|
||||
}
|
||||
}
|
||||
// assign the currentFrame if it was not done yet.
|
||||
if (currentFrame == null) {
|
||||
|
@ -187,12 +190,13 @@ public class Thread extends CObject implements ICDIThread {
|
|||
throw new MI2CDIException(e);
|
||||
} finally {
|
||||
try {
|
||||
target.setCurrentThread(currentThread, false);
|
||||
target.setCurrentThread(currentThread, false);
|
||||
} catch (MI2CDIException e) {
|
||||
target.releaseTarget();
|
||||
throw e;
|
||||
} finally {
|
||||
target.releaseTarget();
|
||||
}
|
||||
target.releaseTarget();
|
||||
}
|
||||
}
|
||||
return stackdepth;
|
||||
|
@ -239,8 +243,11 @@ public class Thread extends CObject implements ICDIThread {
|
|||
//throw e;
|
||||
//System.out.println(e);
|
||||
} finally {
|
||||
target.setCurrentThread(currentThread, false);
|
||||
target.releaseTarget();
|
||||
try {
|
||||
target.setCurrentThread(currentThread, false);
|
||||
} finally {
|
||||
target.releaseTarget();
|
||||
}
|
||||
}
|
||||
// take time to assign the currentFrame, if it is in the set
|
||||
if (currentFrame == null) {
|
||||
|
|
Loading…
Add table
Reference in a new issue