mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-08 10:16:03 +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,11 +203,14 @@ public class ExpressionManager extends Manager {
|
||||||
} catch (MIException e) {
|
} catch (MIException e) {
|
||||||
throw new MI2CDIException(e);
|
throw new MI2CDIException(e);
|
||||||
} finally {
|
} finally {
|
||||||
|
try {
|
||||||
target.setCurrentThread(currentThread, false);
|
target.setCurrentThread(currentThread, false);
|
||||||
currentThread.setCurrentStackFrame(currentFrame, false);
|
currentThread.setCurrentStackFrame(currentFrame, false);
|
||||||
|
} finally {
|
||||||
target.releaseTarget();
|
target.releaseTarget();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove variable form the maintained cache list.
|
* Remove variable form the maintained cache list.
|
||||||
|
|
|
@ -430,11 +430,14 @@ public class SourceManager extends Manager {
|
||||||
((Thread)frame.getThread()).setCurrentStackFrame(frame, false);
|
((Thread)frame.getThread()).setCurrentStackFrame(frame, false);
|
||||||
return getDetailTypeName(target, variable);
|
return getDetailTypeName(target, variable);
|
||||||
} finally {
|
} finally {
|
||||||
|
try {
|
||||||
target.setCurrentThread(currentThread, false);
|
target.setCurrentThread(currentThread, false);
|
||||||
currentThread.setCurrentStackFrame(currentFrame, false);
|
currentThread.setCurrentStackFrame(currentFrame, false);
|
||||||
|
} finally {
|
||||||
target.releaseTarget();
|
target.releaseTarget();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
public String getDetailTypeName(Target target, String typename) throws CDIException {
|
public String getDetailTypeName(Target target, String typename) throws CDIException {
|
||||||
try {
|
try {
|
||||||
MISession mi = target.getMISession();
|
MISession mi = target.getMISession();
|
||||||
|
@ -468,11 +471,14 @@ public class SourceManager extends Manager {
|
||||||
((Thread)frame.getThread()).setCurrentStackFrame(frame, false);
|
((Thread)frame.getThread()).setCurrentStackFrame(frame, false);
|
||||||
return getTypeName(target, variable);
|
return getTypeName(target, variable);
|
||||||
} finally {
|
} finally {
|
||||||
|
try {
|
||||||
target.setCurrentThread(currentThread, false);
|
target.setCurrentThread(currentThread, false);
|
||||||
currentThread.setCurrentStackFrame(currentFrame, false);
|
currentThread.setCurrentStackFrame(currentFrame, false);
|
||||||
|
} finally {
|
||||||
target.releaseTarget();
|
target.releaseTarget();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public String getTypeName(Target target, String variable) throws CDIException {
|
public String getTypeName(Target target, String variable) throws CDIException {
|
||||||
MISession miSession = target.getMISession();
|
MISession miSession = target.getMISession();
|
||||||
|
|
|
@ -192,13 +192,16 @@ public class VariableManager extends Manager {
|
||||||
} catch (MIException e) {
|
} catch (MIException e) {
|
||||||
throw new MI2CDIException(e);
|
throw new MI2CDIException(e);
|
||||||
} finally {
|
} finally {
|
||||||
|
try {
|
||||||
MISession miSession = target.getMISession();
|
MISession miSession = target.getMISession();
|
||||||
RxThread rxThread = miSession.getRxThread();
|
RxThread rxThread = miSession.getRxThread();
|
||||||
rxThread.setEnableConsole(true);
|
rxThread.setEnableConsole(true);
|
||||||
target.setCurrentThread(currentThread, false);
|
target.setCurrentThread(currentThread, false);
|
||||||
currentThread.setCurrentStackFrame(currentFrame, false);
|
currentThread.setCurrentStackFrame(currentFrame, false);
|
||||||
|
} finally {
|
||||||
target.releaseTarget();
|
target.releaseTarget();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
throw new CDIException(CdiResources.getString("cdi.VariableManager.Unknown_type")); //$NON-NLS-1$
|
throw new CDIException(CdiResources.getString("cdi.VariableManager.Unknown_type")); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
@ -389,11 +392,14 @@ public class VariableManager extends Manager {
|
||||||
} catch (MIException e) {
|
} catch (MIException e) {
|
||||||
throw new MI2CDIException(e);
|
throw new MI2CDIException(e);
|
||||||
} finally {
|
} finally {
|
||||||
|
try {
|
||||||
target.setCurrentThread(currentThread, false);
|
target.setCurrentThread(currentThread, false);
|
||||||
currentThread.setCurrentStackFrame(currentFrame, false);
|
currentThread.setCurrentStackFrame(currentFrame, false);
|
||||||
|
} finally {
|
||||||
target.releaseTarget();
|
target.releaseTarget();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return argument;
|
return argument;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -432,10 +438,13 @@ public class VariableManager extends Manager {
|
||||||
} catch (MIException e) {
|
} catch (MIException e) {
|
||||||
throw new MI2CDIException(e);
|
throw new MI2CDIException(e);
|
||||||
} finally {
|
} finally {
|
||||||
|
try {
|
||||||
target.setCurrentThread(currentThread, false);
|
target.setCurrentThread(currentThread, false);
|
||||||
currentThread.setCurrentStackFrame(currentFrame, false);
|
currentThread.setCurrentStackFrame(currentFrame, false);
|
||||||
|
} finally {
|
||||||
target.releaseTarget();
|
target.releaseTarget();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return (ICDIArgumentDescriptor[]) argObjects.toArray(new ICDIArgumentDescriptor[0]);
|
return (ICDIArgumentDescriptor[]) argObjects.toArray(new ICDIArgumentDescriptor[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -519,10 +528,13 @@ public class VariableManager extends Manager {
|
||||||
} catch (MIException e) {
|
} catch (MIException e) {
|
||||||
throw new MI2CDIException(e);
|
throw new MI2CDIException(e);
|
||||||
} finally {
|
} finally {
|
||||||
|
try {
|
||||||
target.setCurrentThread(currentThread, false);
|
target.setCurrentThread(currentThread, false);
|
||||||
currentThread.setCurrentStackFrame(currentFrame, false);
|
currentThread.setCurrentStackFrame(currentFrame, false);
|
||||||
|
} finally {
|
||||||
target.releaseTarget();
|
target.releaseTarget();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return (ICDILocalVariableDescriptor[]) varObjects.toArray(new ICDILocalVariableDescriptor[0]);
|
return (ICDILocalVariableDescriptor[]) varObjects.toArray(new ICDILocalVariableDescriptor[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -558,11 +570,14 @@ public class VariableManager extends Manager {
|
||||||
} catch (MIException e) {
|
} catch (MIException e) {
|
||||||
throw new MI2CDIException(e);
|
throw new MI2CDIException(e);
|
||||||
} finally {
|
} finally {
|
||||||
|
try {
|
||||||
target.setCurrentThread(currentThread, false);
|
target.setCurrentThread(currentThread, false);
|
||||||
currentThread.setCurrentStackFrame(currentFrame, false);
|
currentThread.setCurrentStackFrame(currentFrame, false);
|
||||||
|
} finally {
|
||||||
target.releaseTarget();
|
target.releaseTarget();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return local;
|
return local;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -272,15 +272,15 @@ public class Target extends SessionObject implements ICDITarget, ICDIBreakpointM
|
||||||
// will be overwritten. However if we use -stack-list-threads
|
// will be overwritten. However if we use -stack-list-threads
|
||||||
// it does not provide to the current thread
|
// it does not provide to the current thread
|
||||||
lockTarget();
|
lockTarget();
|
||||||
currentThreadId = newThreadId;
|
|
||||||
|
|
||||||
// get the new Threads.
|
|
||||||
try {
|
try {
|
||||||
|
// get the new Threads.
|
||||||
|
currentThreadId = newThreadId;
|
||||||
currentThreads = getCThreads();
|
currentThreads = getCThreads();
|
||||||
} catch (CDIException e) {
|
} catch (CDIException e) {
|
||||||
currentThreads = noThreads;
|
currentThreads = noThreads;
|
||||||
}
|
} finally {
|
||||||
releaseTarget();
|
releaseTarget();
|
||||||
|
}
|
||||||
|
|
||||||
// Fire CreatedEvent for new threads.
|
// Fire CreatedEvent for new threads.
|
||||||
// Replace the new threads with the old thread object
|
// Replace the new threads with the old thread object
|
||||||
|
|
|
@ -131,9 +131,12 @@ public class Thread extends CObject implements ICDIThread {
|
||||||
//throw e;
|
//throw e;
|
||||||
//System.out.println(e);
|
//System.out.println(e);
|
||||||
} finally {
|
} finally {
|
||||||
|
try {
|
||||||
target.setCurrentThread(currentThread, false);
|
target.setCurrentThread(currentThread, false);
|
||||||
|
} finally {
|
||||||
target.releaseTarget();
|
target.releaseTarget();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
// assign the currentFrame if it was not done yet.
|
// assign the currentFrame if it was not done yet.
|
||||||
if (currentFrame == null) {
|
if (currentFrame == null) {
|
||||||
for (int i = 0; i < currentFrames.size(); i++) {
|
for (int i = 0; i < currentFrames.size(); i++) {
|
||||||
|
@ -191,10 +194,11 @@ public class Thread extends CObject implements ICDIThread {
|
||||||
} catch (MI2CDIException e) {
|
} catch (MI2CDIException e) {
|
||||||
target.releaseTarget();
|
target.releaseTarget();
|
||||||
throw e;
|
throw e;
|
||||||
}
|
} finally {
|
||||||
target.releaseTarget();
|
target.releaseTarget();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return stackdepth;
|
return stackdepth;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -239,9 +243,12 @@ public class Thread extends CObject implements ICDIThread {
|
||||||
//throw e;
|
//throw e;
|
||||||
//System.out.println(e);
|
//System.out.println(e);
|
||||||
} finally {
|
} finally {
|
||||||
|
try {
|
||||||
target.setCurrentThread(currentThread, false);
|
target.setCurrentThread(currentThread, false);
|
||||||
|
} finally {
|
||||||
target.releaseTarget();
|
target.releaseTarget();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
// take time to assign the currentFrame, if it is in the set
|
// take time to assign the currentFrame, if it is in the set
|
||||||
if (currentFrame == null) {
|
if (currentFrame == null) {
|
||||||
for (int i = 0; i < currentFrames.size(); i++) {
|
for (int i = 0; i < currentFrames.size(); i++) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue