From f3e2d73cd294b203a4464499144e21872dfa0618 Mon Sep 17 00:00:00 2001 From: Ken Ryall Date: Wed, 31 Jan 2007 20:16:00 +0000 Subject: [PATCH] Added support for breakpoint problem markers, bug 170027. --- .../cdi/event/ICDIBreakpointMovedEvent.java | 26 +++ .../cdi/event/ICDIBreakpointProblemEvent.java | 57 ++++++ .../plugin.properties | 6 +- debug/org.eclipse.cdt.debug.core/plugin.xml | 15 ++ .../internal/core/CBreakpointManager.java | 65 ++++++- .../core/breakpoints/BreakpointProblems.java | 181 ++++++++++++++++++ .../internal/core/model/CDebugTarget.java | 17 +- debug/org.eclipse.cdt.debug.ui/plugin.xml | 11 +- 8 files changed, 370 insertions(+), 8 deletions(-) create mode 100644 debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/event/ICDIBreakpointMovedEvent.java create mode 100644 debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/event/ICDIBreakpointProblemEvent.java create mode 100644 debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/breakpoints/BreakpointProblems.java diff --git a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/event/ICDIBreakpointMovedEvent.java b/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/event/ICDIBreakpointMovedEvent.java new file mode 100644 index 00000000000..4329e90ad1c --- /dev/null +++ b/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/event/ICDIBreakpointMovedEvent.java @@ -0,0 +1,26 @@ +/******************************************************************************* + * Copyright (c) 2007 Nokia 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 + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nokia - Initial API and implementation + *******************************************************************************/ +package org.eclipse.cdt.debug.core.cdi.event; + +import org.eclipse.cdt.debug.core.cdi.ICDILocator; + +/** + * + * Notifies that a breakpoint has changed location. + */ + +public interface ICDIBreakpointMovedEvent extends ICDIEvent { + + /** Returns the new location for the breakpoint. + * @return the breakpoint's new location. + */ + ICDILocator getNewLocation(); +} diff --git a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/event/ICDIBreakpointProblemEvent.java b/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/event/ICDIBreakpointProblemEvent.java new file mode 100644 index 00000000000..827fbd73730 --- /dev/null +++ b/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/event/ICDIBreakpointProblemEvent.java @@ -0,0 +1,57 @@ +/******************************************************************************* + * Copyright (c) 2007 Nokia 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 + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nokia - Initial API and implementation + *******************************************************************************/ +package org.eclipse.cdt.debug.core.cdi.event; + +import org.eclipse.cdt.debug.core.cdi.model.ICDIBreakpoint; + +/** + * + * Notifies that a breakpoint problem has occurred. + */ +public interface ICDIBreakpointProblemEvent { + + /** The problem type is a string that identifies specific + * kinds of breakproblems. + * @return problem type name + */ + String getProblemType(); + + /** The CDI breakpoint that has the problem + * @return the cdi breakpoint that has the problem + */ + ICDIBreakpoint getBreakpoint(); + + /** A description of the problem. + * This will be presented in the problems view. + * @return a description of the problem + */ + String getDescription(); + + /** The severity code maps to the IMarker.SEVERITY_XXX constants. + * @return severity code. + */ + int getSeverity(); + + /** Indicated that existing problems of this type and at this + * breakpoint's location will be removed, no new ones will + * be added. + * @return only remove existing problems + */ + boolean removeOnly(); + + /** Indicated that any existing problems of this type + * and at this breakpoint's location will be removed + * before the new problem is added. + * @return remove any existing markers + */ + boolean removeExisting(); + +} diff --git a/debug/org.eclipse.cdt.debug.core/plugin.properties b/debug/org.eclipse.cdt.debug.core/plugin.properties index 1fe0ca2488f..7c79e03bdd2 100644 --- a/debug/org.eclipse.cdt.debug.core/plugin.properties +++ b/debug/org.eclipse.cdt.debug.core/plugin.properties @@ -1,5 +1,5 @@ ############################################################################### -# Copyright (c) 2000, 2006 QNX Software Systems and others. +# Copyright (c) 2000, 2007 QNX Software Systems 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 @@ -7,7 +7,8 @@ # # Contributors: # QNX Software Systems - Initial API and implementation -# Nokia - Added support for AbsoluteSourceContainer( 159833 ) +# Ken Ryall (Nokia) - Added support for AbsoluteSourceContainer( 159833 ) +# Ken Ryall (Nokia) - Added support for breakpoint problems( 170027 ) ############################################################################### pluginName=C/C++ Development Tools Debug Model providerName=Eclipse.org @@ -18,6 +19,7 @@ cLineBreakpoints.name=C/C++ Line Breakpoints cAddressBreakpoints.name=C/C++ Address Breakpoints cFunctionBreakpoints.name=C/C++ Function Breakpoints cWatchpoints.name=C/C++ Watchpoints +breakpointProblem.name=C/C++ Breakpoint Problem containerName.mapping=Path Mapping containerDescription.mapping=A path mapping. diff --git a/debug/org.eclipse.cdt.debug.core/plugin.xml b/debug/org.eclipse.cdt.debug.core/plugin.xml index e0c2c26b605..e8e5214c89e 100644 --- a/debug/org.eclipse.cdt.debug.core/plugin.xml +++ b/debug/org.eclipse.cdt.debug.core/plugin.xml @@ -97,6 +97,21 @@ name="org.eclipse.cdt.debug.core.read"> + + + + + + + + + 0)) { + for (int i = 0; i < cur.length; i++) { + int line = ((Integer) cur[i].getAttribute(IMarker.LOCATION)).intValue(); + int sev = ((Integer) cur[i].getAttribute(IMarker.SEVERITY)).intValue(); + String mesg = (String) cur[i].getAttribute(IMarker.MESSAGE); + if (line == problemMarkerInfo.lineNumber && sev == problemMarkerInfo.severity && mesg.equals(problemMarkerInfo.description)) { + return cur[i]; + } + } + } + + IMarker marker = markerResource.createMarker(BREAKPOINT_PROBLEM_MARKER_ID); + marker.setAttribute(IMarker.LOCATION, problemMarkerInfo.lineNumber); + marker.setAttribute(IMarker.MESSAGE, problemMarkerInfo.description); + marker.setAttribute(IMarker.SEVERITY, problemMarkerInfo.severity); + marker.setAttribute(IMarker.LINE_NUMBER, problemMarkerInfo.lineNumber); + marker.setAttribute(IMarker.CHAR_START, -1); + marker.setAttribute(IMarker.CHAR_END, -1); + if (problemMarkerInfo.variableName != null) { + marker.setAttribute(ICModelMarker.C_MODEL_MARKER_VARIABLE, problemMarkerInfo.variableName); + } + if (problemMarkerInfo.externalPath != null) { + marker.setAttribute(ICModelMarker.C_MODEL_MARKER_EXTERNAL_LOCATION, problemMarkerInfo.externalPath.toOSString()); + } + + return marker; + + } catch (CoreException e) {} + return null; + } + +} diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CDebugTarget.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CDebugTarget.java index 0d994c637ca..b5d69f0f546 100644 --- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CDebugTarget.java +++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CDebugTarget.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2006 QNX Software Systems and others. + * Copyright (c) 2000, 2007 QNX Software Systems 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 @@ -7,7 +7,7 @@ * * Contributors: * QNX Software Systems - Initial API and implementation - * Ken Ryall (Nokia) - https://bugs.eclipse.org/bugs/show_bug.cgi?id=118894 + * Ken Ryall (Nokia) - bugs 118894, 170027 *******************************************************************************/ package org.eclipse.cdt.debug.internal.core.model; @@ -224,6 +224,13 @@ public class CDebugTarget extends CDebugElement implements ICDebugTarget, ICDIEv */ private CMemoryBlockRetrievalExtension fMemoryBlockRetrieval; + /** + * Internal ID that uniquely identifies this CDebugTarget. + */ + private String internalD = Integer.toString(lastInternalID++); + + private static int lastInternalID = 1; + /** * Constructor for CDebugTarget. */ @@ -1804,4 +1811,8 @@ public class CDebugTarget extends CDebugElement implements ICDebugTarget, ICDIEv if ( mm != null ) mm.loadSymbolsForAllModules(); } -} + + public String getInternalID() { + return internalD; + } +} \ No newline at end of file diff --git a/debug/org.eclipse.cdt.debug.ui/plugin.xml b/debug/org.eclipse.cdt.debug.ui/plugin.xml index 79dc3225fdd..6e261973f58 100644 --- a/debug/org.eclipse.cdt.debug.ui/plugin.xml +++ b/debug/org.eclipse.cdt.debug.ui/plugin.xml @@ -72,11 +72,20 @@ + + + + - +