Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKen Ryall2007-11-05 15:36:46 +0000
committerKen Ryall2007-11-05 15:36:46 +0000
commit66cbf5bea76ae03baf9d4b487dfa3473b980cfb2 (patch)
treeb5394db27471b6121f3d20ec74921a37f8d7a573 /debug/org.eclipse.cdt.debug.core
parent72767211236dc7199a3c061936f9212e650855ad (diff)
downloadorg.eclipse.cdt-66cbf5bea76ae03baf9d4b487dfa3473b980cfb2.tar.gz
org.eclipse.cdt-66cbf5bea76ae03baf9d4b487dfa3473b980cfb2.tar.xz
org.eclipse.cdt-66cbf5bea76ae03baf9d4b487dfa3473b980cfb2.zip
Bug 118299, improved watchpoint support.
Diffstat (limited to 'debug/org.eclipse.cdt.debug.core')
-rw-r--r--debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDIBreakpointManagement2.java20
-rw-r--r--debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDIWatchpoint2.java41
-rw-r--r--debug/org.eclipse.cdt.debug.core/plugin.xml6
-rw-r--r--debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/CDIDebugModel.java62
-rw-r--r--debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/CDebugUtils.java23
-rw-r--r--debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/DebugCoreMessages.properties3
-rw-r--r--debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/model/ICWatchpoint2.java48
-rw-r--r--debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/CBreakpointManager.java71
-rw-r--r--debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/breakpoints/CWatchpoint.java22
9 files changed, 265 insertions, 31 deletions
diff --git a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDIBreakpointManagement2.java b/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDIBreakpointManagement2.java
index e12e252f566..424ce84c056 100644
--- a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDIBreakpointManagement2.java
+++ b/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDIBreakpointManagement2.java
@@ -7,17 +7,20 @@
*
* Contributors:
* Nokia - Initial API and implementation
+ * Freescale Semiconductor - Address watchpoints, https://bugs.eclipse.org/bugs/show_bug.cgi?id=118299
*******************************************************************************/
package org.eclipse.cdt.debug.core.cdi.model;
+import java.math.BigInteger;
+
import org.eclipse.cdt.debug.core.cdi.CDIException;
import org.eclipse.cdt.debug.core.cdi.ICDIAddressLocation;
import org.eclipse.cdt.debug.core.cdi.ICDICondition;
import org.eclipse.cdt.debug.core.cdi.ICDIFunctionLocation;
import org.eclipse.cdt.debug.core.cdi.ICDILineLocation;
-public interface ICDIBreakpointManagement2 {
+public interface ICDIBreakpointManagement2 extends ICDIBreakpointManagement {
/**
* Set a line breakpoint.
@@ -76,6 +79,21 @@ public interface ICDIBreakpointManagement2 {
ICDICondition condition, boolean enabled) throws CDIException;
/**
+ * Set a watchpoint.
+ *
+ * @param type
+ * @param watchType
+ * @param expression
+ * @param memorySpace set to "" for default memorySpace
+ * @param range set to "" for default range
+ * @param condition
+ * @return
+ * @throws CDIException
+ */
+ ICDIWatchpoint setWatchpoint(int type, int watchType, String expression, String memorySpace, BigInteger range,
+ ICDICondition condition, boolean enabled) throws CDIException;
+
+ /**
* Set an exception point.
*
* @param clazz
diff --git a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDIWatchpoint2.java b/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDIWatchpoint2.java
new file mode 100644
index 00000000000..c3f9f946c48
--- /dev/null
+++ b/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDIWatchpoint2.java
@@ -0,0 +1,41 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Freescale Semiconductor 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:
+ * Freescale Semiconductor - Initial API and implementation, https://bugs.eclipse.org/bugs/show_bug.cgi?id=118299
+ *******************************************************************************/
+
+package org.eclipse.cdt.debug.core.cdi.model;
+
+import java.math.BigInteger;
+import org.eclipse.cdt.debug.core.cdi.CDIException;
+
+/**
+ *
+ * Represents a watchpoint.
+ *
+ */
+public interface ICDIWatchpoint2 extends ICDIWatchpoint {
+
+ /**
+ * Returns the memory space associated with this
+ * watchpoint's start address, or null if there is no memory space.
+ *
+ * @return the memory space Id associated with the address of
+ * this watchpoint
+ * @throws CDIException if this method fails. Reasons include:
+ */
+ String getMemorySpace() throws CDIException;
+
+ /**
+ * Returns the range for this watchpoint in addressable units.
+ *
+ * @return the range of the watchpoint.
+ * @throws CDIException if this method fails. Reasons include:
+ */
+ BigInteger getRange() throws CDIException;
+}
diff --git a/debug/org.eclipse.cdt.debug.core/plugin.xml b/debug/org.eclipse.cdt.debug.core/plugin.xml
index 92a842e1c1e..c81340d9808 100644
--- a/debug/org.eclipse.cdt.debug.core/plugin.xml
+++ b/debug/org.eclipse.cdt.debug.core/plugin.xml
@@ -92,6 +92,12 @@
name="org.eclipse.cdt.debug.core.expression">
</attribute>
<attribute
+ name="org.eclipse.cdt.debug.core.memoryspace">
+ </attribute>
+ <attribute
+ name="org.eclipse.cdt.debug.core.range">
+ </attribute>
+ <attribute
name="org.eclipse.cdt.debug.core.write">
</attribute>
<attribute
diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/CDIDebugModel.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/CDIDebugModel.java
index 60c8113fbf7..e3bda5fcb80 100644
--- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/CDIDebugModel.java
+++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/CDIDebugModel.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2006 QNX Software Systems and others.
+ * Copyright (c) 2004, 2006-7 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,10 +7,12 @@
*
* Contributors:
* QNX Software Systems - Initial API and implementation
+ * Freescale Semiconductor - Address watchpoints, https://bugs.eclipse.org/bugs/show_bug.cgi?id=118299
*******************************************************************************/
package org.eclipse.cdt.debug.core;
import java.io.IOException;
+import java.math.BigInteger;
import java.util.HashMap;
import org.eclipse.cdt.core.CCorePlugin;
import org.eclipse.cdt.core.IAddress;
@@ -24,6 +26,7 @@ import org.eclipse.cdt.debug.core.model.ICAddressBreakpoint;
import org.eclipse.cdt.debug.core.model.ICBreakpoint;
import org.eclipse.cdt.debug.core.model.ICFunctionBreakpoint;
import org.eclipse.cdt.debug.core.model.ICLineBreakpoint;
+import org.eclipse.cdt.debug.core.model.ICWatchpoint2;
import org.eclipse.cdt.debug.core.model.ICWatchpoint;
import org.eclipse.cdt.debug.internal.core.breakpoints.CAddressBreakpoint;
import org.eclipse.cdt.debug.internal.core.breakpoints.CFunctionBreakpoint;
@@ -284,14 +287,7 @@ public class CDIDebugModel {
*/
public static ICWatchpoint createWatchpoint( String sourceHandle, IResource resource, boolean writeAccess, boolean readAccess, String expression, boolean enabled, int ignoreCount, String condition, boolean register ) throws CoreException {
HashMap attributes = new HashMap( 10 );
- attributes.put( IBreakpoint.ID, getPluginIdentifier() );
- attributes.put( IBreakpoint.ENABLED, Boolean.valueOf( enabled ) );
- attributes.put( ICBreakpoint.IGNORE_COUNT, new Integer( ignoreCount ) );
- attributes.put( ICBreakpoint.CONDITION, condition );
- attributes.put( ICBreakpoint.SOURCE_HANDLE, sourceHandle );
- attributes.put( ICWatchpoint.EXPRESSION, expression );
- attributes.put( ICWatchpoint.READ, Boolean.valueOf( readAccess ) );
- attributes.put( ICWatchpoint.WRITE, Boolean.valueOf( writeAccess ) );
+ setAttributes( attributes, sourceHandle, resource, writeAccess, readAccess, expression, "", BigInteger.ZERO, enabled, ignoreCount, condition, register );
return new CWatchpoint( resource, attributes, register );
}
@@ -314,6 +310,8 @@ public class CDIDebugModel {
* @param writeAccess whether this is write watchpoint
* @param readAccess whether this is read watchpoint
* @param expression the expression on which the watchpoint is set
+ * @param memorySpace the memory space in which the watchpoint is set
+ * @param range the range of the watchpoint in addressable units
* @param enabled whether to enable or disable this breakpoint
* @param ignoreCount the number of times this breakpoint will be ignored
* @param condition the breakpoint condition
@@ -326,20 +324,60 @@ public class CDIDebugModel {
* failure.</li>
* </ul>
*/
- public static ICWatchpoint createWatchpoint( String sourceHandle, IResource resource, int charStart, int charEnd, int lineNumber, boolean writeAccess, boolean readAccess, String expression, boolean enabled, int ignoreCount, String condition, boolean register ) throws CoreException {
+ public static ICWatchpoint createWatchpoint( String sourceHandle, IResource resource, int charStart, int charEnd, int lineNumber, boolean writeAccess, boolean readAccess, String expression, String memorySpace, BigInteger range, boolean enabled, int ignoreCount, String condition, boolean register ) throws CoreException {
HashMap attributes = new HashMap( 10 );
- attributes.put( IBreakpoint.ID, getPluginIdentifier() );
+ setAttributes( attributes, sourceHandle, resource, writeAccess, readAccess, expression, memorySpace, range, enabled, ignoreCount, condition, register );
attributes.put( IMarker.CHAR_START, new Integer( charStart ) );
attributes.put( IMarker.CHAR_END, new Integer( charEnd ) );
attributes.put( IMarker.LINE_NUMBER, new Integer( lineNumber ) );
+ return new CWatchpoint( resource, attributes, register );
+ }
+
+ /**
+ * Creates and returns a watchpoint for the source defined by the given
+ * source handle, at the given expression and over the given range.
+ * The marker associated with the watchpoint will be created on the
+ * specified resource.
+ *
+ * @param sourceHandle the handle to the watchpoint source
+ * @param resource the resource on which to create the associated watchpoint marker
+ * @param writeAccess whether this is write watchpoint
+ * @param readAccess whether this is read watchpoint
+ * @param expression the expression on which the watchpoint is set
+ * @param memorySpace the memory space in which the watchpoint is set
+ * @param range the range of the watchpoint in addressable units
+ * @param enabled whether to enable or disable this breakpoint
+ * @param ignoreCount the number of times this breakpoint will be ignored
+ * @param condition the breakpoint condition
+ * @param register whether to add this breakpoint to the breakpoint manager
+ * @return the watchpoint that was created
+ * @throws CoreException if this method fails. Reasons include:
+ * <ul>
+ * <li>Failure creating underlying marker. The exception's
+ * status contains the underlying exception responsible for the
+ * failure.</li>
+ * </ul>
+ */
+ public static ICWatchpoint createWatchpoint( String sourceHandle, IResource resource, boolean writeAccess, boolean readAccess, String expression, String memorySpace, BigInteger range, boolean enabled, int ignoreCount, String condition, boolean register ) throws CoreException {
+ HashMap attributes = new HashMap( 10 );
+ setAttributes( attributes, sourceHandle, resource, writeAccess, readAccess, expression, memorySpace, range, enabled, ignoreCount, condition, register );
+ return new CWatchpoint( resource, attributes, register );
+ }
+
+ /**
+ * Helper function for setting common attributes.
+ */
+ private static void setAttributes( HashMap attributes, String sourceHandle, IResource resource, boolean writeAccess, boolean readAccess, String expression, String memorySpace, BigInteger range, boolean enabled, int ignoreCount, String condition, boolean register ) {
+ attributes.put( IBreakpoint.ID, getPluginIdentifier() );
attributes.put( IBreakpoint.ENABLED, Boolean.valueOf( enabled ) );
attributes.put( ICBreakpoint.IGNORE_COUNT, new Integer( ignoreCount ) );
attributes.put( ICBreakpoint.CONDITION, condition );
attributes.put( ICBreakpoint.SOURCE_HANDLE, sourceHandle );
attributes.put( ICWatchpoint.EXPRESSION, expression );
+ attributes.put( ICWatchpoint2.MEMORYSPACE, memorySpace );
+ attributes.put( ICWatchpoint2.RANGE, range.toString() );
attributes.put( ICWatchpoint.READ, Boolean.valueOf( readAccess ) );
attributes.put( ICWatchpoint.WRITE, Boolean.valueOf( writeAccess ) );
- return new CWatchpoint( resource, attributes, register );
}
/**
diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/CDebugUtils.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/CDebugUtils.java
index 45239286eb6..19840592824 100644
--- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/CDebugUtils.java
+++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/CDebugUtils.java
@@ -7,6 +7,7 @@
*
* Contributors:
* QNX Software Systems - Initial API and implementation
+ * Freescale Semiconductor - Address watchpoints, https://bugs.eclipse.org/bugs/show_bug.cgi?id=118299
*******************************************************************************/
package org.eclipse.cdt.debug.core;
@@ -30,6 +31,7 @@ import org.eclipse.cdt.debug.core.model.ICAddressBreakpoint;
import org.eclipse.cdt.debug.core.model.ICBreakpoint;
import org.eclipse.cdt.debug.core.model.ICFunctionBreakpoint;
import org.eclipse.cdt.debug.core.model.ICLineBreakpoint;
+import org.eclipse.cdt.debug.core.model.ICWatchpoint2;
import org.eclipse.cdt.debug.core.model.ICValue;
import org.eclipse.cdt.debug.core.model.ICWatchpoint;
import org.eclipse.cdt.debug.internal.core.model.CFloatingPointValue;
@@ -327,6 +329,11 @@ public class CDebugUtils {
StringBuffer label = new StringBuffer();
appendSourceName( watchpoint, label, qualified );
appendWatchExpression( watchpoint, label );
+ if ( watchpoint instanceof ICWatchpoint2 ) {
+ ICWatchpoint2 wp2 = (ICWatchpoint2)watchpoint;
+ appendWatchMemorySpace( wp2, label );
+ appendWatchRange( wp2, label );
+ }
appendIgnoreCount( watchpoint, label );
appendCondition( watchpoint, label );
return label.toString();
@@ -414,6 +421,22 @@ public class CDebugUtils {
}
}
+ private static void appendWatchMemorySpace( ICWatchpoint2 watchpoint, StringBuffer label ) throws CoreException {
+ String memorySpace = watchpoint.getMemorySpace();
+ if ( memorySpace != null && memorySpace.length() > 0 ) {
+ label.append( ' ' );
+ label.append( MessageFormat.format( DebugCoreMessages.getString( "CDebugUtils.6" ), new String[] { memorySpace } ) ); //$NON-NLS-1$
+ }
+ }
+
+ private static void appendWatchRange( ICWatchpoint2 watchpoint, StringBuffer label ) throws CoreException {
+ String range = watchpoint.getRange().toString();
+ if ( range.length() > 0 && !range.equals( "0" ) ) {
+ label.append( ' ' );
+ label.append( MessageFormat.format( DebugCoreMessages.getString( "CDebugUtils.7" ), new String[]{ range } ) ); //$NON-NLS-1$
+ }
+ }
+
private static boolean isEmpty( String string ) {
return ( string == null || string.trim().length() == 0 );
}
diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/DebugCoreMessages.properties b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/DebugCoreMessages.properties
index 9b61c116aa3..a8bd33a2672 100644
--- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/DebugCoreMessages.properties
+++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/DebugCoreMessages.properties
@@ -7,6 +7,7 @@
#
# Contributors:
# QNX Software Systems - initial API and implementation
+# Freescale Semiconductor - Address watchpoints, https://bugs.eclipse.org/bugs/show_bug.cgi?id=118299
###############################################################################
CDebugCorePlugin.0=No such debugger
CDebugUtils.0=[line: {0}]
@@ -15,4 +16,6 @@ CDebugUtils.2=[function: {0}]
CDebugUtils.3=[ignore count: {0}]
CDebugUtils.4=[condition: {0}]
CDebugUtils.5=[expression: ''{0}'']
+CDebugUtils.6=[memory space: {0}]
+CDebugUtils.7=[units: {0}]
CDIDebugModel.0=Unable to parser binary information from file
diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/model/ICWatchpoint2.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/model/ICWatchpoint2.java
new file mode 100644
index 00000000000..2bd9409daf4
--- /dev/null
+++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/model/ICWatchpoint2.java
@@ -0,0 +1,48 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Freescale Semiconductor 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:
+ * Freescale Semiconductor - Initial API, https://bugs.eclipse.org/bugs/show_bug.cgi?id=118299
+ *******************************************************************************/
+package org.eclipse.cdt.debug.core.model;
+
+import java.math.BigInteger;
+
+import org.eclipse.core.runtime.CoreException;
+
+public interface ICWatchpoint2 extends ICWatchpoint {
+
+ /**
+ * Watchpoint attribute storing the memory space associated with this
+ * watchpoint (value <code>"org.eclipse.cdt.debug.core.memoryspace"</code>).
+ * This attribute is a <code>String</code>.
+ */
+ public static final String MEMORYSPACE = "org.eclipse.cdt.debug.core.memoryspace"; //$NON-NLS-1$
+
+ /**
+ * Watchpoint attribute storing the range associated with this
+ * watchpoint (value <code>"org.eclipse.cdt.debug.core.range"</code>).
+ * This attribute is an <code>int</code>.
+ */
+ public static final String RANGE = "org.eclipse.cdt.debug.core.range"; //$NON-NLS-1$
+
+ /**
+ * Returns the watchpoint's memory space.
+ *
+ * @return the memory space of this watchpoint
+ * @throws CDIException if this method fails. Reasons include:
+ */
+ String getMemorySpace() throws CoreException;
+
+ /**
+ * Returns the watchpoint's range.
+ *
+ * @return the range of this watchpoint
+ * @throws CDIException if this method fails. Reasons include:
+ */
+ BigInteger getRange() throws CoreException;
+}
diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/CBreakpointManager.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/CBreakpointManager.java
index 872c1a9cd0f..32887939202 100644
--- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/CBreakpointManager.java
+++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/CBreakpointManager.java
@@ -10,6 +10,7 @@
* Matthias Spycher (matthias@coware.com) - patch for bug #112008
* Ken Ryall (Nokia) - bugs 170027, 105196
* Ling Wang (Nokia) - bug 176081
+ * Freescale Semiconductor - Address watchpoints, https://bugs.eclipse.org/bugs/show_bug.cgi?id=118299
*******************************************************************************/
package org.eclipse.cdt.debug.internal.core;
@@ -47,6 +48,7 @@ import org.eclipse.cdt.debug.core.cdi.model.ICDIBreakpointManagement2;
import org.eclipse.cdt.debug.core.cdi.model.ICDIFunctionBreakpoint;
import org.eclipse.cdt.debug.core.cdi.model.ICDILineBreakpoint;
import org.eclipse.cdt.debug.core.cdi.model.ICDILocationBreakpoint;
+import org.eclipse.cdt.debug.core.cdi.model.ICDIWatchpoint2;
import org.eclipse.cdt.debug.core.cdi.model.ICDIObject;
import org.eclipse.cdt.debug.core.cdi.model.ICDITarget;
import org.eclipse.cdt.debug.core.cdi.model.ICDITargetConfiguration;
@@ -57,6 +59,7 @@ import org.eclipse.cdt.debug.core.model.ICBreakpoint;
import org.eclipse.cdt.debug.core.model.ICDebugTarget;
import org.eclipse.cdt.debug.core.model.ICFunctionBreakpoint;
import org.eclipse.cdt.debug.core.model.ICLineBreakpoint;
+import org.eclipse.cdt.debug.core.model.ICWatchpoint2;
import org.eclipse.cdt.debug.core.model.ICThread;
import org.eclipse.cdt.debug.core.model.ICWatchpoint;
import org.eclipse.cdt.debug.core.sourcelookup.ICSourceLocator;
@@ -223,6 +226,14 @@ public class CBreakpointManager implements IBreakpointsListener, IBreakpointMana
if ( breakpoint instanceof ICWatchpoint && cdiBreakpoint instanceof ICDIWatchpoint ) {
try {
ICWatchpoint watchpoint = (ICWatchpoint)breakpoint;
+ if ( watchpoint instanceof ICWatchpoint2 && cdiBreakpoint instanceof ICDIWatchpoint2 ) {
+ ICWatchpoint2 wp2 = (ICWatchpoint2)breakpoint;
+ ICDIWatchpoint2 cdiwp2 = (ICDIWatchpoint2)cdiBreakpoint;
+ if ( !wp2.getMemorySpace().equals( cdiwp2.getMemorySpace() )
+ || !wp2.getRange().equals( cdiwp2.getRange() ) ) {
+ return false;
+ }
+ }
ICDIWatchpoint cdiWatchpoint = (ICDIWatchpoint)cdiBreakpoint;
return ( watchpoint.getExpression().compareTo( cdiWatchpoint.getWatchExpression() ) == 0 &&
watchpoint.isReadType() == cdiWatchpoint.isReadType() &&
@@ -725,10 +736,17 @@ public class CBreakpointManager implements IBreakpointsListener, IBreakpointMana
accessType |= (watchpoint.isReadType()) ? ICDIWatchpoint.READ : 0;
String expression = watchpoint.getExpression();
ICDICondition condition = createCondition( watchpoint );
- if (bpManager2 != null)
- b = bpManager2.setWatchpoint( ICDIBreakpoint.REGULAR, accessType, expression, condition, breakpoints[i].isEnabled() );
- else
+ if ( bpManager2 != null ) {
+ if ( breakpoints[i] instanceof ICWatchpoint2 ) {
+ ICWatchpoint2 wp2 = (ICWatchpoint2)watchpoint;
+ b = bpManager2.setWatchpoint(ICDIBreakpoint.REGULAR, accessType, expression, wp2.getMemorySpace(),
+ wp2.getRange(), condition, breakpoints[i].isEnabled() );
+ } else {
+ b = bpManager2.setWatchpoint( ICDIBreakpoint.REGULAR, accessType, expression, condition, breakpoints[i].isEnabled() );
+ }
+ } else {
b = cdiTarget.setWatchpoint( ICDIBreakpoint.REGULAR, accessType, expression, condition );
+ }
}
if ( b != null ) {
Object obj = getBreakpointMap().get( breakpoints[i] );
@@ -861,15 +879,30 @@ public class CBreakpointManager implements IBreakpointsListener, IBreakpointMana
private ICWatchpoint createWatchpoint( ICDIWatchpoint cdiWatchpoint ) throws CDIException, CoreException {
IPath execFile = getExecFilePath();
String sourceHandle = execFile.toOSString();
- ICWatchpoint watchpoint = CDIDebugModel.createWatchpoint( sourceHandle,
- getProject(),
- cdiWatchpoint.isWriteType(),
- cdiWatchpoint.isReadType(),
- cdiWatchpoint.getWatchExpression(),
- cdiWatchpoint.isEnabled(),
- cdiWatchpoint.getCondition().getIgnoreCount(),
- cdiWatchpoint.getCondition().getExpression(),
- false );
+ ICWatchpoint watchpoint = null;
+ if ( cdiWatchpoint instanceof ICDIWatchpoint2 ){
+ watchpoint = CDIDebugModel.createWatchpoint( sourceHandle,
+ getProject(),
+ cdiWatchpoint.isWriteType(),
+ cdiWatchpoint.isReadType(),
+ cdiWatchpoint.getWatchExpression(),
+ ( (ICDIWatchpoint2)cdiWatchpoint ).getMemorySpace(),
+ ( (ICDIWatchpoint2)cdiWatchpoint ).getRange(),
+ cdiWatchpoint.isEnabled(),
+ cdiWatchpoint.getCondition().getIgnoreCount(),
+ cdiWatchpoint.getCondition().getExpression(),
+ false);
+ } else {
+ watchpoint = CDIDebugModel.createWatchpoint( sourceHandle,
+ getProject(),
+ cdiWatchpoint.isWriteType(),
+ cdiWatchpoint.isReadType(),
+ cdiWatchpoint.getWatchExpression(),
+ cdiWatchpoint.isEnabled(),
+ cdiWatchpoint.getCondition().getIgnoreCount(),
+ cdiWatchpoint.getCondition().getExpression(),
+ false );
+ }
return watchpoint;
}
@@ -1031,15 +1064,21 @@ public class CBreakpointManager implements IBreakpointsListener, IBreakpointMana
}
catch( CoreException e ) {
}
- if ( module != null )
+ if ( module != null && getExecFilePath() != null )
return getExecFilePath().toOSString().equals( module );
+
// supporting old breakpoints (> 3.0)
+ String sourceHandle = null;
try {
- return getExecFilePath().toOSString().equals( breakpoint.getSourceHandle() );
+ sourceHandle = breakpoint.getSourceHandle();
}
catch( CoreException e ) {
}
- return false;
+ if ( sourceHandle != null && getExecFilePath() != null )
+ return getExecFilePath().toOSString().equals( sourceHandle );
+
+ return module != null && module.length() == 0 &&
+ sourceHandle != null && sourceHandle.length() == 0;
}
public void skipBreakpoints( boolean enabled ) {
@@ -1092,6 +1131,8 @@ public class CBreakpointManager implements IBreakpointsListener, IBreakpointMana
}
private IPath getExecFilePath() {
+ if (getDebugTarget() == null || getDebugTarget().getExecFile() == null)
+ return null;
return getDebugTarget().getExecFile().getPath();
}
diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/breakpoints/CWatchpoint.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/breakpoints/CWatchpoint.java
index 1ea608de837..8e87a3be1c9 100644
--- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/breakpoints/CWatchpoint.java
+++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/breakpoints/CWatchpoint.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2006 QNX Software Systems and others.
+ * Copyright (c) 2004, 2006-7 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,13 +7,15 @@
*
* Contributors:
* QNX Software Systems - Initial API and implementation
+ * Freescale Semiconductor - Address watchpoints, https://bugs.eclipse.org/bugs/show_bug.cgi?id=118299
*******************************************************************************/
package org.eclipse.cdt.debug.internal.core.breakpoints;
+import java.math.BigInteger;
import java.text.MessageFormat;
import java.util.Map;
import org.eclipse.cdt.debug.core.CDebugUtils;
-import org.eclipse.cdt.debug.core.model.ICWatchpoint;
+import org.eclipse.cdt.debug.core.model.ICWatchpoint2;
import org.eclipse.core.resources.IMarker;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.CoreException;
@@ -21,7 +23,7 @@ import org.eclipse.core.runtime.CoreException;
/**
* A watchpoint specific to the C/C++ debug model.
*/
-public class CWatchpoint extends CBreakpoint implements ICWatchpoint {
+public class CWatchpoint extends CBreakpoint implements ICWatchpoint2 {
private static final String C_WATCHPOINT = "org.eclipse.cdt.debug.core.cWatchpointMarker"; //$NON-NLS-1$
@@ -38,6 +40,10 @@ public class CWatchpoint extends CBreakpoint implements ICWatchpoint {
super( resource, getMarkerType(), attributes, add );
}
+ protected CWatchpoint( IResource resource, String marker, Map attributes, boolean add ) throws CoreException {
+ super( resource, marker, attributes, add );
+ }
+
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.core.model.ICWatchpoint#isWriteType()
*/
@@ -100,4 +106,14 @@ public class CWatchpoint extends CBreakpoint implements ICWatchpoint {
public int getCharEnd() throws CoreException {
return ensureMarker().getAttribute( IMarker.CHAR_END, -1 );
}
+
+ public String getMemorySpace() throws CoreException {
+ return ensureMarker().getAttribute( MEMORYSPACE, "" );
+ }
+
+ public BigInteger getRange() throws CoreException {
+ String attr = ensureMarker().getAttribute( RANGE, "0" );
+ return new BigInteger( attr.length() > 0 ? attr : "0" );
+ }
+
}

Back to the top