diff options
author | Eugene Tarassov | 2017-07-06 03:25:17 +0000 |
---|---|---|
committer | Eugene Tarassov | 2017-07-06 03:25:17 +0000 |
commit | 6928bc53e1742199353d4c3966a4209c3d5dd82a (patch) | |
tree | a64359d3df60abb0558669d8331db0efc303c3a9 | |
parent | 6aaa47eccd8d123557276530fef317978b1f11dc (diff) | |
download | org.eclipse.tcf-6928bc53e1742199353d4c3966a4209c3d5dd82a.tar.gz org.eclipse.tcf-6928bc53e1742199353d4c3966a4209c3d5dd82a.tar.xz org.eclipse.tcf-6928bc53e1742199353d4c3966a4209c3d5dd82a.zip |
TCF Debugger: better implementation of Step Into Selection command
8 files changed, 173 insertions, 78 deletions
diff --git a/plugins/org.eclipse.tcf.cdt.ui/src/org/eclipse/tcf/internal/cdt/ui/commands/StepIntoSelectionLocation.java b/plugins/org.eclipse.tcf.cdt.ui/src/org/eclipse/tcf/internal/cdt/ui/commands/StepIntoSelectionLocation.java index de4af7eff..ca4908cb7 100644 --- a/plugins/org.eclipse.tcf.cdt.ui/src/org/eclipse/tcf/internal/cdt/ui/commands/StepIntoSelectionLocation.java +++ b/plugins/org.eclipse.tcf.cdt.ui/src/org/eclipse/tcf/internal/cdt/ui/commands/StepIntoSelectionLocation.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2015, 2016 Xilinx, Inc. and others. + * Copyright (c) 2015, 2017 Xilinx, Inc. and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -170,7 +170,8 @@ class StepIntoSelectionLocation { IASTName name = astNames[i]; if (name.isDefinition()) { astNames[i] = null; - } else if (CPPVisitor.findAncestorWithType(name, ICPPASTUsingDeclaration.class) != null) { + } + else if (CPPVisitor.findAncestorWithType(name, ICPPASTUsingDeclaration.class) != null) { if (usingDeclarations == null) usingDeclarations = new ArrayList<IASTName>(1); usingDeclarations.add(name); @@ -280,8 +281,7 @@ class StepIntoSelectionLocation { } private boolean areOverlappingNames(IName n1, IName n2) { - if (n1 == n2) - return true; + if (n1 == n2) return true; IASTFileLocation loc1 = n1.getFileLocation(); IASTFileLocation loc2 = n2.getFileLocation(); @@ -462,5 +462,4 @@ class StepIntoSelectionLocation { IASTTranslationUnit astTranslationUnit = name.getTranslationUnit(); return astTranslationUnit == null ? null : astTranslationUnit.getOriginatingTranslationUnit(); } - } diff --git a/plugins/org.eclipse.tcf.cdt.ui/src/org/eclipse/tcf/internal/cdt/ui/commands/TCFReverseToggleCommand.java b/plugins/org.eclipse.tcf.cdt.ui/src/org/eclipse/tcf/internal/cdt/ui/commands/TCFReverseToggleCommand.java index 0c937280d..d540ba3be 100644 --- a/plugins/org.eclipse.tcf.cdt.ui/src/org/eclipse/tcf/internal/cdt/ui/commands/TCFReverseToggleCommand.java +++ b/plugins/org.eclipse.tcf.cdt.ui/src/org/eclipse/tcf/internal/cdt/ui/commands/TCFReverseToggleCommand.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2010, 2012 Wind River Systems, Inc. and others. + * Copyright (c) 2010, 2017 Wind River Systems, Inc. and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -40,7 +40,8 @@ public class TCFReverseToggleCommand implements IReverseToggleHandler { request.done(); }; }); - } else { + } + else { request.done(); } return true; diff --git a/plugins/org.eclipse.tcf.cdt.ui/src/org/eclipse/tcf/internal/cdt/ui/commands/TCFStepIntoSelectionHandler.java b/plugins/org.eclipse.tcf.cdt.ui/src/org/eclipse/tcf/internal/cdt/ui/commands/TCFStepIntoSelectionHandler.java index 7854f21b0..8c4ae8d4f 100644 --- a/plugins/org.eclipse.tcf.cdt.ui/src/org/eclipse/tcf/internal/cdt/ui/commands/TCFStepIntoSelectionHandler.java +++ b/plugins/org.eclipse.tcf.cdt.ui/src/org/eclipse/tcf/internal/cdt/ui/commands/TCFStepIntoSelectionHandler.java @@ -10,6 +10,8 @@ *******************************************************************************/ package org.eclipse.tcf.internal.cdt.ui.commands; +import java.math.BigInteger; +import java.util.Collection; import java.util.HashMap; import java.util.Map; @@ -18,10 +20,16 @@ import org.eclipse.core.runtime.Status; import org.eclipse.debug.core.commands.IDebugCommandHandler; import org.eclipse.debug.core.commands.IDebugCommandRequest; import org.eclipse.debug.core.commands.IEnabledStateRequest; +import org.eclipse.debug.ui.ISourcePresentation; import org.eclipse.tcf.internal.cdt.ui.Activator; import org.eclipse.tcf.internal.debug.actions.TCFAction; +import org.eclipse.tcf.internal.debug.launch.TCFSourceLookupDirector; import org.eclipse.tcf.internal.debug.model.TCFContextState; +import org.eclipse.tcf.internal.debug.model.TCFSourceRef; +import org.eclipse.tcf.internal.debug.ui.model.TCFChildrenStackTrace; import org.eclipse.tcf.internal.debug.ui.model.TCFModel; +import org.eclipse.tcf.internal.debug.ui.model.TCFModelPresentation; +import org.eclipse.tcf.internal.debug.ui.model.TCFNodeStackFrame; import org.eclipse.tcf.protocol.IChannel; import org.eclipse.tcf.protocol.IToken; import org.eclipse.tcf.protocol.Protocol; @@ -30,6 +38,7 @@ import org.eclipse.tcf.services.IRunControl; import org.eclipse.tcf.services.IRunControl.RunControlContext; import org.eclipse.tcf.services.IRunControl.RunControlListener; import org.eclipse.tcf.util.TCFDataCache; +import org.eclipse.ui.IEditorInput; public class TCFStepIntoSelectionHandler implements IDebugCommandHandler { @@ -81,16 +90,80 @@ public class TCFStepIntoSelectionHandler implements IDebugCommandHandler { return true; } - Protocol.invokeLater(new Runnable() { - boolean run_to_line_done; + new TCFAction(l.node.getModel().getLaunch(), l.node.getID()) { + boolean resumed; boolean req_done; + boolean action_done; String bp_id; @Override public void run() { - if (l.node.isDisposed()) { + if (aborted || action_done || l.node.isDisposed()) { + done(null); + return; + } + TCFDataCache<TCFContextState> state_cache = l.node.getState(); + if (!state_cache.validate(this)) return; + if (state_cache.getError() != null) { + done(state_cache.getError()); + return; + } + TCFContextState state_data = state_cache.getData(); + if (state_data == null || !state_data.is_suspended) { done(null); return; } + + if (resumed) { + assert bp_id != null; + boolean bp_hit = false; + Object ids = state_data.suspend_params.get(IRunControl.STATE_BREAKPOINT_IDS); + if (ids != null) { + @SuppressWarnings("unchecked") + Collection<String> bp_ids = (Collection<String>)ids; + bp_hit = bp_ids.contains(bp_id) && bp_ids.size() == 1; + } + if (!bp_hit) { + done(null); + return; + } + + TCFChildrenStackTrace stack_trace = l.node.getStackTrace(); + if (!stack_trace.validate(this)) return; + TCFNodeStackFrame stack_frame = stack_trace.getTopFrame(); + BigInteger addr_data = null; + if (l.target_function != null) { + if (!stack_frame.getStackTraceContext().validate(this)) return; + addr_data = stack_frame.getReturnAddress(); + if (addr_data != null && addr_data.compareTo(BigInteger.valueOf(0)) > 0) { + addr_data = addr_data.subtract(BigInteger.valueOf(1)); + } + } + else { + TCFDataCache<BigInteger> addr_cache = stack_frame.getAddress(); + if (!addr_cache.validate(this)) return; + addr_data = addr_cache.getData(); + } + if (addr_data != null) { + TCFDataCache<TCFSourceRef> line_cache = l.node.getLineInfo(addr_data); + if (line_cache != null) { + if (!line_cache.validate(this)) return; + TCFSourceRef line_data = line_cache.getData(); + if (line_data != null && line_data.area != null && + line_data.area.start_line <= l.text_line && line_data.area.end_line > l.text_line) { + Object source_element = TCFSourceLookupDirector.lookup(l.node.getModel().getLaunch(), line_data.context_id, line_data.area); + if (source_element != null) { + ISourcePresentation presentation = TCFModelPresentation.getDefault(); + IEditorInput editor_input = presentation.getEditorInput(source_element); + if (editor_input.equals(l.editor.getEditorInput())) { + done(null); + return; + } + } + } + } + } + } + IChannel channel = l.node.getChannel(); if (bp_id == null) { IBreakpoints breakpoints = channel.getRemoteService(IBreakpoints.class); @@ -101,7 +174,7 @@ public class TCFStepIntoSelectionHandler implements IDebugCommandHandler { Map<String, Object> properties = new HashMap<String, Object>(); properties.put(IBreakpoints.PROP_FILE, l.text_file); properties.put(IBreakpoints.PROP_LINE, l.text_line); - if (run_to_line_done) { + if (l.target_function != null) { assert l.target_function != null; properties.put(IBreakpoints.PROP_LOCATION, l.target_function.getElementName()); properties.put(IBreakpoints.PROP_SKIP_PROLOGUE, true); @@ -129,17 +202,6 @@ public class TCFStepIntoSelectionHandler implements IDebugCommandHandler { done(new Exception("Cannot resume.")); return; } - TCFDataCache<TCFContextState> state_cache = l.node.getState(); - if (!state_cache.validate(this)) return; - if (state_cache.getError() != null) { - done(state_cache.getError()); - return; - } - TCFContextState state = state_cache.getData(); - if (state == null || !state.is_suspended) { - done(null); - return; - } TCFDataCache<IRunControl.RunControlContext> ctx_cache = l.node.getRunContext(); if (!ctx_cache.validate(this)) return; if (ctx_cache.getError() != null) { @@ -150,23 +212,7 @@ public class TCFStepIntoSelectionHandler implements IDebugCommandHandler { run_ctrl.addListener(new RunControlListener() { private void suspended() { run_ctrl.removeListener(this); - if (!run_to_line_done) { - run_to_line_done = true; - if (l.target_function != null) { - assert bp_id != null; - IChannel channel = l.node.getChannel(); - IBreakpoints breakpoints = channel.getRemoteService(IBreakpoints.class); - breakpoints.remove(new String[] { bp_id }, new IBreakpoints.DoneCommand() { - public void doneCommand(IToken token, Exception error) { - if (error != null) done(error); - else run(); - } - }); - bp_id = null; - return; - } - } - done(null); + run(); } public void contextSuspended(String context, String pc, String reason, Map<String,Object> params) { if (node_id.equals(context)) { @@ -200,6 +246,7 @@ public class TCFStepIntoSelectionHandler implements IDebugCommandHandler { public void containerResumed(String[] context_ids) { } }); + resumed = true; IRunControl.RunControlContext ctx = ctx_cache.getData(); ctx.resume(IRunControl.RM_RESUME, 1, new IRunControl.DoneCommand() { public void doneCommand(IToken token, Exception error) { @@ -213,6 +260,12 @@ public class TCFStepIntoSelectionHandler implements IDebugCommandHandler { } }); } + + @Override + public boolean showRunning() { + return true; + } + private void done(Throwable e) { if (bp_id != null) { IChannel channel = l.node.getChannel(); @@ -233,8 +286,13 @@ public class TCFStepIntoSelectionHandler implements IDebugCommandHandler { req_done = true; request.done(); } + if (!action_done) { + action_done = true; + setActionResult(getContextID(), "Step Into Selection"); + super.done(); + } } - }); + }; return true; } } diff --git a/plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/model/TCFAnnotationManager.java b/plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/model/TCFAnnotationManager.java index 9f63ee479..9fcad10f2 100644 --- a/plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/model/TCFAnnotationManager.java +++ b/plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/model/TCFAnnotationManager.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2008, 2016 Wind River Systems, Inc. and others. + * Copyright (c) 2008, 2017 Wind River Systems, Inc. and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -45,6 +45,7 @@ import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.swt.graphics.Device; import org.eclipse.swt.widgets.Display; import org.eclipse.tcf.debug.ui.ITCFAnnotationProvider; +import org.eclipse.tcf.internal.debug.actions.TCFAction; import org.eclipse.tcf.internal.debug.launch.TCFSourceLookupDirector; import org.eclipse.tcf.internal.debug.model.ITCFBreakpointListener; import org.eclipse.tcf.internal.debug.model.TCFBreakpointsModel; @@ -447,7 +448,7 @@ public class TCFAnnotationManager { private ILineNumbers.CodeArea getBreakpointCodeArea(TCFLaunch launch, String id) { Map<String,Object> props = launch.getBreakpointsStatus().getProperties(id); - if (props != null) { + if (props != null && props.get(IBreakpoints.PROP_LOCATION) == null) { String file = (String)props.get(IBreakpoints.PROP_FILE); Number line = (Number)props.get(IBreakpoints.PROP_LINE); if (file != null && line != null) { @@ -663,18 +664,21 @@ public class TCFAnnotationManager { frame = trace.getTopFrame(); } if (thread != null) { - TCFDataCache<IRunControl.RunControlContext> rc_ctx_cache = thread.getRunContext(); - if (!rc_ctx_cache.validate(this)) return; - IRunControl.RunControlContext rc_ctx_data = rc_ctx_cache.getData(); - if (rc_ctx_data != null) bp_group = rc_ctx_data.getBPGroup(); - TCFDataCache<TCFNodeExecContext> mem_cache = thread.getMemoryNode(); - if (!mem_cache.validate(this)) return; - memory = mem_cache.getData(); - if (bp_group == null && memory != null && rc_ctx_data != null && rc_ctx_data.hasState()) bp_group = memory.id; - last_top_frame = thread.getLastTopFrame(); - TCFDataCache<TCFContextState> state_cache = thread.getState(); - if (!state_cache.validate(this)) return; - suspended = state_cache.getData() != null && state_cache.getData().is_suspended; + TCFAction action = thread.model.getActiveAction(thread.id); + if (action == null || !action.showRunning()) { + TCFDataCache<IRunControl.RunControlContext> rc_ctx_cache = thread.getRunContext(); + if (!rc_ctx_cache.validate(this)) return; + IRunControl.RunControlContext rc_ctx_data = rc_ctx_cache.getData(); + if (rc_ctx_data != null) bp_group = rc_ctx_data.getBPGroup(); + TCFDataCache<TCFNodeExecContext> mem_cache = thread.getMemoryNode(); + if (!mem_cache.validate(this)) return; + memory = mem_cache.getData(); + if (bp_group == null && memory != null && rc_ctx_data != null && rc_ctx_data.hasState()) bp_group = memory.id; + last_top_frame = thread.getLastTopFrame(); + TCFDataCache<TCFContextState> state_cache = thread.getState(); + if (!state_cache.validate(this)) return; + suspended = state_cache.getData() != null && state_cache.getData().is_suspended; + } } Set<TCFAnnotation> set = new LinkedHashSet<TCFAnnotation>(); if (memory != null) { diff --git a/plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/model/TCFNodeExecContext.java b/plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/model/TCFNodeExecContext.java index 925434938..3151588b4 100644 --- a/plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/model/TCFNodeExecContext.java +++ b/plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/model/TCFNodeExecContext.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2016 Wind River Systems, Inc. and others. + * Copyright (c) 2007, 2017 Wind River Systems, Inc. and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -35,6 +35,7 @@ import org.eclipse.jface.resource.ImageDescriptor; import org.eclipse.swt.SWT; import org.eclipse.tcf.debug.ui.ITCFDebugUIConstants; import org.eclipse.tcf.debug.ui.ITCFExecContext; +import org.eclipse.tcf.internal.debug.actions.TCFAction; import org.eclipse.tcf.internal.debug.model.TCFBreakpointsModel; import org.eclipse.tcf.internal.debug.model.TCFContextState; import org.eclipse.tcf.internal.debug.model.TCFFunctionRef; @@ -864,6 +865,8 @@ public class TCFNodeExecContext extends TCFNode implements ISymbolOwner, ITCFExe } private boolean okToHideStack() { + TCFAction action = model.getActiveAction(id); + if (action != null && action.showRunning()) return true; TCFContextState state_data = state.getData(); if (state_data == null) return true; if (!state_data.is_suspended) return true; @@ -1145,23 +1148,29 @@ public class TCFNodeExecContext extends TCFNode implements ISymbolOwner, ITCFExe } else if (ctx.hasState()) { // Thread - if (resume_pending && resumed_by_action || model.getActiveAction(id) != null) { - if (!state.validate(done)) return false; - TCFContextState state_data = state.getData(); - image_name = ImageCache.IMG_THREAD_UNKNOWN_STATE; - if (state_data != null) { - if (!state_data.is_suspended) { - image_name = addStateName(label, state_data); + TCFAction action = model.getActiveAction(id); + if (resume_pending && resumed_by_action || action != null) { + if (action != null && action.showRunning()) { + image_name = ImageCache.IMG_THREAD_RUNNNIG; + } + else { + if (!state.validate(done)) return false; + TCFContextState state_data = state.getData(); + image_name = ImageCache.IMG_THREAD_UNKNOWN_STATE; + if (state_data != null) { + if (!state_data.is_suspended) { + image_name = addStateName(label, state_data); + } + else { + suspended_by_bp = IRunControl.REASON_BREAKPOINT.equals(state_data.suspend_reason); + } } - else { - suspended_by_bp = IRunControl.REASON_BREAKPOINT.equals(state_data.suspend_reason); + if (resume_pending && last_label != null) { + result.setImageDescriptor(ImageCache.getImageDescriptor(image_name), 0); + result.setLabel(last_label, 0); + return true; } } - if (resume_pending && last_label != null) { - result.setImageDescriptor(ImageCache.getImageDescriptor(image_name), 0); - result.setLabel(last_label, 0); - return true; - } } else if (resume_pending && last_label != null && last_image != null) { result.setImageDescriptor(last_image, 0); diff --git a/plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/model/TCFNodeExpression.java b/plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/model/TCFNodeExpression.java index f9b585dd7..1b741c186 100644 --- a/plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/model/TCFNodeExpression.java +++ b/plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/model/TCFNodeExpression.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2008, 2016 Wind River Systems, Inc. and others. + * Copyright (c) 2008, 2017 Wind River Systems, Inc. and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -39,6 +39,7 @@ import org.eclipse.swt.graphics.FontData; import org.eclipse.swt.widgets.Composite; import org.eclipse.tcf.debug.ui.ITCFExpression; import org.eclipse.tcf.debug.ui.ITCFPrettyExpressionProvider; +import org.eclipse.tcf.internal.debug.actions.TCFAction; import org.eclipse.tcf.internal.debug.model.TCFContextState; import org.eclipse.tcf.internal.debug.ui.Activator; import org.eclipse.tcf.internal.debug.ui.ColorCache; @@ -774,6 +775,7 @@ public class TCFNodeExpression extends TCFNode implements IElementEditor, ICastT } void onValueChanged() { + prev_value = next_value; value.reset(); type.reset(); type_name.reset(); @@ -887,18 +889,23 @@ public class TCFNodeExpression extends TCFNode implements IElementEditor, ICastT // stack trace does not contain expression parent frame. // Return null if waiting for cache update. if (prev_value == null) return false; - if (parent instanceof TCFNodeStackFrame) { - TCFNodeExecContext exe = (TCFNodeExecContext)parent.parent; + TCFNode p = getRootExpression().parent; + if (p instanceof TCFNodeStackFrame) { + TCFNodeExecContext exe = (TCFNodeExecContext)p.parent; + TCFAction action = model.getActiveAction(exe.id); + if (action != null && action.showRunning()) return true; TCFDataCache<TCFContextState> state_cache = exe.getState(); if (!state_cache.validate(done)) return null; TCFContextState state = state_cache.getData(); if (state == null || !state.is_suspended) return true; TCFChildrenStackTrace stack_trace_cache = exe.getStackTrace(); if (!stack_trace_cache.validate(done)) return null; - if (stack_trace_cache.getData().get(parent.id) == null) return true; + if (stack_trace_cache.getData().get(p.id) == null) return true; } - else if (parent instanceof TCFNodeExecContext) { - TCFNodeExecContext exe = (TCFNodeExecContext)parent; + else if (p instanceof TCFNodeExecContext) { + TCFNodeExecContext exe = (TCFNodeExecContext)p; + TCFAction action = model.getActiveAction(exe.id); + if (action != null && action.showRunning()) return true; TCFDataCache<TCFContextState> state_cache = exe.getState(); if (!state_cache.validate(done)) return null; TCFContextState state = state_cache.getData(); @@ -910,6 +917,7 @@ public class TCFNodeExpression extends TCFNode implements IElementEditor, ICastT @Override void flushAllCaches() { prev_value = null; + next_value = null; super.flushAllCaches(); } diff --git a/plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/model/TCFNodeRegister.java b/plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/model/TCFNodeRegister.java index 6a536c0f6..436f63c17 100644 --- a/plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/model/TCFNodeRegister.java +++ b/plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/model/TCFNodeRegister.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2016 Wind River Systems, Inc. and others. + * Copyright (c) 2007, 2017 Wind River Systems, Inc. and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -36,6 +36,7 @@ import org.eclipse.swt.SWT; import org.eclipse.swt.graphics.FontData; import org.eclipse.swt.widgets.Composite; import org.eclipse.tcf.debug.ui.ITCFRegister; +import org.eclipse.tcf.internal.debug.actions.TCFAction; import org.eclipse.tcf.internal.debug.model.TCFContextState; import org.eclipse.tcf.internal.debug.ui.ColorCache; import org.eclipse.tcf.internal.debug.ui.ImageCache; @@ -219,13 +220,15 @@ public class TCFNodeRegister extends TCFNode implements IElementEditor, IWatchIn private Boolean usePrevValue(Runnable done) { // Check if view should show old value. // Old value is shown if context is running or - // stack trace does not contain expression parent frame. + // stack trace does not contain register parent frame. // Return null if waiting for cache update. if (prev_value == null) return false; TCFNode p = parent; while (p instanceof TCFNodeRegister) p = p.parent; if (p instanceof TCFNodeStackFrame) { TCFNodeExecContext exe = (TCFNodeExecContext)p.parent; + TCFAction action = model.getActiveAction(exe.id); + if (action != null && action.showRunning()) return true; TCFDataCache<TCFContextState> state_cache = exe.getState(); if (!state_cache.validate(done)) return null; TCFContextState state = state_cache.getData(); @@ -236,6 +239,8 @@ public class TCFNodeRegister extends TCFNode implements IElementEditor, IWatchIn } else if (p instanceof TCFNodeExecContext) { TCFNodeExecContext exe = (TCFNodeExecContext)p; + TCFAction action = model.getActiveAction(exe.id); + if (action != null && action.showRunning()) return true; TCFDataCache<IRunControl.RunControlContext> ctx_cache = exe.getRunContext(); if (!ctx_cache.validate(done)) return null; IRunControl.RunControlContext ctx_data = ctx_cache.getData(); @@ -254,6 +259,13 @@ public class TCFNodeRegister extends TCFNode implements IElementEditor, IWatchIn return false; } + @Override + void flushAllCaches() { + prev_value = null; + next_value = null; + super.flushAllCaches(); + } + public boolean getDetailText(StyledStringBuffer bf, Runnable done) { if (!context.validate(done)) return false; if (!value.validate(done)) return false; diff --git a/plugins/org.eclipse.tcf.debug/src/org/eclipse/tcf/internal/debug/actions/TCFAction.java b/plugins/org.eclipse.tcf.debug/src/org/eclipse/tcf/internal/debug/actions/TCFAction.java index ab15ec1e2..9c21048d1 100644 --- a/plugins/org.eclipse.tcf.debug/src/org/eclipse/tcf/internal/debug/actions/TCFAction.java +++ b/plugins/org.eclipse.tcf.debug/src/org/eclipse/tcf/internal/debug/actions/TCFAction.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2008, 2015 Wind River Systems, Inc. and others. + * Copyright (c) 2008, 2017 Wind River Systems, Inc. and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -53,6 +53,10 @@ public abstract class TCFAction implements Runnable { return 0; } + public boolean showRunning() { + return false; + } + public void setActionResult(String id, String result) { launch.setContextActionResult(id, result); } |