From 5ebe6f49892e5b73ae3da19f29b9f871e57952d6 Mon Sep 17 00:00:00 2001 From: Marc Khouzam Date: Wed, 27 May 2009 19:55:58 +0000 Subject: [PATCH] [225921] Gray out step-return when in main() for non-stop --- .../dsf/gdb/service/GDBRunControl_7_0_NS.java | 24 ++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBRunControl_7_0_NS.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBRunControl_7_0_NS.java index dba026e8d04..7c340a6326c 100644 --- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBRunControl_7_0_NS.java +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBRunControl_7_0_NS.java @@ -487,10 +487,32 @@ public class GDBRunControl_7_0_NS extends AbstractDsfService implements IMIRunCo return false; } - public void canStep(IExecutionDMContext context, StepType stepType, DataRequestMonitor rm) { + public void canStep(final IExecutionDMContext context, StepType stepType, final DataRequestMonitor rm) { // If it's a thread, just look it up if (context instanceof IMIExecutionDMContext) { + if (stepType == StepType.STEP_RETURN) { + // A step return will always be done in the top stack frame. + // If the top stack frame is the only stack frame, it does not make sense + // to do a step return since GDB will reject it. + MIStack stackService = getServicesTracker().getService(MIStack.class); + if (stackService != null) { + // Check that the stack is at least two deep. + stackService.getStackDepth(context, 2, new DataRequestMonitor(getExecutor(), rm) { + @Override + public void handleCompleted() { + if (isSuccess() && getData() == 1) { + rm.setData(false); + rm.done(); + } else { + canResume(context, rm); + } + } + }); + return; + } + } + canResume(context, rm); return; }