From 8c0bc30f909d48f8e95d0aaf7d1b20d26dd69173 Mon Sep 17 00:00:00 2001 From: Eugene Tarassov Date: Wed, 5 Mar 2014 09:47:23 -0800 Subject: TCF Debugger: show more info about breakpoint in the Debug view when a context is stopped by a breakpoint hit --- .../cdt/ui/breakpoints/TCFThreadFilterEditor.java | 4 +- .../debug/ui/commands/MemoryMapWidget.java | 14 +++---- .../debug/ui/model/TCFAnnotationManager.java | 2 - .../debug/ui/model/TCFNodeExecContext.java | 44 +++++++++++++++++++--- .../internal/debug/model/TCFBreakpointsModel.java | 8 ++-- 5 files changed, 52 insertions(+), 20 deletions(-) (limited to 'plugins') diff --git a/plugins/org.eclipse.tcf.cdt.ui/src/org/eclipse/tcf/internal/cdt/ui/breakpoints/TCFThreadFilterEditor.java b/plugins/org.eclipse.tcf.cdt.ui/src/org/eclipse/tcf/internal/cdt/ui/breakpoints/TCFThreadFilterEditor.java index 0726be33b..07dad8386 100644 --- a/plugins/org.eclipse.tcf.cdt.ui/src/org/eclipse/tcf/internal/cdt/ui/breakpoints/TCFThreadFilterEditor.java +++ b/plugins/org.eclipse.tcf.cdt.ui/src/org/eclipse/tcf/internal/cdt/ui/breakpoints/TCFThreadFilterEditor.java @@ -485,7 +485,7 @@ public class TCFThreadFilterEditor { fThreadViewer.refresh(); fFilteredContexts.clear(); for (Context ctx : fContexts) { - fCheckHandler.updateParentCheckState(ctx); + fCheckHandler.updateParentCheckState(ctx); } } } @@ -511,7 +511,7 @@ public class TCFThreadFilterEditor { else { String result = null; TCFContextQueryExpressionDialog dlg = new TCFContextQueryExpressionDialog(parentShell, attrsList, scopeExprCombo.getText()); - + if (dlg.open() == Window.OK) { result = dlg.getExpression(); } diff --git a/plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/commands/MemoryMapWidget.java b/plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/commands/MemoryMapWidget.java index 9b73f27b6..104515d33 100644 --- a/plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/commands/MemoryMapWidget.java +++ b/plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/commands/MemoryMapWidget.java @@ -311,7 +311,7 @@ public class MemoryMapWidget { /* * (non-Javadoc) - * + * * @see * org.eclipse.jface.viewers.ITableFontProvider#getFont(java.lang.Object * , int) @@ -336,7 +336,7 @@ public class MemoryMapWidget { /* * (non-Javadoc) - * + * * @see * org.eclipse.tcf.services.IMemoryMap.MemoryMapListener#changed(java * .lang.String) @@ -993,7 +993,7 @@ public class MemoryMapWidget { if (region != null && region.getProperties().containsKey("_CHILDREN")) { //$NON-NLS-1$ region = (IMemoryMap.MemoryRegion)((Object[])region.getProperties().get("_CHILDREN"))[0]; //$NON-NLS-1$ } - final IMemoryMap.MemoryRegion r = region; + final IMemoryMap.MemoryRegion r = region; if (channel == null || channel.getState() != IChannel.STATE_OPEN || r == null || r.getAddress() == null) return null; try { String symFileInfo = new TCFTask(channel) { @@ -1044,7 +1044,7 @@ public class MemoryMapWidget { done(symbolFileInfo.length() > 0 ? symbolFileInfo.toString() : null); } }.get(); - + if (symFileInfo.startsWith(r.getFileName())) { String id = symFileInfo.split(", ")[1]; //$NON-NLS-1$ symFileInfo = null; @@ -1058,7 +1058,7 @@ public class MemoryMapWidget { } } } - + return symFileInfo; } catch (Exception x) { @@ -1070,14 +1070,14 @@ public class MemoryMapWidget { protected TCFLaunch findLaunch() { for (ILaunch launch : DebugPlugin.getDefault().getLaunchManager().getLaunches()) { - if (launch instanceof TCFLaunch && + if (launch instanceof TCFLaunch && launch.getLaunchConfiguration().equals(cfg instanceof ILaunchConfigurationWorkingCopy ? ((ILaunchConfigurationWorkingCopy)cfg).getOriginal() : cfg)) { return (TCFLaunch)launch; } } return null; } - + private void loadTargetMemoryNodes() { target_map_nodes.clear(); if (channel == null || channel.getState() != IChannel.STATE_OPEN) return; 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 9377d044c..763eea0cb 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 @@ -710,8 +710,6 @@ public class TCFAnnotationManager { String bp_name = "Breakpoint"; IBreakpoint bp = TCFBreakpointsModel.getBreakpointsModel().getBreakpoint(id); if (bp != null) bp_name = bp.getMarker().getAttribute(TCFBreakpointsModel.ATTR_MESSAGE, bp_name); - int i = bp_name.indexOf(':'); - if (i > 0) bp_name = bp_name.substring(0, i); if (error != null) { String location = ""; if (addr != null) location = " at 0x" + addr.toString(16); 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 e02f7b144..5bae32dbb 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, 2013 Wind River Systems, Inc. and others. + * Copyright (c) 2007, 2014 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 @@ -19,6 +19,9 @@ import java.util.LinkedHashMap; import java.util.Map; import java.util.Set; +import org.eclipse.core.resources.IMarker; +import org.eclipse.core.runtime.Path; +import org.eclipse.debug.core.model.IBreakpoint; import org.eclipse.debug.internal.ui.viewers.model.provisional.IChildrenCountUpdate; import org.eclipse.debug.internal.ui.viewers.model.provisional.IChildrenUpdate; import org.eclipse.debug.internal.ui.viewers.model.provisional.IHasChildrenUpdate; @@ -32,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.model.TCFBreakpointsModel; import org.eclipse.tcf.internal.debug.model.TCFContextState; import org.eclipse.tcf.internal.debug.model.TCFFunctionRef; import org.eclipse.tcf.internal.debug.model.TCFSourceRef; @@ -1169,11 +1173,39 @@ public class TCFNodeExecContext extends TCFNode implements ISymbolOwner, ITCFExe image_name = ImageCache.IMG_THREAD_SUSPENDED; String s = null; String r = model.getContextActionResult(id); - if (r == null) { - r = state_data.suspend_reason; - if (state_data.suspend_params != null) { - s = (String)state_data.suspend_params.get(IRunControl.STATE_SIGNAL_DESCRIPTION); - if (s == null) s = (String)state_data.suspend_params.get(IRunControl.STATE_SIGNAL_NAME); + if (r == null) r = state_data.suspend_reason; + if (state_data.suspend_params != null) { + s = (String)state_data.suspend_params.get(IRunControl.STATE_SIGNAL_DESCRIPTION); + if (s == null) s = (String)state_data.suspend_params.get(IRunControl.STATE_SIGNAL_NAME); + Object ids = state_data.suspend_params.get(IRunControl.STATE_BREAKPOINT_IDS); + if (ids != null) { + @SuppressWarnings("unchecked") + Collection bp_ids = (Collection)ids; + TCFBreakpointsModel bp_model = TCFBreakpointsModel.getBreakpointsModel(); + for (String bp_id : bp_ids) { + IBreakpoint bp = bp_model.getBreakpoint(bp_id); + if (bp != null) { + String bp_name = null; + IMarker m = bp.getMarker(); + if (m != null) { + bp_name = m.getAttribute(TCFBreakpointsModel.ATTR_ADDRESS, null); + if (bp_name == null) bp_name = m.getAttribute(TCFBreakpointsModel.ATTR_FUNCTION, null); + if (bp_name == null) bp_name = m.getAttribute(TCFBreakpointsModel.ATTR_EXPRESSION, null); + if (bp_name == null) { + String file = m.getAttribute(TCFBreakpointsModel.ATTR_REQESTED_FILE, null); + int line = m.getAttribute(TCFBreakpointsModel.ATTR_REQESTED_LINE, 0); + if (file == null) file = m.getAttribute(TCFBreakpointsModel.ATTR_FILE, null); + if (line == 0) line = m.getAttribute(TCFBreakpointsModel.ATTR_LINE, 0); + if (file != null && line > 0) { + bp_name = new Path(file).lastSegment() + ":" + line; + } + } + } + if (bp_name == null) bp_name = bp_id; + if (s == null) s = bp_name; + else s = s + ", " + bp_name; + } + } } } suspended_by_bp = IRunControl.REASON_BREAKPOINT.equals(r); diff --git a/plugins/org.eclipse.tcf.debug/src/org/eclipse/tcf/internal/debug/model/TCFBreakpointsModel.java b/plugins/org.eclipse.tcf.debug/src/org/eclipse/tcf/internal/debug/model/TCFBreakpointsModel.java index dc206d58b..7f7227a23 100644 --- a/plugins/org.eclipse.tcf.debug/src/org/eclipse/tcf/internal/debug/model/TCFBreakpointsModel.java +++ b/plugins/org.eclipse.tcf.debug/src/org/eclipse/tcf/internal/debug/model/TCFBreakpointsModel.java @@ -553,9 +553,6 @@ public class TCFBreakpointsModel { m.put(IBreakpoint.REGISTERED, Boolean.TRUE); m.put(IBreakpoint.PERSISTED, Boolean.TRUE); m.put(IBreakpoint.ID, ITCFConstants.ID_TCF_DEBUG_MODEL); - String msg = ""; - if (location != null) msg += location; - m.put(ATTR_MESSAGE, "Breakpoint: " + msg); String file = (String)p.get(IBreakpoints.PROP_FILE); if (file != null && file.length() > 0) { m.put(ATTR_FILE, file); @@ -596,6 +593,11 @@ public class TCFBreakpointsModel { } m.put(ATTR_TYPE, cdt_type); } + String msg = null; + if (location != null) msg = location; + else if (file != null && line != null) msg = file + ":" + line; + else msg = (String)p.get(IBreakpoints.PROP_ID); + m.put(ATTR_MESSAGE, "Breakpoint: " + msg); m.put(ATTR_TCF_STAMP, Boolean.TRUE.toString()); return m; -- cgit v1.2.3