Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPawel Piech2010-05-14 16:50:40 +0000
committerPawel Piech2010-05-14 16:50:40 +0000
commit06e479681f0a3dc7582cab9ef5cc420b353cfa8f (patch)
treea2a5eb44ebca663dc809570d5db26c72ec1734de
parent1c2aa84166c0b1fff583f03b886fd7fb15688e13 (diff)
downloadorg.eclipse.cdt-06e479681f0a3dc7582cab9ef5cc420b353cfa8f.tar.gz
org.eclipse.cdt-06e479681f0a3dc7582cab9ef5cc420b353cfa8f.tar.xz
org.eclipse.cdt-06e479681f0a3dc7582cab9ef5cc420b353cfa8f.zip
Bug 312813 - [Launch] MIInferiorProcess.exitValue() never returns
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/MIInferiorProcess.java3
-rw-r--r--dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/viewmodel/DsfCastToTypeSupport.java2
-rw-r--r--dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/ui/viewmodel/modules/detail/ModuleDetailPane.java6
-rw-r--r--dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/ui/viewmodel/register/SyncRegisterDataAccess.java4
-rw-r--r--dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/ui/viewmodel/variable/SyncVariableDataAccess.java10
-rw-r--r--dsf/org.eclipse.cdt.dsf/src/org/eclipse/cdt/dsf/concurrent/Query.java5
-rw-r--r--dsf/org.eclipse.cdt.examples.dsf/src/org/eclipse/cdt/examples/dsf/timers/TriggerCellModifier.java6
-rw-r--r--dsf/org.eclipse.cdt.tests.dsf/src/org/eclipse/cdt/tests/dsf/concurrent/DsfQueryTests.java21
8 files changed, 41 insertions, 16 deletions
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/MIInferiorProcess.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/MIInferiorProcess.java
index cbeb8b3c38..48df11f3d7 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/MIInferiorProcess.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/MIInferiorProcess.java
@@ -276,7 +276,8 @@ public class MIInferiorProcess extends Process
protected void execute(final DataRequestMonitor<Integer> rm) {
// Guard against session disposed.
if (!DsfSession.isSessionActive(fSession.getId())) {
- cancel(false);
+ rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, IDsfStatusConstants.INVALID_STATE, "Debug session already shut down.", null)); //$NON-NLS-1$
+ rm.done();
return;
}
diff --git a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/viewmodel/DsfCastToTypeSupport.java b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/viewmodel/DsfCastToTypeSupport.java
index d91bd6de93..c6b2b2246e 100644
--- a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/viewmodel/DsfCastToTypeSupport.java
+++ b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/viewmodel/DsfCastToTypeSupport.java
@@ -75,7 +75,7 @@ public class DsfCastToTypeSupport {
final DsfSession session = DsfSession.getSession(
dmvmProvider.getSession().getId());
if (session == null) {
- cancel(false);
+ rm.setStatus(new Status(IStatus.ERROR, DsfUIPlugin.PLUGIN_ID, IDsfStatusConstants.INVALID_STATE, "Debug session already shut down.", null)); //$NON-NLS-1$
rm.done();
return;
}
diff --git a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/ui/viewmodel/modules/detail/ModuleDetailPane.java b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/ui/viewmodel/modules/detail/ModuleDetailPane.java
index bab51b5a67..4655fe1635 100644
--- a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/ui/viewmodel/modules/detail/ModuleDetailPane.java
+++ b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/ui/viewmodel/modules/detail/ModuleDetailPane.java
@@ -483,7 +483,8 @@ public class ModuleDetailPane extends ModulesAbstractDetailPane implements IAdap
*/
final DsfSession session = DsfSession.getSession(fDmc.getSessionId());
if (session == null) {
- cancel(false);
+ rm.setStatus(new Status(IStatus.ERROR, DsfUIPlugin.PLUGIN_ID, IDsfStatusConstants.INVALID_STATE, "Debug session already shut down.", null)); //$NON-NLS-1$
+ rm.done();
return;
}
@@ -506,7 +507,8 @@ public class ModuleDetailPane extends ModulesAbstractDetailPane implements IAdap
* We're in another dispatch, so we must guard against executor shutdown again.
*/
if (!DsfSession.isSessionActive(session.getId())) {
- GetModuleDetailsQuery.this.cancel(false);
+ rm.setStatus(new Status(IStatus.ERROR, DsfUIPlugin.PLUGIN_ID, IDsfStatusConstants.INVALID_STATE, "Debug session already shut down.", null)); //$NON-NLS-1$
+ rm.done();
return;
}
super.handleCompleted();
diff --git a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/ui/viewmodel/register/SyncRegisterDataAccess.java b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/ui/viewmodel/register/SyncRegisterDataAccess.java
index bca7931582..b3378b8e71 100644
--- a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/ui/viewmodel/register/SyncRegisterDataAccess.java
+++ b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/ui/viewmodel/register/SyncRegisterDataAccess.java
@@ -21,10 +21,10 @@ import org.eclipse.cdt.dsf.concurrent.ThreadSafe;
import org.eclipse.cdt.dsf.concurrent.ThreadSafeAndProhibitedFromDsfExecutor;
import org.eclipse.cdt.dsf.datamodel.DMContexts;
import org.eclipse.cdt.dsf.datamodel.IDMContext;
-import org.eclipse.cdt.dsf.debug.service.IRegisters;
import org.eclipse.cdt.dsf.debug.service.IFormattedValues.FormattedValueDMContext;
import org.eclipse.cdt.dsf.debug.service.IFormattedValues.FormattedValueDMData;
import org.eclipse.cdt.dsf.debug.service.IFormattedValues.IFormattedDataDMContext;
+import org.eclipse.cdt.dsf.debug.service.IRegisters;
import org.eclipse.cdt.dsf.debug.service.IRegisters.IBitFieldDMContext;
import org.eclipse.cdt.dsf.debug.service.IRegisters.IBitFieldDMData;
import org.eclipse.cdt.dsf.debug.service.IRegisters.IMnemonic;
@@ -60,7 +60,7 @@ public class SyncRegisterDataAccess {
*/
final DsfSession session = DsfSession.getSession(fDmc.getSessionId());
if (session == null) {
- cancel(false);
+ rm.setStatus(new Status(IStatus.ERROR, DsfUIPlugin.PLUGIN_ID, IDsfStatusConstants.INVALID_STATE, "Debug session already shut down.", null)); //$NON-NLS-1$
rm.done();
return;
}
diff --git a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/ui/viewmodel/variable/SyncVariableDataAccess.java b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/ui/viewmodel/variable/SyncVariableDataAccess.java
index 260a2ac412..9911831dcf 100644
--- a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/ui/viewmodel/variable/SyncVariableDataAccess.java
+++ b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/ui/viewmodel/variable/SyncVariableDataAccess.java
@@ -118,7 +118,7 @@ public class SyncVariableDataAccess {
*/
final DsfSession session = DsfSession.getSession(fDmc.getSessionId());
if (session == null) {
- cancel(false);
+ rm.setStatus(new Status(IStatus.ERROR, DsfUIPlugin.PLUGIN_ID, IDsfStatusConstants.INVALID_STATE, "Debug session already shut down.", null)); //$NON-NLS-1$
rm.done();
return;
}
@@ -204,7 +204,7 @@ public class SyncVariableDataAccess {
*/
final DsfSession session = DsfSession.getSession(fDmc.getSessionId());
if (session == null) {
- cancel(false);
+ rm.setStatus(new Status(IStatus.ERROR, DsfUIPlugin.PLUGIN_ID, IDsfStatusConstants.INVALID_STATE, "Debug session already shut down.", null)); //$NON-NLS-1$
rm.done();
return;
}
@@ -302,7 +302,7 @@ public class SyncVariableDataAccess {
*/
final DsfSession session = DsfSession.getSession(fDmc.getSessionId());
if (session == null) {
- cancel(false);
+ rm.setStatus(new Status(IStatus.ERROR, DsfUIPlugin.PLUGIN_ID, IDsfStatusConstants.INVALID_STATE, "Debug session already shut down.", null)); //$NON-NLS-1$
rm.done();
return;
}
@@ -395,7 +395,7 @@ public class SyncVariableDataAccess {
*/
final DsfSession session = DsfSession.getSession(fDmc.getSessionId());
if (session == null) {
- cancel(false);
+ rm.setStatus(new Status(IStatus.ERROR, DsfUIPlugin.PLUGIN_ID, IDsfStatusConstants.INVALID_STATE, "Debug session already shut down.", null)); //$NON-NLS-1$
rm.done();
return;
}
@@ -488,7 +488,7 @@ public class SyncVariableDataAccess {
*/
final DsfSession session = DsfSession.getSession(fDmc.getSessionId());
if (session == null) {
- cancel(false);
+ rm.setStatus(new Status(IStatus.ERROR, DsfUIPlugin.PLUGIN_ID, IDsfStatusConstants.INVALID_STATE, "Debug session already shut down.", null)); //$NON-NLS-1$
rm.done();
return;
}
diff --git a/dsf/org.eclipse.cdt.dsf/src/org/eclipse/cdt/dsf/concurrent/Query.java b/dsf/org.eclipse.cdt.dsf/src/org/eclipse/cdt/dsf/concurrent/Query.java
index 8416530707..69fceb597c 100644
--- a/dsf/org.eclipse.cdt.dsf/src/org/eclipse/cdt/dsf/concurrent/Query.java
+++ b/dsf/org.eclipse.cdt.dsf/src/org/eclipse/cdt/dsf/concurrent/Query.java
@@ -152,6 +152,7 @@ abstract public class Query<V> extends DsfRunnable
completed = fRm.isCompleted();
if (!completed) {
fRm.cancel();
+ fRm.notifyAll();
}
}
return !completed;
@@ -161,7 +162,8 @@ abstract public class Query<V> extends DsfRunnable
public boolean isDone() {
synchronized (fRm) {
- return fRm.isCompleted() || (fRm.isCanceled() && !fRm.isExecuted());
+ // If future is canceled, return right away.
+ return fRm.isCompleted() || fRm.isCanceled();
}
}
@@ -180,6 +182,7 @@ abstract public class Query<V> extends DsfRunnable
* @deprecated Query implementations should call the request monitor to
* set the exception status directly.
*/
+ @Deprecated
protected void doneException(Throwable t) {
fRm.setStatus(new Status(IStatus.ERROR, DsfPlugin.PLUGIN_ID, IDsfStatusConstants.INTERNAL_ERROR, "Exception", t)); //$NON-NLS-1$
fRm.done();
diff --git a/dsf/org.eclipse.cdt.examples.dsf/src/org/eclipse/cdt/examples/dsf/timers/TriggerCellModifier.java b/dsf/org.eclipse.cdt.examples.dsf/src/org/eclipse/cdt/examples/dsf/timers/TriggerCellModifier.java
index b7de00a0ca..d6d2e2f977 100644
--- a/dsf/org.eclipse.cdt.examples.dsf/src/org/eclipse/cdt/examples/dsf/timers/TriggerCellModifier.java
+++ b/dsf/org.eclipse.cdt.examples.dsf/src/org/eclipse/cdt/examples/dsf/timers/TriggerCellModifier.java
@@ -193,7 +193,8 @@ public class TriggerCellModifier implements ICellModifier {
// In that case, cancel to notify waiting thread.
final DsfSession session = DsfSession.getSession(fDmc.getSessionId());
if (session == null) {
- cancel(false);
+ rm.setStatus(new Status(IStatus.ERROR, DsfExamplesPlugin.PLUGIN_ID, IDsfStatusConstants.INVALID_STATE, "Debug session already shut down.", null)); //$NON-NLS-1$
+ rm.done();
return;
}
@@ -234,7 +235,8 @@ public class TriggerCellModifier implements ICellModifier {
// Guard against terminated session
final DsfSession session = DsfSession.getSession(fDmc.getSessionId());
if (session == null) {
- cancel(false);
+ rm.setStatus(new Status(IStatus.ERROR, DsfExamplesPlugin.PLUGIN_ID, IDsfStatusConstants.INVALID_STATE, "Debug session already shut down.", null)); //$NON-NLS-1$
+ rm.done();
return;
}
diff --git a/dsf/org.eclipse.cdt.tests.dsf/src/org/eclipse/cdt/tests/dsf/concurrent/DsfQueryTests.java b/dsf/org.eclipse.cdt.tests.dsf/src/org/eclipse/cdt/tests/dsf/concurrent/DsfQueryTests.java
index 7da7f99aea..5e74eaf041 100644
--- a/dsf/org.eclipse.cdt.tests.dsf/src/org/eclipse/cdt/tests/dsf/concurrent/DsfQueryTests.java
+++ b/dsf/org.eclipse.cdt.tests.dsf/src/org/eclipse/cdt/tests/dsf/concurrent/DsfQueryTests.java
@@ -110,6 +110,7 @@ public class DsfQueryTests {
@Test
public void doneExceptionTest() throws InterruptedException, ExecutionException {
Query<Integer> q = new Query<Integer>() {
+ @SuppressWarnings("deprecation")
@Override
protected void execute(DataRequestMonitor<Integer> rm) {
doneException(new Throwable());
@@ -246,12 +247,26 @@ public class DsfQueryTests {
Assert.assertTrue(cancelCalled[0]);
Assert.assertTrue(rmHolder[0].isCanceled());
Assert.assertTrue(q.isCancelled());
- Assert.assertFalse(q.isDone());
+ Assert.assertTrue(q.isDone());
+
+ // Retrieve data
+ try {
+ q.get();
+ } catch (CancellationException e) {
+ return; // Success
+ } finally {
+ Assert.assertTrue(q.isDone());
+ Assert.assertTrue(q.isCancelled());
+ }
// Complete rm and query.
+ @SuppressWarnings("unchecked")
+ DataRequestMonitor<Integer> drm = (DataRequestMonitor<Integer>)rmHolder[0];
+ drm.setData(new Integer(1));
rmHolder[0].done();
- // Retrieve data
+ // Try to retrieve data again, it should still result in
+ // cancellation exception.
try {
q.get();
} catch (CancellationException e) {
@@ -260,6 +275,8 @@ public class DsfQueryTests {
Assert.assertTrue(q.isDone());
Assert.assertTrue(q.isCancelled());
}
+
+
Assert.assertTrue("CancellationException should have been thrown", false); //$NON-NLS-1$
}

Back to the top