diff options
Diffstat (limited to 'plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse')
8 files changed, 147 insertions, 20 deletions
diff --git a/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/model/TCFAnnotationManager.java b/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/model/TCFAnnotationManager.java index c0da77a22..f0d95c746 100644 --- a/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/model/TCFAnnotationManager.java +++ b/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/model/TCFAnnotationManager.java @@ -173,6 +173,16 @@ public class TCFAnnotationManager { public void selectionChanged(IWorkbenchPart part, ISelection selection) { updateActiveLaunch(); updateAnnotations(part.getSite().getWorkbenchWindow(), (TCFLaunch)null); + if (selection instanceof IStructuredSelection) { + final Object obj = ((IStructuredSelection)selection).getFirstElement(); + if (obj instanceof TCFNodeStackFrame && ((TCFNodeStackFrame)obj).isTraceLimit()) { + Protocol.invokeLater(new Runnable() { + public void run() { + ((TCFNodeStackFrame)obj).riseTraceLimit(); + } + }); + } + } } }; diff --git a/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/model/TCFChildrenStackTrace.java b/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/model/TCFChildrenStackTrace.java index 3f5a9d2de..5ebfe41ab 100644 --- a/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/model/TCFChildrenStackTrace.java +++ b/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/model/TCFChildrenStackTrace.java @@ -24,6 +24,7 @@ public class TCFChildrenStackTrace extends TCFChildren { private final TCFNodeExecContext node; private String top_frame_id; + private int limit_factor = 1; TCFChildrenStackTrace(TCFNodeExecContext node) { super(node, 16); @@ -39,6 +40,7 @@ public class TCFChildrenStackTrace extends TCFChildren { } void onSuspended() { + limit_factor = 1; for (TCFNode n : getNodes()) ((TCFNodeStackFrame)n).onSuspended(); reset(); } @@ -67,6 +69,15 @@ public class TCFChildrenStackTrace extends TCFChildren { reset(null); } + void onPreferencesChanged() { + reset(); + } + + void riseTraceLimit() { + limit_factor++; + reset(); + } + void postAllChangedDelta() { for (TCFNode n : getNodes()) ((TCFNodeStackFrame)n).postAllChangedDelta(); } @@ -89,6 +100,7 @@ public class TCFChildrenStackTrace extends TCFChildren { TCFNodeStackFrame n = (TCFNodeStackFrame)node.model.getNode(top_frame_id); if (n == null) n = new TCFNodeStackFrame(node, top_frame_id, true); n.setFrameNo(0); + n.setTraceLimit(false); data.put(n.id, n); } @@ -119,15 +131,24 @@ public class TCFChildrenStackTrace extends TCFChildren { public void doneGetChildren(IToken token, Exception error, String[] contexts) { if (command == token) { if (error == null && contexts != null) { + int limit_value = 0; + boolean limit_enabled = node.model.getStackFramesLimitEnabled(); + if (limit_enabled) { + limit_value = node.model.getStackFramesLimitValue() * limit_factor; + if (limit_value <= 0) limit_value = limit_factor; + } int cnt = contexts.length; for (String id : contexts) { cnt--; - TCFNodeStackFrame n = (TCFNodeStackFrame)node.model.getNode(id); - if (n == null) n = new TCFNodeStackFrame(node, id, false); - assert n.parent == node; - n.setFrameNo(cnt); - data.put(id, n); - if (cnt == 0) top_frame_id = id; + if (!limit_enabled || cnt <= limit_value) { + TCFNodeStackFrame n = (TCFNodeStackFrame)node.model.getNode(id); + if (n == null) n = new TCFNodeStackFrame(node, id, false); + assert n.parent == node; + n.setFrameNo(cnt); + n.setTraceLimit(limit_enabled && cnt == limit_value); + data.put(id, n); + if (cnt == 0) top_frame_id = id; + } } } if (data.size() == 0) addEmulatedTopFrame(data); diff --git a/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/model/TCFModel.java b/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/model/TCFModel.java index c2af3b391..9020c655c 100644 --- a/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/model/TCFModel.java +++ b/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/model/TCFModel.java @@ -189,6 +189,10 @@ public class TCFModel implements IElementContentProvider, IElementLabelProvider, private boolean wait_for_pc_update_after_step; private boolean wait_for_views_update_after_step; private boolean delay_stack_update_until_last_step; + private boolean stack_frames_limit_enabled; + private int stack_frames_limit_value; + private boolean show_function_arg_names; + private boolean show_function_arg_values; private final Map<String,String> action_results = new HashMap<String,String>(); private final HashMap<String,TCFAction> active_actions = new HashMap<String,TCFAction>(); @@ -609,6 +613,19 @@ public class TCFModel implements IElementContentProvider, IElementLabelProvider, wait_for_pc_update_after_step = prefs.getBoolean(TCFPreferences.PREF_WAIT_FOR_PC_UPDATE_AFTER_STEP); wait_for_views_update_after_step = prefs.getBoolean(TCFPreferences.PREF_WAIT_FOR_VIEWS_UPDATE_AFTER_STEP); delay_stack_update_until_last_step = prefs.getBoolean(TCFPreferences.PREF_DELAY_STACK_UPDATE_UNTIL_LAST_STEP); + stack_frames_limit_enabled = prefs.getBoolean(TCFPreferences.PREF_STACK_FRAME_LIMIT_ENABLED); + stack_frames_limit_value = prefs.getInt(TCFPreferences.PREF_STACK_FRAME_LIMIT_VALUE); + show_function_arg_names = prefs.getBoolean(TCFPreferences.PREF_STACK_FRAME_ARG_NAMES); + show_function_arg_values = prefs.getBoolean(TCFPreferences.PREF_STACK_FRAME_ARG_VALUES); + Protocol.invokeLater(new Runnable() { + public void run() { + for (TCFNode n : id2node.values()) { + if (n instanceof TCFNodeExecContext) { + ((TCFNodeExecContext)n).onPreferencesChanged(); + } + } + } + }); } }; listener.propertyChange(null); @@ -757,6 +774,22 @@ public class TCFModel implements IElementContentProvider, IElementLabelProvider, return channel_throttle_enabled; } + public boolean getStackFramesLimitEnabled() { + return stack_frames_limit_enabled; + } + + public int getStackFramesLimitValue() { + return stack_frames_limit_value; + } + + public boolean getShowFunctionArgNames() { + return show_function_arg_names; + } + + public boolean getShowFunctionArgValues() { + return show_function_arg_values; + } + void onProxyInstalled(TCFModelProxy mp) { IPresentationContext pc = mp.getPresentationContext(); model_proxies.put(mp.getPresentationContext(), mp); 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 c6fa54b55..b7f6c3519 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 @@ -1120,6 +1120,14 @@ public class TCFNodeExecContext extends TCFNode implements ISymbolOwner { } } + private void postStackChangedDelta() { + for (TCFModelProxy p : model.getModelProxies()) { + if (IDebugUIConstants.ID_DEBUG_VIEW.equals(p.getPresentationContext().getId())) { + p.addDelta(this, IModelDelta.CONTENT); + } + } + } + void onContextAdded(IRunControl.RunControlContext context) { children_exec.onContextAdded(context); } @@ -1301,6 +1309,16 @@ public class TCFNodeExecContext extends TCFNode implements ISymbolOwner { postContentChangedDelta(); } + void onPreferencesChanged() { + children_stack.onPreferencesChanged(); + postStackChangedDelta(); + } + + void riseTraceLimit() { + children_stack.riseTraceLimit(); + postStackChangedDelta(); + } + private boolean hasSuspendedChildren(SuspendedChildrenInfo info, Runnable done) { if (!children_exec.validate(done)) return false; Map<String,TCFNode> m = children_exec.getData(); diff --git a/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/model/TCFNodeStackFrame.java b/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/model/TCFNodeStackFrame.java index c0cd8c27a..de8809523 100644 --- a/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/model/TCFNodeStackFrame.java +++ b/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/model/TCFNodeStackFrame.java @@ -34,6 +34,7 @@ import org.eclipse.tm.tcf.util.TCFDataCache; public class TCFNodeStackFrame extends TCFNode { private int frame_no; + private boolean trace_limit; private final boolean emulated; private final TCFChildrenRegisters children_regs; private final TCFChildrenLocalVariables children_vars; @@ -182,6 +183,10 @@ public class TCFNodeStackFrame extends TCFNode { this.frame_no = frame_no; } + void setTraceLimit(boolean trace_limit) { + this.trace_limit = trace_limit; + } + TCFChildren getHoverExpressionCache(String expression) { if (expression != hover_expression && (expression == null || !expression.equals(hover_expression))) { hover_expression = expression; @@ -222,6 +227,14 @@ public class TCFNodeStackFrame extends TCFNode { return emulated; } + boolean isTraceLimit() { + return trace_limit; + } + + void riseTraceLimit() { + ((TCFNodeExecContext)parent).riseTraceLimit(); + } + private TCFChildren getChildren(IPresentationContext ctx) { String id = ctx.getId(); if (IDebugUIConstants.ID_REGISTER_VIEW.equals(id)) return children_regs; @@ -271,6 +284,9 @@ public class TCFNodeStackFrame extends TCFNode { if (stack_trace_cache.getData().get(id) == null) { result.setLabel("", 0); } + else if (trace_limit) { + result.setLabel("<select to see more frames>", 0); + } else { TCFDataCache<TCFContextState> state_cache = ((TCFNodeExecContext)parent).getState(); TCFDataCache<TCFNodeExecContext> mem_cache = ((TCFNodeExecContext)parent).getMemoryNode(); diff --git a/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/preferences/TCFDebugPreferencePage.java b/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/preferences/TCFDebugPreferencePage.java index fe9cc6332..a7d05a653 100644 --- a/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/preferences/TCFDebugPreferencePage.java +++ b/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/preferences/TCFDebugPreferencePage.java @@ -40,6 +40,7 @@ public class TCFDebugPreferencePage extends FieldEditorPreferencePage implements parent.setLayout(layout); createPerformanceGroup(parent); + createStackTraceGroup(parent); } private void createPerformanceGroup(Composite parent) { @@ -49,19 +50,6 @@ public class TCFDebugPreferencePage extends FieldEditorPreferencePage implements group.setLayout(layout); group.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - /* TODO: stack limit - IntegerFieldEditor limitEditor = new IntegerWithBooleanFieldEditor( - TCFPreferences.PREF_STACK_FRAME_LIMIT_ENABLED, - TCFPreferences.PREF_STACK_FRAME_LIMIT_VALUE, - "Limit number of stack frames to", - group); - - limitEditor.setValidRange(1, Integer.MAX_VALUE); - limitEditor.setValidateStrategy(IntegerWithBooleanFieldEditor.VALIDATE_ON_FOCUS_LOST); - limitEditor.fillIntoGrid(group, 3); - addField(limitEditor); - */ - BooleanFieldEditor syncSteppingEditor = new BooleanFieldEditor( TCFPreferences.PREF_WAIT_FOR_PC_UPDATE_AFTER_STEP, "Wait for editor marker to update after every step", @@ -122,4 +110,41 @@ public class TCFDebugPreferencePage extends FieldEditorPreferencePage implements group.setLayout(layout); } + + private void createStackTraceGroup(Composite parent) { + Group group = new Group(parent, SWT.NONE); + group.setText("Stack trace"); + GridLayout layout = new GridLayout(3, false); + group.setLayout(layout); + group.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + + BooleanFieldEditor showArgNamesEditor = new BooleanFieldEditor( + TCFPreferences.PREF_STACK_FRAME_ARG_NAMES, + "Show function argument names in stack frames", + group); + + showArgNamesEditor.fillIntoGrid(group, 3); + addField(showArgNamesEditor); + + BooleanFieldEditor showArgValuesEditor = new BooleanFieldEditor( + TCFPreferences.PREF_STACK_FRAME_ARG_VALUES, + "Show function argument values in stack frames", + group); + + showArgValuesEditor.fillIntoGrid(group, 3); + addField(showArgValuesEditor); + + IntegerFieldEditor limitEditor = new IntegerWithBooleanFieldEditor( + TCFPreferences.PREF_STACK_FRAME_LIMIT_ENABLED, + TCFPreferences.PREF_STACK_FRAME_LIMIT_VALUE, + "Limit number of stack frames to", + group); + + limitEditor.setValidRange(1, Integer.MAX_VALUE); + limitEditor.setValidateStrategy(IntegerWithBooleanFieldEditor.VALIDATE_ON_FOCUS_LOST); + limitEditor.fillIntoGrid(group, 3); + addField(limitEditor); + + group.setLayout(layout); + } } diff --git a/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/preferences/TCFPreferences.java b/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/preferences/TCFPreferences.java index 444daaf1e..eaeeb6f1f 100644 --- a/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/preferences/TCFPreferences.java +++ b/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/preferences/TCFPreferences.java @@ -18,6 +18,8 @@ public class TCFPreferences { public static final String PREF_STACK_FRAME_LIMIT_ENABLED = "StackFrameLimitEnabled", PREF_STACK_FRAME_LIMIT_VALUE = "StackFrameLimitValue", + PREF_STACK_FRAME_ARG_NAMES = "StackFrameArgNames", + PREF_STACK_FRAME_ARG_VALUES = "StackFrameArgValues", PREF_WAIT_FOR_PC_UPDATE_AFTER_STEP = "WaitForPCUpdateAfterStep", PREF_WAIT_FOR_VIEWS_UPDATE_AFTER_STEP = "WaitForViewsUpdateAfterStep", PREF_DELAY_STACK_UPDATE_UNTIL_LAST_STEP = "DelayStackUpdateUntilLastStep", diff --git a/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/preferences/TCFPreferencesInitializer.java b/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/preferences/TCFPreferencesInitializer.java index 0e2873610..a42df7751 100644 --- a/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/preferences/TCFPreferencesInitializer.java +++ b/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/preferences/TCFPreferencesInitializer.java @@ -19,8 +19,10 @@ public class TCFPreferencesInitializer extends AbstractPreferenceInitializer { public void initializeDefaultPreferences() { IPreferenceStore prefs = TCFPreferences.getPreferenceStore(); - prefs.setDefault(TCFPreferences.PREF_STACK_FRAME_LIMIT_ENABLED, false); + prefs.setDefault(TCFPreferences.PREF_STACK_FRAME_LIMIT_ENABLED, true); prefs.setDefault(TCFPreferences.PREF_STACK_FRAME_LIMIT_VALUE, 10); + prefs.setDefault(TCFPreferences.PREF_STACK_FRAME_ARG_NAMES, false); + prefs.setDefault(TCFPreferences.PREF_STACK_FRAME_ARG_VALUES, false); prefs.setDefault(TCFPreferences.PREF_WAIT_FOR_PC_UPDATE_AFTER_STEP, true); prefs.setDefault(TCFPreferences.PREF_WAIT_FOR_VIEWS_UPDATE_AFTER_STEP, false); prefs.setDefault(TCFPreferences.PREF_DELAY_STACK_UPDATE_UNTIL_LAST_STEP, false); |