1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-23 22:52:11 +02:00

Bug 215553 - patch for Alena - ensure the target is released in exception scenarios.

This commit is contained in:
Doug Schaefer 2008-01-28 19:56:26 +00:00
parent 0d547afec5
commit d1561de41d
5 changed files with 68 additions and 37 deletions

View file

@ -203,11 +203,14 @@ public class ExpressionManager extends Manager {
} catch (MIException e) {
throw new MI2CDIException(e);
} finally {
try {
target.setCurrentThread(currentThread, false);
currentThread.setCurrentStackFrame(currentFrame, false);
} finally {
target.releaseTarget();
}
}
}
/**
* Remove variable form the maintained cache list.

View file

@ -430,11 +430,14 @@ public class SourceManager extends Manager {
((Thread)frame.getThread()).setCurrentStackFrame(frame, false);
return getDetailTypeName(target, variable);
} finally {
try {
target.setCurrentThread(currentThread, false);
currentThread.setCurrentStackFrame(currentFrame, false);
} finally {
target.releaseTarget();
}
}
}
public String getDetailTypeName(Target target, String typename) throws CDIException {
try {
MISession mi = target.getMISession();
@ -468,11 +471,14 @@ public class SourceManager extends Manager {
((Thread)frame.getThread()).setCurrentStackFrame(frame, false);
return getTypeName(target, variable);
} finally {
try {
target.setCurrentThread(currentThread, false);
currentThread.setCurrentStackFrame(currentFrame, false);
} finally {
target.releaseTarget();
}
}
}
public String getTypeName(Target target, String variable) throws CDIException {
MISession miSession = target.getMISession();

View file

@ -192,13 +192,16 @@ public class VariableManager extends Manager {
} catch (MIException e) {
throw new MI2CDIException(e);
} finally {
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,11 +392,14 @@ public class VariableManager extends Manager {
} catch (MIException e) {
throw new MI2CDIException(e);
} finally {
try {
target.setCurrentThread(currentThread, false);
currentThread.setCurrentStackFrame(currentFrame, false);
} finally {
target.releaseTarget();
}
}
}
return argument;
}
@ -432,10 +438,13 @@ public class VariableManager extends Manager {
} catch (MIException e) {
throw new MI2CDIException(e);
} finally {
try {
target.setCurrentThread(currentThread, false);
currentThread.setCurrentStackFrame(currentFrame, false);
} finally {
target.releaseTarget();
}
}
return (ICDIArgumentDescriptor[]) argObjects.toArray(new ICDIArgumentDescriptor[0]);
}
@ -519,10 +528,13 @@ public class VariableManager extends Manager {
} catch (MIException e) {
throw new MI2CDIException(e);
} finally {
try {
target.setCurrentThread(currentThread, false);
currentThread.setCurrentStackFrame(currentFrame, false);
} finally {
target.releaseTarget();
}
}
return (ICDILocalVariableDescriptor[]) varObjects.toArray(new ICDILocalVariableDescriptor[0]);
}
@ -558,11 +570,14 @@ public class VariableManager extends Manager {
} catch (MIException e) {
throw new MI2CDIException(e);
} finally {
try {
target.setCurrentThread(currentThread, false);
currentThread.setCurrentStackFrame(currentFrame, false);
} finally {
target.releaseTarget();
}
}
}
return local;
}

View file

@ -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();
}
// Fire CreatedEvent for new threads.
// Replace the new threads with the old thread object

View file

@ -131,9 +131,12 @@ public class Thread extends CObject implements ICDIThread {
//throw e;
//System.out.println(e);
} finally {
try {
target.setCurrentThread(currentThread, false);
} finally {
target.releaseTarget();
}
}
// assign the currentFrame if it was not done yet.
if (currentFrame == null) {
for (int i = 0; i < currentFrames.size(); i++) {
@ -191,10 +194,11 @@ public class Thread extends CObject implements ICDIThread {
} catch (MI2CDIException e) {
target.releaseTarget();
throw e;
}
} finally {
target.releaseTarget();
}
}
}
return stackdepth;
}
@ -239,9 +243,12 @@ public class Thread extends CObject implements ICDIThread {
//throw e;
//System.out.println(e);
} finally {
try {
target.setCurrentThread(currentThread, false);
} finally {
target.releaseTarget();
}
}
// take time to assign the currentFrame, if it is in the set
if (currentFrame == null) {
for (int i = 0; i < currentFrames.size(); i++) {