1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-21 16:05:25 +02:00

Bug 291423 - [debug view] RejectedExecutionException when stepping fast past end of program.

This commit is contained in:
Pawel Piech 2009-10-07 18:03:13 +00:00
parent 9a35a91bd0
commit 94e7e1504c
2 changed files with 61 additions and 41 deletions

View file

@ -11,8 +11,11 @@
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.dsf.gdb.internal.ui.actions; package org.eclipse.cdt.dsf.gdb.internal.ui.actions;
import java.util.concurrent.RejectedExecutionException;
import org.eclipse.cdt.dsf.concurrent.DsfExecutor; import org.eclipse.cdt.dsf.concurrent.DsfExecutor;
import org.eclipse.cdt.dsf.concurrent.DsfRunnable; import org.eclipse.cdt.dsf.concurrent.DsfRunnable;
import org.eclipse.cdt.dsf.concurrent.ImmediateExecutor;
import org.eclipse.cdt.dsf.concurrent.RequestMonitor; import org.eclipse.cdt.dsf.concurrent.RequestMonitor;
import org.eclipse.cdt.dsf.datamodel.DMContexts; import org.eclipse.cdt.dsf.datamodel.DMContexts;
import org.eclipse.cdt.dsf.debug.service.IRunControl.IExecutionDMContext; import org.eclipse.cdt.dsf.debug.service.IRunControl.IExecutionDMContext;
@ -61,22 +64,27 @@ public class DsfTerminateCommand implements ITerminateHandler {
return; return;
} }
fExecutor.execute( try {
new DsfRunnable() { fExecutor.execute(
public void run() { new DsfRunnable() {
// Get the processes service and the exec context. public void run() {
IGDBBackend gdbBackend = fTracker.getService(IGDBBackend.class); // Get the processes service and the exec context.
if (gdbBackend == null || dmc == null) { IGDBBackend gdbBackend = fTracker.getService(IGDBBackend.class);
// Context or service already invalid. if (gdbBackend == null || dmc == null) {
request.setEnabled(false); // Context or service already invalid.
request.done(); request.setEnabled(false);
} else { request.done();
// Check the terminate. } else {
request.setEnabled(gdbBackend.getState() == IMIBackend.State.STARTED); // Check the terminate.
request.done(); request.setEnabled(gdbBackend.getState() == IMIBackend.State.STARTED);
request.done();
}
} }
} });
}); } catch (RejectedExecutionException e) {
request.setEnabled(false);
request.done();
}
} }
public boolean execute(final IDebugCommandRequest request) { public boolean execute(final IDebugCommandRequest request) {
@ -85,14 +93,24 @@ public class DsfTerminateCommand implements ITerminateHandler {
return false; return false;
} }
fExecutor.submit(new DsfCommandRunnable(fTracker, request.getElements()[0], request) { try {
@Override public void doExecute() { fExecutor.submit(new DsfCommandRunnable(fTracker, request.getElements()[0], request) {
IGDBControl gdbControl = fTracker.getService(IGDBControl.class); @Override public void doExecute() {
if (gdbControl != null) { IGDBControl gdbControl = fTracker.getService(IGDBControl.class);
gdbControl.terminate(new RequestMonitor(fExecutor, null)); if (gdbControl != null) {
} gdbControl.terminate(new RequestMonitor(ImmediateExecutor.getInstance(), null) {
} @Override
}); protected void handleCompleted() {
request.setStatus(getStatus());
request.done();
};
});
}
}
});
} catch (RejectedExecutionException e) {
request.done();
}
return false; return false;
} }

View file

@ -164,24 +164,26 @@ public class AbstractLaunchVMProvider extends AbstractDMVMProvider
refreshStackFramesFuture.cancel(false); refreshStackFramesFuture.cancel(false);
} }
refreshStackFramesFuture = getSession().getExecutor().schedule( try {
new DsfRunnable() { refreshStackFramesFuture = getSession().getExecutor().schedule(
public void run() { new DsfRunnable() {
if (getSession().isActive()) { public void run() {
getExecutor().execute(new Runnable() { if (getSession().isActive()) {
public void run() { getExecutor().execute(new Runnable() {
// trigger full stack frame update public void run() {
ScheduledFuture<?> future= fRefreshStackFramesFutures.get(exeContext); // trigger full stack frame update
if (future != null && !isDisposed()) { ScheduledFuture<?> future= fRefreshStackFramesFutures.get(exeContext);
fRefreshStackFramesFutures.remove(exeContext); if (future != null && !isDisposed()) {
handleEvent(new FullStackRefreshEvent(exeContext), null); fRefreshStackFramesFutures.remove(exeContext);
} handleEvent(new FullStackRefreshEvent(exeContext), null);
}}); }
} }});
} }
}, }
FRAME_UPDATE_DELAY, TimeUnit.MILLISECONDS); },
fRefreshStackFramesFutures.put(exeContext, refreshStackFramesFuture); FRAME_UPDATE_DELAY, TimeUnit.MILLISECONDS);
fRefreshStackFramesFutures.put(exeContext, refreshStackFramesFuture);
} catch (RejectedExecutionException e) {}
} else if (event instanceof IRunControl.IResumedDMEvent) { } else if (event instanceof IRunControl.IResumedDMEvent) {
IExecutionDMContext exeContext= ((IRunControl.IResumedDMEvent) event).getDMContext(); IExecutionDMContext exeContext= ((IRunControl.IResumedDMEvent) event).getDMContext();
ScheduledFuture<?> refreshStackFramesFuture= fRefreshStackFramesFutures.get(exeContext); ScheduledFuture<?> refreshStackFramesFuture= fRefreshStackFramesFutures.get(exeContext);