diff options
Diffstat (limited to 'plugins')
3 files changed, 45 insertions, 30 deletions
diff --git a/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/commands/StepCommand.java b/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/commands/StepCommand.java index bd652f7d1..2cfbfbc14 100644 --- a/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/commands/StepCommand.java +++ b/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/commands/StepCommand.java @@ -52,20 +52,28 @@ abstract class StepCommand implements IDebugCommandHandler { if (!cache.validate(done)) return false; ctx = cache.getData(); } - if (ctx == null || !canExecute(ctx)) { + if (ctx == null) { node = node.getParent(); } else { + if (!canExecute(ctx)) break; int action_cnt = model.getLaunch().getContextActionsCount(ctx.getID()); if (exec && action_cnt >= MAX_ACTION_CNT) break; - if (action_cnt == 0 && !ctx.isContainer()) { - TCFDataCache<TCFContextState> state_cache = ((TCFNodeExecContext)node).getState(); - if (!state_cache.validate(done)) return false; - TCFContextState state_data = state_cache.getData(); - if (state_data != null && state_data.is_suspended) set.add(ctx); + if (action_cnt > 0) { + set.add(ctx); } else { - set.add(ctx); + if (ctx.isContainer()) { + TCFNodeExecContext.ChildrenStateInfo s = new TCFNodeExecContext.ChildrenStateInfo(); + if (!((TCFNodeExecContext)node).hasSuspendedChildren(s, done)) return false; + if (s.suspended) set.add(ctx); + } + if (ctx.hasState()) { + TCFDataCache<TCFContextState> state_cache = ((TCFNodeExecContext)node).getState(); + if (!state_cache.validate(done)) return false; + TCFContextState state_data = state_cache.getData(); + if (state_data != null && state_data.is_suspended) set.add(ctx); + } } break; } diff --git a/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/commands/SuspendCommand.java b/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/commands/SuspendCommand.java index c81f95e8d..133daf61f 100644 --- a/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/commands/SuspendCommand.java +++ b/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/commands/SuspendCommand.java @@ -63,15 +63,19 @@ public class SuspendCommand implements ISuspendHandler { res = true; break; } - else if (ctx.isContainer()) { - if (ctx.canSuspend()) res = true; - break; - } else { - TCFDataCache<TCFContextState> state_cache = ((TCFNodeExecContext)node).getState(); - if (!state_cache.validate(this)) return; - TCFContextState state_data = state_cache.getData(); - if (state_data != null && !state_data.is_suspended && ctx.canSuspend()) res = true; + if (!ctx.canSuspend()) break; + if (ctx.isContainer()) { + TCFNodeExecContext.ChildrenStateInfo s = new TCFNodeExecContext.ChildrenStateInfo(); + if (!((TCFNodeExecContext)node).hasSuspendedChildren(s, this)) return; + if (s.running) res = true; + } + if (ctx.hasState()) { + TCFDataCache<TCFContextState> state_cache = ((TCFNodeExecContext)node).getState(); + if (!state_cache.validate(this)) return; + TCFContextState state_data = state_cache.getData(); + if (state_data != null && !state_data.is_suspended && ctx.canSuspend()) res = true; + } break; } } diff --git a/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/model/TCFNodeExecContext.java b/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/model/TCFNodeExecContext.java index f0d115293..81ddf15cb 100644 --- a/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/model/TCFNodeExecContext.java +++ b/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/model/TCFNodeExecContext.java @@ -110,9 +110,10 @@ public class TCFNodeExecContext extends TCFNode implements ISymbolOwner { } } - private static class SuspendedChildrenInfo { - boolean suspended; - boolean suspended_by_bp; + public static class ChildrenStateInfo { + public boolean running; + public boolean suspended; + public boolean breakpoint; } private final Map<String,TCFNodeSymbol> symbols = new HashMap<String,TCFNodeSymbol>(); @@ -1033,11 +1034,11 @@ public class TCFNodeExecContext extends TCFNode implements ISymbolOwner { } else { // Thread container (process) - SuspendedChildrenInfo i = new SuspendedChildrenInfo(); + ChildrenStateInfo i = new ChildrenStateInfo(); if (!hasSuspendedChildren(i, done)) return false; if (i.suspended) image_name = ImageCache.IMG_PROCESS_SUSPENDED; else image_name = ImageCache.IMG_PROCESS_RUNNING; - suspended_by_bp = i.suspended_by_bp; + suspended_by_bp = i.breakpoint; } } } @@ -1338,10 +1339,10 @@ public class TCFNodeExecContext extends TCFNode implements ISymbolOwner { postStackChangedDelta(); } - private boolean hasSuspendedChildren(SuspendedChildrenInfo info, Runnable done) { + public boolean hasSuspendedChildren(ChildrenStateInfo info, Runnable done) { if (!children_exec.validate(done)) return false; Map<String,TCFNode> m = children_exec.getData(); - if (m == null) return true; + if (m == null || m.size() == 0) return true; for (TCFNode n : m.values()) { if (!(n instanceof TCFNodeExecContext)) continue; TCFNodeExecContext e = (TCFNodeExecContext)n; @@ -1351,20 +1352,22 @@ public class TCFNodeExecContext extends TCFNode implements ISymbolOwner { TCFDataCache<TCFContextState> state_cache = e.getState(); if (!state_cache.validate(done)) return false; TCFContextState state_data = state_cache.getData(); - if (state_data != null && state_data.is_suspended && !e.isNotActive()) { - info.suspended = true; - String r = model.getContextActionResult(e.id); - if (r == null) r = state_data.suspend_reason; - if (IRunControl.REASON_BREAKPOINT.equals(r)) { - info.suspended_by_bp = true; - return true; + if (state_data != null) { + if (!state_data.is_suspended) { + info.running = true; + } + else if (!e.isNotActive()) { + info.suspended = true; + String r = model.getContextActionResult(e.id); + if (r == null) r = state_data.suspend_reason; + if (IRunControl.REASON_BREAKPOINT.equals(r)) info.breakpoint = true; } } } else { if (!e.hasSuspendedChildren(info, done)) return false; - if (info.suspended_by_bp) return true; } + if (info.breakpoint && info.running) break; } return true; } |