From 4423721302a17bac76bd3d85264ebc7e84b30236 Mon Sep 17 00:00:00 2001 From: Eugene Tarassov Date: Tue, 25 Sep 2012 14:13:06 -0700 Subject: TCF Debugger: fixed: invalid symbols data could lock debugger UI --- .../eclipse/tcf/internal/debug/ui/commands/BreakpointCommand.java | 7 +++++-- .../eclipse/tcf/internal/debug/ui/model/TCFNodeExpression.java | 8 +++++++- 2 files changed, 12 insertions(+), 3 deletions(-) (limited to 'plugins') diff --git a/plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/commands/BreakpointCommand.java b/plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/commands/BreakpointCommand.java index 983132ab8..706f889e9 100644 --- a/plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/commands/BreakpointCommand.java +++ b/plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/commands/BreakpointCommand.java @@ -19,6 +19,7 @@ import org.eclipse.debug.ui.actions.IToggleBreakpointsTargetExtension; import org.eclipse.jface.viewers.ISelection; import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.tcf.internal.debug.model.TCFBreakpoint; +import org.eclipse.tcf.internal.debug.ui.model.TCFNode; import org.eclipse.tcf.internal.debug.ui.model.TCFNodeExecContext; import org.eclipse.tcf.internal.debug.ui.model.TCFNodeStackFrame; import org.eclipse.tcf.services.IBreakpoints; @@ -32,7 +33,8 @@ public class BreakpointCommand implements IToggleBreakpointsTargetExtension { public boolean canToggleBreakpoints(IWorkbenchPart part, ISelection selection) { if (selection.isEmpty()) return false; final Object obj = ((IStructuredSelection)selection).getFirstElement(); - return new TCFTask() { + if (!(obj instanceof TCFNode)) return false; + return new TCFTask(((TCFNode)obj).getChannel()) { public void run() { TCFDataCache addr_cache = null; if (obj instanceof TCFNodeExecContext) addr_cache = ((TCFNodeExecContext)obj).getAddress(); @@ -51,7 +53,8 @@ public class BreakpointCommand implements IToggleBreakpointsTargetExtension { public void toggleBreakpoints(IWorkbenchPart part, ISelection selection) { if (selection.isEmpty()) return; final Object obj = ((IStructuredSelection)selection).getFirstElement(); - new TCFTask() { + if (!(obj instanceof TCFNode)) return; + new TCFTask(((TCFNode)obj).getChannel()) { public void run() { TCFDataCache addr_cache = null; if (obj instanceof TCFNodeExecContext) addr_cache = ((TCFNodeExecContext)obj).getAddress(); 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 e1a3b016d..ef84e310d 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 @@ -918,6 +918,12 @@ public class TCFNodeExpression extends TCFNode implements IElementEditor, ICastT if (!get_base_type) break; + if (name.length() > 0x1000) { + /* Must be invalid symbols data */ + name = ""; + break; + } + type_cache = model.getSymbolInfoCache(type_symbol.getBaseTypeID()); if (type_cache == null) { name = " " + name; @@ -1638,7 +1644,7 @@ public class TCFNodeExpression extends TCFNode implements IElementEditor, ICastT public boolean canModify(Object element, final String property) { final TCFNodeExpression node = (TCFNodeExpression)element; - return new TCFTask() { + return new TCFTask(node.channel) { public void run() { if (TCFColumnPresentationExpression.COL_NAME.equals(property)) { done(node.is_empty || node.script != null); -- cgit v1.2.3