Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDoug Schaefer2008-01-28 14:51:07 -0500
committerDoug Schaefer2008-01-28 14:51:07 -0500
commit1b7b88ad1cb6f91cbdd8834cef2051bb12e30052 (patch)
tree74ed118f9f2c50e5cb678789d0865b4ea6e93e70
parentfd8ae3684d74372b87fceb8c17cad4d70288a4ec (diff)
downloadorg.eclipse.cdt-1b7b88ad1cb6f91cbdd8834cef2051bb12e30052.tar.gz
org.eclipse.cdt-1b7b88ad1cb6f91cbdd8834cef2051bb12e30052.tar.xz
org.eclipse.cdt-1b7b88ad1cb6f91cbdd8834cef2051bb12e30052.zip
Bug 21553 - patch for Alena - ensure target is release properly in exception scenarios.
-rw-r--r--debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/ExpressionManager.java9
-rw-r--r--debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/SourceManager.java18
-rw-r--r--debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/VariableManager.java51
-rw-r--r--debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/Target.java8
-rw-r--r--debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/Thread.java19
5 files changed, 68 insertions, 37 deletions
diff --git a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/ExpressionManager.java b/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/ExpressionManager.java
index df0f2fa8cc..c6f28fd1d6 100644
--- a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/ExpressionManager.java
+++ b/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/ExpressionManager.java
@@ -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();
+ }
}
}
diff --git a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/SourceManager.java b/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/SourceManager.java
index 1b28c47c66..d57a9eb276 100644
--- a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/SourceManager.java
+++ b/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/SourceManager.java
@@ -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();
+ }
}
}
diff --git a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/VariableManager.java b/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/VariableManager.java
index 43ea841bc7..779d59f162 100644
--- a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/VariableManager.java
+++ b/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/VariableManager.java
@@ -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;
diff --git a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/Target.java b/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/Target.java
index fe61a1bf2f..078befe12d 100644
--- a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/Target.java
+++ b/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/Target.java
@@ -269,15 +269,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
diff --git a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/Thread.java b/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/Thread.java
index bb7221997e..d031b9c5ec 100644
--- a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/Thread.java
+++ b/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/Thread.java
@@ -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) {

Back to the top