mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-10 09:45:39 +02:00
[284286] First phase of tracepoint support. Tracepoints can now be created/deleted/enabled/disabled, we can add conditions and passcount.
This commit is contained in:
parent
959296fdd1
commit
721192f266
47 changed files with 4544 additions and 98 deletions
|
@ -12,6 +12,7 @@
|
|||
# Ken Ryall (Nokia) - Added support for Breakpoint Actions ( 118308 )
|
||||
# IBM Corporation
|
||||
# Texas Instruments - added extension point for source container type (279473)
|
||||
# Ericsson - Added support for Tracepoints (284286)
|
||||
###############################################################################
|
||||
pluginName=C/C++ Development Tools Debug Model
|
||||
providerName=Eclipse CDT
|
||||
|
@ -29,6 +30,9 @@ cAddressBreakpoints.name=C/C++ Address Breakpoints
|
|||
cFunctionBreakpoints.name=C/C++ Function Breakpoints
|
||||
cWatchpoints.name=C/C++ Watchpoints
|
||||
cEventBreakpoints.name=C/C++ Event Breakpoints
|
||||
cLineTracepoints.name=C/C++ Line Tracepoints
|
||||
cAddressTracepoints.name=C/C++ Address Tracepoints
|
||||
cFunctionTracepoints.name=C/C++ Function Tracepoints
|
||||
breakpointProblem.name=C/C++ Breakpoint Problem
|
||||
|
||||
containerName.mapping=Path Mapping
|
||||
|
|
|
@ -104,6 +104,49 @@
|
|||
value="true">
|
||||
</persistent>
|
||||
</extension>
|
||||
<extension
|
||||
id="cTracepointMarker"
|
||||
point="org.eclipse.core.resources.markers">
|
||||
<super
|
||||
type="org.eclipse.cdt.debug.core.cLineBreakpointMarker">
|
||||
</super>
|
||||
<persistent
|
||||
value="true">
|
||||
</persistent>
|
||||
<attribute
|
||||
name="org.eclipse.cdt.debug.core.passCount">
|
||||
</attribute>
|
||||
</extension>
|
||||
<extension
|
||||
id="cLineTracepointMarker"
|
||||
point="org.eclipse.core.resources.markers">
|
||||
<super
|
||||
type="org.eclipse.cdt.debug.core.cTracepointMarker">
|
||||
</super>
|
||||
<persistent
|
||||
value="true">
|
||||
</persistent>
|
||||
</extension>
|
||||
<extension
|
||||
id="cAddressTracepointMarker"
|
||||
point="org.eclipse.core.resources.markers">
|
||||
<super
|
||||
type="org.eclipse.cdt.debug.core.cTracepointMarker">
|
||||
</super>
|
||||
<persistent
|
||||
value="true">
|
||||
</persistent>
|
||||
</extension>
|
||||
<extension
|
||||
id="cFunctionTracepointMarker"
|
||||
point="org.eclipse.core.resources.markers">
|
||||
<super
|
||||
type="org.eclipse.cdt.debug.core.cTracepointMarker">
|
||||
</super>
|
||||
<persistent
|
||||
value="true">
|
||||
</persistent>
|
||||
</extension>
|
||||
<extension
|
||||
id="cWatchpointMarker"
|
||||
point="org.eclipse.core.resources.markers">
|
||||
|
@ -185,6 +228,24 @@
|
|||
name="%cWatchpoints.name"
|
||||
markerType="org.eclipse.cdt.debug.core.cWatchpointMarker"
|
||||
id="cWatchpoint">
|
||||
</breakpoint>
|
||||
<breakpoint
|
||||
class="org.eclipse.cdt.debug.internal.core.breakpoints.CLineTracepoint"
|
||||
name="%cLineTracepoints.name"
|
||||
markerType="org.eclipse.cdt.debug.core.cLineTracepointMarker"
|
||||
id="cLineTracepoint">
|
||||
</breakpoint>
|
||||
<breakpoint
|
||||
class="org.eclipse.cdt.debug.internal.core.breakpoints.CAddressTracepoint"
|
||||
name="%cAddressTracepoints.name"
|
||||
markerType="org.eclipse.cdt.debug.core.cAddressTracepointMarker"
|
||||
id="cAddressTracepoint">
|
||||
</breakpoint>
|
||||
<breakpoint
|
||||
class="org.eclipse.cdt.debug.internal.core.breakpoints.CFunctionTracepoint"
|
||||
name="%cFunctionTracepoints.name"
|
||||
markerType="org.eclipse.cdt.debug.core.cFunctionTracepointMarker"
|
||||
id="cFunctionTracepoint">
|
||||
</breakpoint>
|
||||
<breakpoint
|
||||
class="org.eclipse.cdt.debug.internal.core.breakpoints.CEventBreakpoint"
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2004, 2006-7 QNX Software Systems and others.
|
||||
* Copyright (c) 2009 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
|
||||
|
@ -9,6 +9,7 @@
|
|||
* QNX Software Systems - Initial API and implementation
|
||||
* Freescale Semiconductor - Address watchpoints, https://bugs.eclipse.org/bugs/show_bug.cgi?id=118299
|
||||
* QNX Software Systems - catchpoints - bug 226689
|
||||
* Ericsson - tracepoints - bug 284286
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.debug.core;
|
||||
|
||||
|
@ -34,9 +35,12 @@ import org.eclipse.cdt.debug.core.model.ICLineBreakpoint;
|
|||
import org.eclipse.cdt.debug.core.model.ICWatchpoint;
|
||||
import org.eclipse.cdt.debug.core.model.ICWatchpoint2;
|
||||
import org.eclipse.cdt.debug.internal.core.breakpoints.CAddressBreakpoint;
|
||||
import org.eclipse.cdt.debug.internal.core.breakpoints.CAddressTracepoint;
|
||||
import org.eclipse.cdt.debug.internal.core.breakpoints.CEventBreakpoint;
|
||||
import org.eclipse.cdt.debug.internal.core.breakpoints.CFunctionBreakpoint;
|
||||
import org.eclipse.cdt.debug.internal.core.breakpoints.CFunctionTracepoint;
|
||||
import org.eclipse.cdt.debug.internal.core.breakpoints.CLineBreakpoint;
|
||||
import org.eclipse.cdt.debug.internal.core.breakpoints.CLineTracepoint;
|
||||
import org.eclipse.cdt.debug.internal.core.breakpoints.CWatchpoint;
|
||||
import org.eclipse.cdt.debug.internal.core.model.CDebugTarget;
|
||||
import org.eclipse.core.resources.IFile;
|
||||
|
@ -231,7 +235,30 @@ public class CDIDebugModel {
|
|||
* </ul>
|
||||
*/
|
||||
public static ICLineBreakpoint createLineBreakpoint( String sourceHandle, IResource resource, int type, int lineNumber, boolean enabled, int ignoreCount, String condition, boolean register ) throws CoreException {
|
||||
HashMap attributes = new HashMap( 10 );
|
||||
HashMap<String, Object> attributes = new HashMap<String, Object>( 10 );
|
||||
setLineBreakpointAttributes( attributes, sourceHandle, type, lineNumber, enabled, ignoreCount, condition );
|
||||
return new CLineBreakpoint( resource, attributes, register );
|
||||
}
|
||||
|
||||
/**
|
||||
* @since 6.1
|
||||
*/
|
||||
public static ICLineBreakpoint createLineTracepoint( String sourceHandle, IResource resource, int type, int lineNumber, boolean enabled, int ignoreCount, String condition, boolean register ) throws CoreException {
|
||||
HashMap<String, Object> attributes = new HashMap<String, Object>( 10 );
|
||||
setLineBreakpointAttributes( attributes, sourceHandle, type, lineNumber, enabled, ignoreCount, condition );
|
||||
return new CLineTracepoint( resource, attributes, register );
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper function for setting common line breakpoint attributes.
|
||||
*/
|
||||
private static void setLineBreakpointAttributes( HashMap<String, Object> attributes,
|
||||
String sourceHandle,
|
||||
Integer type,
|
||||
int lineNumber,
|
||||
boolean enabled,
|
||||
int ignoreCount,
|
||||
String condition ) {
|
||||
attributes.put( IBreakpoint.ID, getPluginIdentifier() );
|
||||
attributes.put( IMarker.LINE_NUMBER, new Integer( lineNumber ) );
|
||||
attributes.put( IBreakpoint.ENABLED, Boolean.valueOf( enabled ) );
|
||||
|
@ -239,7 +266,6 @@ public class CDIDebugModel {
|
|||
attributes.put( ICBreakpoint.CONDITION, condition );
|
||||
attributes.put( ICBreakpoint.SOURCE_HANDLE, sourceHandle );
|
||||
attributes.put( ICBreakpointType.TYPE, type );
|
||||
return new CLineBreakpoint( resource, attributes, register );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -319,21 +345,39 @@ public class CDIDebugModel {
|
|||
* </ul>
|
||||
*/
|
||||
public static ICAddressBreakpoint createAddressBreakpoint( String module, String sourceHandle, IResource resource, int type, int lineNumber, IAddress address, boolean enabled, int ignoreCount, String condition, boolean register ) throws CoreException {
|
||||
HashMap attributes = new HashMap( 10 );
|
||||
attributes.put( IBreakpoint.ID, getPluginIdentifier() );
|
||||
attributes.put( IMarker.CHAR_START, new Integer( -1 ) );
|
||||
attributes.put( IMarker.CHAR_END, new Integer( -1 ) );
|
||||
attributes.put( IMarker.LINE_NUMBER, new Integer( lineNumber ) );
|
||||
attributes.put( ICLineBreakpoint.ADDRESS, address.toHexAddressString() );
|
||||
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( ICBreakpoint.MODULE, module );
|
||||
attributes.put( ICBreakpointType.TYPE, type );
|
||||
HashMap<String, Object> attributes = new HashMap<String, Object>( 10 );
|
||||
setAddressBreakpointAttributes( attributes, module, sourceHandle, type, lineNumber, address, enabled, ignoreCount, condition );
|
||||
return new CAddressBreakpoint( resource, attributes, register );
|
||||
}
|
||||
|
||||
/**
|
||||
* @since 6.1
|
||||
*/
|
||||
public static ICAddressBreakpoint createAddressTracepoint( String module, String sourceHandle, IResource resource, int type, int lineNumber, IAddress address, boolean enabled, int ignoreCount, String condition, boolean register ) throws CoreException {
|
||||
HashMap<String, Object> attributes = new HashMap<String, Object>( 10 );
|
||||
setAddressBreakpointAttributes( attributes, module, sourceHandle, type, lineNumber, address, enabled, ignoreCount, condition );
|
||||
return new CAddressTracepoint( resource, attributes, register );
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper function for setting common address breakpoint attributes.
|
||||
*/
|
||||
private static void setAddressBreakpointAttributes( HashMap<String, Object> attributes,
|
||||
String module,
|
||||
String sourceHandle,
|
||||
int type,
|
||||
int lineNumber,
|
||||
IAddress address,
|
||||
boolean enabled,
|
||||
int ignoreCount,
|
||||
String condition ) {
|
||||
setLineBreakpointAttributes(attributes, sourceHandle, type, lineNumber, enabled, ignoreCount, condition);
|
||||
attributes.put( IMarker.CHAR_START, new Integer( -1 ) );
|
||||
attributes.put( IMarker.CHAR_END, new Integer( -1 ) );
|
||||
attributes.put( ICLineBreakpoint.ADDRESS, address.toHexAddressString() );
|
||||
attributes.put( ICBreakpoint.MODULE, module );
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates and returns a watchpoint for the source defined by the given
|
||||
* source handle, at the given expression. The marker associated with the
|
||||
|
@ -357,8 +401,8 @@ public class CDIDebugModel {
|
|||
* </ul>
|
||||
*/
|
||||
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 );
|
||||
setAttributes( attributes, sourceHandle, resource, writeAccess, readAccess, expression, "", BigInteger.ZERO, enabled, ignoreCount, condition, register );
|
||||
HashMap<String, Object> attributes = new HashMap<String, Object>( 10 );
|
||||
setWatchPointAttributes( attributes, sourceHandle, resource, writeAccess, readAccess, expression, "", BigInteger.ZERO, enabled, ignoreCount, condition, register ); //$NON-NLS-1$
|
||||
return new CWatchpoint( resource, attributes, register );
|
||||
}
|
||||
|
||||
|
@ -396,8 +440,8 @@ public class CDIDebugModel {
|
|||
* </ul>
|
||||
*/
|
||||
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 );
|
||||
setAttributes( attributes, sourceHandle, resource, writeAccess, readAccess, expression, memorySpace, range, enabled, ignoreCount, condition, register );
|
||||
HashMap<String, Object> attributes = new HashMap<String, Object>( 10 );
|
||||
setWatchPointAttributes( 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 ) );
|
||||
|
@ -430,15 +474,15 @@ public class CDIDebugModel {
|
|||
* </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 );
|
||||
HashMap<String, Object> attributes = new HashMap<String, Object>( 10 );
|
||||
setWatchPointAttributes( attributes, sourceHandle, resource, writeAccess, readAccess, expression, memorySpace, range, enabled, ignoreCount, condition, register );
|
||||
return new CWatchpoint( resource, attributes, register );
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper function for setting common attributes.
|
||||
* Helper function for setting common watchpoint 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 ) {
|
||||
private static void setWatchPointAttributes( HashMap<String, Object> 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 ) );
|
||||
|
@ -517,20 +561,39 @@ public class CDIDebugModel {
|
|||
* </ul>
|
||||
*/
|
||||
public static ICFunctionBreakpoint createFunctionBreakpoint( String sourceHandle, IResource resource, int type, String function, int charStart, int charEnd, int lineNumber, boolean enabled, int ignoreCount, String condition, boolean register ) throws CoreException {
|
||||
HashMap attributes = new HashMap( 10 );
|
||||
attributes.put( IBreakpoint.ID, getPluginIdentifier() );
|
||||
attributes.put( IMarker.CHAR_START, new Integer( charStart ) );
|
||||
attributes.put( IMarker.CHAR_END, new Integer( charEnd ) );
|
||||
attributes.put( IMarker.LINE_NUMBER, new Integer( lineNumber ) );
|
||||
attributes.put( ICLineBreakpoint.FUNCTION, function );
|
||||
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( ICBreakpointType.TYPE, type );
|
||||
HashMap<String, Object> attributes = new HashMap<String, Object>( 10 );
|
||||
setFunctionBreakpointAttributes( attributes, sourceHandle, type, function, charStart, charEnd, lineNumber, enabled, ignoreCount, condition);
|
||||
return new CFunctionBreakpoint( resource, attributes, register );
|
||||
}
|
||||
|
||||
/**
|
||||
* @since 6.1
|
||||
*/
|
||||
public static ICFunctionBreakpoint createFunctionTracepoint( String sourceHandle, IResource resource, int type, String function, int charStart, int charEnd, int lineNumber, boolean enabled, int ignoreCount, String condition, boolean register ) throws CoreException {
|
||||
HashMap<String, Object> attributes = new HashMap<String, Object>( 10 );
|
||||
setFunctionBreakpointAttributes( attributes, sourceHandle, type, function, charStart, charEnd, lineNumber, enabled, ignoreCount, condition);
|
||||
return new CFunctionTracepoint( resource, attributes, register );
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper function for setting common address breakpoint attributes.
|
||||
*/
|
||||
private static void setFunctionBreakpointAttributes( HashMap<String, Object> attributes,
|
||||
String sourceHandle,
|
||||
int type,
|
||||
String function,
|
||||
int charStart,
|
||||
int charEnd,
|
||||
int lineNumber,
|
||||
boolean enabled,
|
||||
int ignoreCount,
|
||||
String condition ) {
|
||||
setLineBreakpointAttributes(attributes, sourceHandle, type, lineNumber, enabled, ignoreCount, condition);
|
||||
attributes.put( IMarker.CHAR_START, new Integer( charStart ) );
|
||||
attributes.put( IMarker.CHAR_END, new Integer( charEnd ) );
|
||||
attributes.put( ICLineBreakpoint.FUNCTION, function );
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the line breakpoint that is already registered with the
|
||||
* breakpoint manager for a source with the given handle and the given
|
||||
|
@ -707,8 +770,8 @@ public class CDIDebugModel {
|
|||
if (breakpoint.getEventType().equals(type)) {
|
||||
String arg1 = breakpoint.getEventArgument();
|
||||
if (arg1 == null)
|
||||
arg1 = "";
|
||||
String arg2 = arg == null ? "" : arg;
|
||||
arg1 = ""; //$NON-NLS-1$
|
||||
String arg2 = arg == null ? "" : arg; //$NON-NLS-1$
|
||||
if (arg1.equals(arg2))
|
||||
return breakpoint;
|
||||
}
|
||||
|
@ -723,7 +786,7 @@ public class CDIDebugModel {
|
|||
attributes.put(IBreakpoint.ID, CDIDebugModel.getPluginIdentifier());
|
||||
attributes.put(IBreakpoint.ENABLED, true);
|
||||
attributes.put(ICBreakpoint.IGNORE_COUNT, 0);
|
||||
attributes.put(ICBreakpoint.CONDITION, "");
|
||||
attributes.put(ICBreakpoint.CONDITION, ""); //$NON-NLS-1$
|
||||
attributes.put(ICEventBreakpoint.EVENT_TYPE_ID, type);
|
||||
attributes.put(ICEventBreakpoint.EVENT_ARG, arg);
|
||||
return new CEventBreakpoint(resource, attributes, register);
|
||||
|
|
|
@ -0,0 +1,46 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2009 Ericsson 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:
|
||||
* Ericsson - Initial API and implementation
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.debug.core.model;
|
||||
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
|
||||
|
||||
/**
|
||||
* A tracepoint specific to the C/C++ debug model.
|
||||
*
|
||||
* @since 6.1
|
||||
*/
|
||||
public interface ICTracepoint extends ICLineBreakpoint {
|
||||
/**
|
||||
* Tracepoint attribute storing a tracepoint's pass count value (value
|
||||
* <code>"org.eclipse.cdt.debug.core.passCount"</code>). This attribute
|
||||
* is an <code>int</code>.
|
||||
*/
|
||||
public static final String PASS_COUNT = "org.eclipse.cdt.debug.core.passCount"; //$NON-NLS-1$
|
||||
|
||||
/**
|
||||
* Returns the pass count used by this tracepoint.
|
||||
*
|
||||
* @return the pass count used by this breakpoint
|
||||
* @exception CoreException if unable to access the property on this tracepoint's
|
||||
* underlying marker
|
||||
*/
|
||||
public int getPassCount() throws CoreException;
|
||||
|
||||
/**
|
||||
* Sets the pass count attribute for this tracepoint.
|
||||
*
|
||||
* @param passCount the new pass count
|
||||
* @exception CoreException if unable to access the property on this tracepoint's
|
||||
* underlying marker
|
||||
*/
|
||||
public void setPassCount(int passCount) throws CoreException;
|
||||
}
|
|
@ -71,6 +71,7 @@ import org.eclipse.cdt.debug.core.model.ICEventBreakpoint;
|
|||
import org.eclipse.cdt.debug.core.model.ICFunctionBreakpoint;
|
||||
import org.eclipse.cdt.debug.core.model.ICLineBreakpoint;
|
||||
import org.eclipse.cdt.debug.core.model.ICThread;
|
||||
import org.eclipse.cdt.debug.core.model.ICTracepoint;
|
||||
import org.eclipse.cdt.debug.core.model.ICWatchpoint;
|
||||
import org.eclipse.cdt.debug.core.model.ICWatchpoint2;
|
||||
import org.eclipse.cdt.debug.core.sourcelookup.ICSourceLocator;
|
||||
|
@ -860,7 +861,13 @@ public class CBreakpointManager implements IBreakpointsListener, IBreakpointMana
|
|||
if (icbreakpoint instanceof ICBreakpointType) {
|
||||
breakpointType = ((ICBreakpointType) icbreakpoint).getType();
|
||||
}
|
||||
if ( icbreakpoint instanceof ICFunctionBreakpoint ) {
|
||||
if ( icbreakpoint instanceof ICTracepoint) {
|
||||
ICTracepoint breakpoint = (ICTracepoint)icbreakpoint;
|
||||
IMarker marker = BreakpointProblems.reportUnsupportedTracepoint(breakpoint, getDebugTarget().getName(), getDebugTarget().getInternalID());
|
||||
if (marker != null)
|
||||
fBreakpointProblems.add(marker);
|
||||
}
|
||||
else if ( icbreakpoint instanceof ICFunctionBreakpoint ) {
|
||||
ICFunctionBreakpoint breakpoint = (ICFunctionBreakpoint)icbreakpoint;
|
||||
String function = breakpoint.getFunction();
|
||||
String fileName = breakpoint.getFileName();
|
||||
|
|
|
@ -0,0 +1,132 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2004, 2006 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
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* QNX Software Systems - Initial API and implementation
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.debug.internal.core.breakpoints;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import org.eclipse.cdt.debug.core.model.ICBreakpoint;
|
||||
import org.eclipse.cdt.debug.core.model.ICLineBreakpoint;
|
||||
import org.eclipse.cdt.debug.core.model.ICTracepoint;
|
||||
import org.eclipse.core.resources.IMarker;
|
||||
import org.eclipse.core.resources.IResource;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
import org.eclipse.core.runtime.IPath;
|
||||
import org.eclipse.core.runtime.Path;
|
||||
|
||||
/**
|
||||
* Base class for different types of location tracepoints.
|
||||
*/
|
||||
public abstract class AbstractTracepoint extends CBreakpoint implements ICTracepoint {
|
||||
|
||||
/**
|
||||
* Constructor for AbstractTracepoint.
|
||||
*/
|
||||
public AbstractTracepoint() {
|
||||
super();
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor for AbstractTracepoint.
|
||||
*
|
||||
* @param resource
|
||||
* @param markerType
|
||||
* @param attributes
|
||||
* @param add
|
||||
* @throws CoreException
|
||||
*/
|
||||
public AbstractTracepoint( IResource resource, String markerType, Map<String, Object> attributes, boolean add ) throws CoreException {
|
||||
super( resource, markerType, attributes, add );
|
||||
}
|
||||
|
||||
/*(non-Javadoc)
|
||||
* @see org.eclipse.debug.core.model.ILineBreakpoint#getLineNumber()
|
||||
*/
|
||||
public int getLineNumber() throws CoreException {
|
||||
return ensureMarker().getAttribute( IMarker.LINE_NUMBER, -1 );
|
||||
}
|
||||
|
||||
/*(non-Javadoc)
|
||||
* @see org.eclipse.debug.core.model.ILineBreakpoint#getCharStart()
|
||||
*/
|
||||
public int getCharStart() throws CoreException {
|
||||
return ensureMarker().getAttribute( IMarker.CHAR_START, -1 );
|
||||
}
|
||||
|
||||
/*(non-Javadoc)
|
||||
* @see org.eclipse.debug.core.model.ILineBreakpoint#getCharEnd()
|
||||
*/
|
||||
public int getCharEnd() throws CoreException {
|
||||
return ensureMarker().getAttribute( IMarker.CHAR_END, -1 );
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.debug.core.model.ICLineBreakpoint#getAddress()
|
||||
*/
|
||||
public String getAddress() throws CoreException {
|
||||
return ensureMarker().getAttribute( ICLineBreakpoint.ADDRESS, "" ); //$NON-NLS-1$
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.debug.core.model.ICLineBreakpoint#getFileName()
|
||||
*/
|
||||
public String getFileName() throws CoreException {
|
||||
String fileName = ensureMarker().getAttribute( ICBreakpoint.SOURCE_HANDLE, "" ); //$NON-NLS-1$
|
||||
IPath path = new Path( fileName );
|
||||
return ( path.isValidPath( fileName ) ) ? path.lastSegment() : null;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.debug.core.model.ICLineBreakpoint#getFunction()
|
||||
*/
|
||||
public String getFunction() throws CoreException {
|
||||
return ensureMarker().getAttribute( ICLineBreakpoint.FUNCTION, "" ); //$NON-NLS-1$
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.debug.core.ICBreakpoint#isConditional()
|
||||
*/
|
||||
@Override
|
||||
public boolean isConditional() throws CoreException {
|
||||
return (super.isConditional() || getPassCount() > 0);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.debug.core.model.ICLineBreakpoint#setAddress(java.lang.String)
|
||||
*/
|
||||
public void setAddress( String address ) throws CoreException {
|
||||
setAttribute( ICLineBreakpoint.ADDRESS, address );
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.debug.core.model.ICLineBreakpoint#setFunction(java.lang.String)
|
||||
*/
|
||||
public void setFunction( String function ) throws CoreException {
|
||||
setAttribute( ICLineBreakpoint.FUNCTION, function );
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.debug.core.ICTracepoint#getPassCount()
|
||||
*/
|
||||
public int getPassCount() throws CoreException {
|
||||
return ensureMarker().getAttribute( PASS_COUNT, 0 );
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.debug.core.ICTracepoint#setPassCount(int)
|
||||
*/
|
||||
public void setPassCount( int passCount ) throws CoreException {
|
||||
setAttribute( PASS_COUNT, passCount );
|
||||
setAttribute( IMarker.MESSAGE, getMarkerMessage() );
|
||||
}
|
||||
}
|
|
@ -7,19 +7,26 @@
|
|||
#
|
||||
# Contributors:
|
||||
# QNX Software Systems - initial API and implementation
|
||||
# Erisson - Added support for tracepoints (284286)
|
||||
###############################################################################
|
||||
|
||||
# The marker message of an address breakpoint.
|
||||
CAddressBreakpoint.0=Address breakpoint: {0}
|
||||
# The marker message of an address tracepoint.
|
||||
CAddressTracepoint.0=Address tracepoint: {0}
|
||||
|
||||
CBreakpoint.1=\ [ignore count: {0}]
|
||||
CBreakpoint.2=\ if {0}
|
||||
|
||||
# The marker message of a function breakpoint.
|
||||
CFunctionBreakpoint.0=Function breakpoint: {0}
|
||||
# The marker message of a function tracepoint.
|
||||
CFunctionTracepoint.0=Function tracepoint: {0}
|
||||
|
||||
# The marker message of a line breakpoint.
|
||||
CLineBreakpoint.0=Line breakpoint: {0}
|
||||
# The marker message of a line tracepoint.
|
||||
CLineTracepoint.0=Line tracepoint: {0}
|
||||
|
||||
# The marker message of a write watchpoint.
|
||||
CWatchpoint.0=Write watchpoint: {0}
|
||||
|
@ -34,3 +41,5 @@ CWatchpoint.2=Access watchpoint: {0}
|
|||
CWatchpoint.3=Watchpoint: {0}
|
||||
BreakpointProblems_Moved=Breakpoint could not be set at line {0}, moved to line {1}
|
||||
BreakpointProblems_Unresolved=Unresolved breakpoint
|
||||
|
||||
BreakpointProblems_UnsupportedTracepoint=Tracepoints are not supported
|
||||
|
|
|
@ -48,6 +48,11 @@ public class BreakpointProblems {
|
|||
return marker;
|
||||
}
|
||||
|
||||
public static IMarker reportUnsupportedTracepoint(ICBreakpoint breakpoint, String contextName, String contextID) throws CoreException {
|
||||
IMarker marker = BreakpointProblems.reportBreakpointProblem(breakpoint, BreakpointMessages.getString("BreakpointProblems_UnsupportedTracepoint"), IMarker.SEVERITY_WARNING, UNRESOLVED, true, false, contextName, contextID); //$NON-NLS-1$
|
||||
return marker;
|
||||
}
|
||||
|
||||
public static void removeProblemsForBreakpoint(ICBreakpoint breakpoint) throws CoreException {
|
||||
IMarker marker = breakpoint.getMarker();
|
||||
if (marker != null)
|
||||
|
|
|
@ -0,0 +1,60 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2009 Ericsson 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:
|
||||
* Ericsson - Initial API and implementation
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.debug.internal.core.breakpoints;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import org.eclipse.cdt.debug.core.CDebugUtils;
|
||||
import org.eclipse.cdt.debug.core.model.ICAddressBreakpoint;
|
||||
import org.eclipse.cdt.debug.core.model.ICTracepoint;
|
||||
import org.eclipse.core.resources.IResource;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
|
||||
import com.ibm.icu.text.MessageFormat;
|
||||
|
||||
/**
|
||||
* A tracepoint that collects data when a particular address is reached.
|
||||
*
|
||||
* @since 6.1
|
||||
*/
|
||||
public class CAddressTracepoint extends AbstractTracepoint implements ICAddressBreakpoint, ICTracepoint {
|
||||
|
||||
private static final String C_ADDRESS_TRACEPOINT_MARKER = "org.eclipse.cdt.debug.core.cAddressTracepointMarker"; //$NON-NLS-1$
|
||||
|
||||
/**
|
||||
* Constructor for CAddressTracepoint.
|
||||
*/
|
||||
public CAddressTracepoint() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor for CAddressTracepoint.
|
||||
*/
|
||||
public CAddressTracepoint( IResource resource, Map<String, Object> attributes, boolean add ) throws CoreException {
|
||||
super( resource, getMarkerType(), attributes, add );
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the type of marker associated with this type of breakpoints
|
||||
*/
|
||||
public static String getMarkerType() {
|
||||
return C_ADDRESS_TRACEPOINT_MARKER;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.eclipse.cdt.debug.internal.core.breakpoints.CBreakpoint#getMarkerMessage()
|
||||
*/
|
||||
protected String getMarkerMessage() throws CoreException {
|
||||
return MessageFormat.format( BreakpointMessages.getString( "CAddressTracepoint.0" ), new String[] { CDebugUtils.getBreakpointText( this, false ) } ); //$NON-NLS-1$
|
||||
}
|
||||
}
|
|
@ -0,0 +1,58 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2009 Ericsson 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:
|
||||
* Ericsson - Initial API and implementation
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.debug.internal.core.breakpoints;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import org.eclipse.cdt.debug.core.CDebugUtils;
|
||||
import org.eclipse.cdt.debug.core.model.ICFunctionBreakpoint;
|
||||
import org.eclipse.cdt.debug.core.model.ICTracepoint;
|
||||
import org.eclipse.core.resources.IResource;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
|
||||
import com.ibm.icu.text.MessageFormat;
|
||||
|
||||
/**
|
||||
* A tracepoint that collects data when a function is entered.
|
||||
*
|
||||
* @since 6.1
|
||||
*/
|
||||
public class CFunctionTracepoint extends AbstractTracepoint implements ICFunctionBreakpoint, ICTracepoint {
|
||||
|
||||
private static final String C_FUNCTION_TRACEPOINT_MARKER = "org.eclipse.cdt.debug.core.cFunctionTracepointMarker"; //$NON-NLS-1$
|
||||
|
||||
/**
|
||||
* Constructor for CFunctionTracepoint.
|
||||
*/
|
||||
public CFunctionTracepoint() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor for CFunctionTracepoint.
|
||||
*/
|
||||
public CFunctionTracepoint( IResource resource, Map<String, Object> attributes, boolean add ) throws CoreException {
|
||||
super( resource, getMarkerType(), attributes, add );
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the type of marker associated with this type of breakpoints
|
||||
*/
|
||||
public static String getMarkerType() {
|
||||
return C_FUNCTION_TRACEPOINT_MARKER;
|
||||
}
|
||||
|
||||
/*(non-Javadoc)
|
||||
* @see org.eclipse.cdt.debug.internal.core.breakpoints.CBreakpoint#getMarkerMessage()
|
||||
*/
|
||||
protected String getMarkerMessage() throws CoreException {
|
||||
return MessageFormat.format( BreakpointMessages.getString( "CFunctionTracepoint.0" ), new String[] { CDebugUtils.getBreakpointText( this, false ) } ); //$NON-NLS-1$
|
||||
}
|
||||
}
|
|
@ -0,0 +1,57 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2009 Ericsson 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:
|
||||
* Ericsson - Initial API and implementation
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.debug.internal.core.breakpoints;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import org.eclipse.cdt.debug.core.CDebugUtils;
|
||||
import org.eclipse.cdt.debug.core.model.ICTracepoint;
|
||||
import org.eclipse.core.resources.IResource;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
|
||||
import com.ibm.icu.text.MessageFormat;
|
||||
|
||||
/**
|
||||
* A tracepoint that collects data when a particular line of code is reached.
|
||||
*
|
||||
* @since 6.1
|
||||
*/
|
||||
public class CLineTracepoint extends AbstractTracepoint implements ICTracepoint {
|
||||
|
||||
private static final String C_LINE_TRACEPOINT_MARKER = "org.eclipse.cdt.debug.core.cLineTracepointMarker"; //$NON-NLS-1$
|
||||
|
||||
/**
|
||||
* Constructor for CLineTracepoint.
|
||||
*/
|
||||
public CLineTracepoint() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor for CLineTracepoint.
|
||||
*/
|
||||
public CLineTracepoint( IResource resource, Map<String, Object> attributes, boolean add ) throws CoreException {
|
||||
super( resource, getMarkerType(), attributes, add );
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the type of marker associated with this type of breakpoints
|
||||
*/
|
||||
public static String getMarkerType() {
|
||||
return C_LINE_TRACEPOINT_MARKER;
|
||||
}
|
||||
|
||||
/*(non-Javadoc)
|
||||
* @see org.eclipse.cdt.debug.internal.core.breakpoints.CBreakpoint#getMarkerMessage()
|
||||
*/
|
||||
protected String getMarkerMessage() throws CoreException {
|
||||
return MessageFormat.format( BreakpointMessages.getString( "CLineTracepoint.0" ), new String[] { CDebugUtils.getBreakpointText( this, false ) } ); //$NON-NLS-1$
|
||||
}
|
||||
}
|
|
@ -25,6 +25,7 @@ Export-Package:
|
|||
org.eclipse.cdt.debug.ui.disassembly,
|
||||
org.eclipse.cdt.debug.ui.editors,
|
||||
org.eclipse.cdt.debug.ui.importexecutable,
|
||||
org.eclipse.cdt.debug.ui.preferences,
|
||||
org.eclipse.cdt.debug.ui.sourcelookup
|
||||
Require-Bundle: org.eclipse.ui.ide;bundle-version="[3.2.0,4.0.0)",
|
||||
org.eclipse.jface.text;bundle-version="[3.2.0,4.0.0)",
|
||||
|
|
BIN
debug/org.eclipse.cdt.debug.ui/icons/dlcl16/trcpd_obj.gif
Normal file
BIN
debug/org.eclipse.cdt.debug.ui/icons/dlcl16/trcpd_obj.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 316 B |
BIN
debug/org.eclipse.cdt.debug.ui/icons/elcl16/trcp_obj.gif
Normal file
BIN
debug/org.eclipse.cdt.debug.ui/icons/elcl16/trcp_obj.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 348 B |
|
@ -216,4 +216,10 @@ ReverseStepOver.description = Perform Reverse StepOver
|
|||
ReverseStepOver.label = Reverse StepOver
|
||||
Uncall.name = Uncall
|
||||
Uncall.description = Perform Uncall
|
||||
Uncall.label = Uncall
|
||||
Uncall.label = Uncall
|
||||
|
||||
# Menu for selecting breakpoint toggle type
|
||||
BreakpointTypes.label=B&reakpoint Types
|
||||
|
||||
# Tracepoints
|
||||
TracepointActionSet.label=Tracepoints
|
||||
|
|
|
@ -1247,9 +1247,14 @@
|
|||
id="org.eclipse.cdt.debug.ui.propertypages.breakpoint.common"
|
||||
name="%CommonBreakpointPage.label">
|
||||
<enabledWhen>
|
||||
<adapt
|
||||
type="org.eclipse.cdt.debug.core.model.ICBreakpoint">
|
||||
</adapt>
|
||||
<and>
|
||||
<adapt type="org.eclipse.cdt.debug.core.model.ICBreakpoint">
|
||||
</adapt>
|
||||
<not>
|
||||
<adapt type="org.eclipse.cdt.debug.core.model.ICTracepoint">
|
||||
</adapt>
|
||||
</not>
|
||||
</and>
|
||||
</enabledWhen>
|
||||
</page>
|
||||
<page
|
||||
|
@ -1257,9 +1262,14 @@
|
|||
id="org.eclipse.cdt.debug.ui.breakpointactions.actions"
|
||||
name="%BreakpointActionsPage.label">
|
||||
<enabledWhen>
|
||||
<adapt
|
||||
type="org.eclipse.cdt.debug.core.model.ICBreakpoint">
|
||||
</adapt>
|
||||
<and>
|
||||
<adapt type="org.eclipse.cdt.debug.core.model.ICBreakpoint">
|
||||
</adapt>
|
||||
<not>
|
||||
<adapt type="org.eclipse.cdt.debug.core.model.ICTracepoint">
|
||||
</adapt>
|
||||
</not>
|
||||
</and>
|
||||
</enabledWhen>
|
||||
</page>
|
||||
<page class="org.eclipse.cdt.debug.internal.ui.propertypages.CBreakpointFilteringPage"
|
||||
|
@ -1267,7 +1277,14 @@
|
|||
name="%FilteringBreakpointPage.label">
|
||||
<filter name="debugModelId" value="org.eclipse.cdt.debug.core"/>
|
||||
<enabledWhen>
|
||||
<adapt type="org.eclipse.cdt.debug.core.model.ICBreakpoint"/>
|
||||
<and>
|
||||
<adapt type="org.eclipse.cdt.debug.core.model.ICBreakpoint">
|
||||
</adapt>
|
||||
<not>
|
||||
<adapt type="org.eclipse.cdt.debug.core.model.ICTracepoint">
|
||||
</adapt>
|
||||
</not>
|
||||
</and>
|
||||
</enabledWhen>
|
||||
</page>
|
||||
<page
|
||||
|
@ -1907,6 +1924,34 @@
|
|||
</or>
|
||||
</enablement>
|
||||
</toggleTargetFactory>
|
||||
<toggleTargetFactory
|
||||
id="org.eclipse.cdt.debug.ui.ToggleCTracepointsTargetFactory"
|
||||
class="org.eclipse.cdt.debug.internal.ui.actions.ToggleCTracepointsTargetFactory">
|
||||
<enablement>
|
||||
<!-- Enable the breakpoint toggle for CDT's editors and model elements -->
|
||||
<and>
|
||||
<reference
|
||||
definitionId="org.eclipse.cdt.debug.ui.testIsTracepointActionSetActive">
|
||||
</reference>
|
||||
<or>
|
||||
<instanceof value="org.eclipse.cdt.internal.ui.editor.CEditor"/>
|
||||
<instanceof value="org.eclipse.cdt.internal.ui.editor.asm.AsmTextEditor"/>
|
||||
<instanceof value="org.eclipse.cdt.debug.internal.ui.views.disassembly.DisassemblyView"/>
|
||||
<instanceof value="org.eclipse.cdt.debug.internal.ui.disassembly.editor.DisassemblyEditor"/>
|
||||
<with variable="selection">
|
||||
<count value="1"/>
|
||||
<iterate>
|
||||
<or>
|
||||
<instanceof value="org.eclipse.cdt.core.model.IFunction"/>
|
||||
<instanceof value="org.eclipse.cdt.core.model.IMethod"/>
|
||||
<instanceof value="org.eclipse.cdt.core.model.IVariable"/>
|
||||
</or>
|
||||
</iterate>
|
||||
</with>
|
||||
</or>
|
||||
</and>
|
||||
</enablement>
|
||||
</toggleTargetFactory>
|
||||
</extension>
|
||||
<extension
|
||||
point="org.eclipse.ui.actionSets">
|
||||
|
@ -1915,6 +1960,11 @@
|
|||
label="%ReverseActionSet.label"
|
||||
visible="false">
|
||||
</actionSet>
|
||||
<actionSet
|
||||
id="org.eclipse.cdt.debug.ui.tracepointActionSet"
|
||||
label="%TracepointActionSet.label"
|
||||
visible="false">
|
||||
</actionSet>
|
||||
</extension>
|
||||
<extension
|
||||
point="org.eclipse.ui.commands">
|
||||
|
@ -2013,6 +2063,14 @@
|
|||
</or>
|
||||
</and>
|
||||
</definition>
|
||||
<definition id="org.eclipse.cdt.debug.ui.testIsTracepointActionSetActive">
|
||||
<with variable="activeContexts">
|
||||
<iterate operator="or">
|
||||
<equals value="org.eclipse.cdt.debug.ui.tracepointActionSet">
|
||||
</equals>
|
||||
</iterate>
|
||||
</with>
|
||||
</definition>
|
||||
</extension>
|
||||
<extension
|
||||
point="org.eclipse.ui.bindings">
|
||||
|
@ -2269,4 +2327,18 @@
|
|||
</command>
|
||||
</menuContribution>
|
||||
</extension>
|
||||
<extension
|
||||
point="org.eclipse.ui.popupMenus">
|
||||
<viewerContribution
|
||||
id="org.eclipse.cdt.debug.ui.breakpointTypeMenu"
|
||||
targetID="#CEditorRulerContext">
|
||||
<action
|
||||
class="org.eclipse.debug.ui.actions.RulerBreakpointTypesActionDelegate"
|
||||
id="org.eclipse.cdt.debug.ui.breakpointTypesAction"
|
||||
label="%BreakpointTypes.label"
|
||||
menubarPath="debug"
|
||||
style="pulldown">
|
||||
</action>
|
||||
</viewerContribution>
|
||||
</extension>
|
||||
</plugin>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2007 Wind River Systems and others.
|
||||
* Copyright (c) 2009 Wind River 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:
|
||||
* Wind River Systems - initial API and implementation
|
||||
* Ericsson - Added tracepoint support (284286)
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.debug.internal.ui;
|
||||
|
||||
import org.eclipse.cdt.debug.core.model.ICBreakpoint;
|
||||
import org.eclipse.cdt.debug.core.model.ICTracepoint;
|
||||
import org.eclipse.core.runtime.IAdaptable;
|
||||
import org.eclipse.core.runtime.IAdapterFactory;
|
||||
import org.eclipse.core.runtime.Platform;
|
||||
|
@ -76,7 +78,7 @@ class CBreakpointContextActionFilter implements IActionFilter {
|
|||
|
||||
public boolean testAttribute(Object target, String name, String value) {
|
||||
if (target instanceof CBreakpointContext) {
|
||||
if ("debugModelId".equals(name)) {
|
||||
if ("debugModelId".equals(name)) { //$NON-NLS-1$
|
||||
String[] targetModelIds = getDebugModelIds( (CBreakpointContext)target );
|
||||
for (int i = 0; i < targetModelIds.length; i++) {
|
||||
if (targetModelIds[i].equals(value)) {
|
||||
|
@ -113,7 +115,7 @@ class CBreakpointContextActionFilter implements IActionFilter {
|
|||
class CBreakpointContextAdapterFactory implements IAdapterFactory {
|
||||
|
||||
private static final Class[] fgAdapterList = new Class[] {
|
||||
IBreakpoint.class, ICBreakpoint.class, IActionFilter.class
|
||||
IBreakpoint.class, ICBreakpoint.class, ICTracepoint.class, IActionFilter.class
|
||||
};
|
||||
|
||||
private static final IActionFilter fgActionFilter = new CBreakpointContextActionFilter();
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2000, 2007 QNX Software Systems and others.
|
||||
* Copyright (c) 2009 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,6 +7,7 @@
|
|||
*
|
||||
* Contributors:
|
||||
* QNX Software Systems - Initial API and implementation
|
||||
* Ericsson - Added tracepoint support (284286)
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.debug.internal.ui;
|
||||
|
||||
|
@ -48,7 +49,7 @@ public class CDebugImages {
|
|||
|
||||
// The plugin registry
|
||||
private static ImageRegistry fgImageRegistry = null;
|
||||
private static HashMap fgAvoidSWTErrorMap = null;
|
||||
private static HashMap<String, ImageDescriptor> fgAvoidSWTErrorMap = null;
|
||||
|
||||
/*
|
||||
* Available cached Images in the C/C++ debug plug-in image registry.
|
||||
|
@ -74,6 +75,8 @@ public class CDebugImages {
|
|||
public static final String IMG_OBJS_ADDRESS_BREAKPOINT_DISABLED = NAME_PREFIX + "addrbrkpd_obj.gif"; //$NON-NLS-1$
|
||||
public static final String IMG_OBJS_FUNCTION_BREAKPOINT_ENABLED = NAME_PREFIX + "funbrkp_obj.gif"; //$NON-NLS-1$
|
||||
public static final String IMG_OBJS_FUNCTION_BREAKPOINT_DISABLED = NAME_PREFIX + "funbrkpd_obj.gif"; //$NON-NLS-1$
|
||||
public static final String IMG_OBJS_TRACEPOINT_ENABLED = NAME_PREFIX + "trcp_obj.gif"; //$NON-NLS-1$
|
||||
public static final String IMG_OBJS_TRACEPOINT_DISABLED = NAME_PREFIX + "trcpd_obj.gif"; //$NON-NLS-1$
|
||||
public static final String IMG_OBJS_WATCHPOINT_ENABLED = NAME_PREFIX + "readwrite_obj.gif"; //$NON-NLS-1$
|
||||
public static final String IMG_OBJS_WATCHPOINT_DISABLED = NAME_PREFIX + "readwrite_obj_disabled.gif"; //$NON-NLS-1$
|
||||
public static final String IMG_OBJS_READ_WATCHPOINT_ENABLED = NAME_PREFIX + "read_obj.gif"; //$NON-NLS-1$
|
||||
|
@ -154,6 +157,8 @@ public class CDebugImages {
|
|||
public static final ImageDescriptor DESC_OVRS_GLOBAL = createManaged( T_OVR, IMG_OVRS_GLOBAL );
|
||||
public static final ImageDescriptor DESC_OBJS_BREAKPOINT_ENABLED = createManaged( T_OBJ, IMG_OBJS_BREAKPOINT_ENABLED );
|
||||
public static final ImageDescriptor DESC_OBJS_BREAKPOINT_DISABLED = createManaged( T_OBJ, IMG_OBJS_BREAKPOINT_DISABLED );
|
||||
public static final ImageDescriptor DESC_OBJS_TRACEPOINT_ENABLED = createManaged( T_ELCL, IMG_OBJS_TRACEPOINT_ENABLED );
|
||||
public static final ImageDescriptor DESC_OBJS_TRACEPOINT_DISABLED = createManaged( T_DLCL, IMG_OBJS_TRACEPOINT_DISABLED );
|
||||
public static final ImageDescriptor DESC_OBJS_WATCHPOINT_ENABLED = createManaged( T_OBJ, IMG_OBJS_WATCHPOINT_ENABLED );
|
||||
public static final ImageDescriptor DESC_OBJS_WATCHPOINT_DISABLED = createManaged( T_OBJ, IMG_OBJS_WATCHPOINT_DISABLED );
|
||||
public static final ImageDescriptor DESC_OBJS_READ_WATCHPOINT_ENABLED = createManaged( T_OBJ, IMG_OBJS_READ_WATCHPOINT_ENABLED );
|
||||
|
@ -236,10 +241,10 @@ public class CDebugImages {
|
|||
if ( fgImageRegistry == null )
|
||||
{
|
||||
fgImageRegistry = new ImageRegistry();
|
||||
for ( Iterator iter = fgAvoidSWTErrorMap.keySet().iterator(); iter.hasNext(); )
|
||||
for ( Iterator<String> iter = fgAvoidSWTErrorMap.keySet().iterator(); iter.hasNext(); )
|
||||
{
|
||||
String key = (String)iter.next();
|
||||
fgImageRegistry.put( key, (ImageDescriptor)fgAvoidSWTErrorMap.get( key ) );
|
||||
String key = iter.next();
|
||||
fgImageRegistry.put( key, fgAvoidSWTErrorMap.get( key ) );
|
||||
}
|
||||
fgAvoidSWTErrorMap = null;
|
||||
}
|
||||
|
@ -283,7 +288,7 @@ public class CDebugImages {
|
|||
ImageDescriptor result = ImageDescriptor.createFromURL( makeIconFileURL( prefix, name.substring( NAME_PREFIX_LENGTH ) ) );
|
||||
if ( fgAvoidSWTErrorMap == null )
|
||||
{
|
||||
fgAvoidSWTErrorMap = new HashMap();
|
||||
fgAvoidSWTErrorMap = new HashMap<String, ImageDescriptor>();
|
||||
}
|
||||
fgAvoidSWTErrorMap.put( name, result );
|
||||
if ( fgImageRegistry != null )
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2004, 2008 QNX Software Systems and others.
|
||||
* Copyright (c) 2009 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
|
||||
|
@ -10,11 +10,11 @@
|
|||
* Ken Ryall (Nokia) - Added support for CSourceNotFoundElement ( 167305 )
|
||||
* ARM Limited - https://bugs.eclipse.org/bugs/show_bug.cgi?id=186981
|
||||
* Ken Ryall (Nokia) - Bug 201165 don't toss images on dispose.
|
||||
* Ericsson - Bug 284286 support for tracepoints
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.debug.internal.ui;
|
||||
|
||||
import java.io.File;
|
||||
import com.ibm.icu.text.MessageFormat;
|
||||
import java.util.HashMap;
|
||||
|
||||
import org.eclipse.cdt.core.IAddress;
|
||||
|
@ -44,6 +44,7 @@ import org.eclipse.cdt.debug.core.model.ICModule;
|
|||
import org.eclipse.cdt.debug.core.model.ICSignal;
|
||||
import org.eclipse.cdt.debug.core.model.ICStackFrame;
|
||||
import org.eclipse.cdt.debug.core.model.ICThread;
|
||||
import org.eclipse.cdt.debug.core.model.ICTracepoint;
|
||||
import org.eclipse.cdt.debug.core.model.ICType;
|
||||
import org.eclipse.cdt.debug.core.model.ICValue;
|
||||
import org.eclipse.cdt.debug.core.model.ICVariable;
|
||||
|
@ -97,6 +98,8 @@ import org.eclipse.ui.IEditorRegistry;
|
|||
import org.eclipse.ui.PlatformUI;
|
||||
import org.eclipse.ui.part.FileEditorInput;
|
||||
|
||||
import com.ibm.icu.text.MessageFormat;
|
||||
|
||||
/**
|
||||
* @see IDebugModelPresentation
|
||||
*/
|
||||
|
@ -106,7 +109,7 @@ public class CDebugModelPresentation extends LabelProvider implements IDebugMode
|
|||
|
||||
private static final String DUMMY_STACKFRAME_LABEL = "..."; //$NON-NLS-1$
|
||||
|
||||
protected HashMap fAttributes = new HashMap( 3 );
|
||||
protected HashMap<String, Object> fAttributes = new HashMap<String, Object>( 3 );
|
||||
|
||||
protected CDebugImageDescriptorRegistry fDebugImageRegistry = CDebugUIPlugin.getImageDescriptorRegistry();
|
||||
|
||||
|
@ -318,6 +321,10 @@ public class CDebugModelPresentation extends LabelProvider implements IDebugMode
|
|||
if (image!=null) return image;
|
||||
}
|
||||
try {
|
||||
// Check for ICTracepoint first because they are also ICLineBreakpoint
|
||||
if ( breakpoint instanceof ICTracepoint ) {
|
||||
return getTracepointImage( (ICTracepoint)breakpoint );
|
||||
}
|
||||
if ( breakpoint instanceof ICLineBreakpoint ) {
|
||||
return getLineBreakpointImage( (ICLineBreakpoint)breakpoint );
|
||||
}
|
||||
|
@ -330,6 +337,17 @@ public class CDebugModelPresentation extends LabelProvider implements IDebugMode
|
|||
return null;
|
||||
}
|
||||
|
||||
protected Image getTracepointImage( ICTracepoint tracepoint ) throws CoreException {
|
||||
ImageDescriptor descriptor = null;
|
||||
if ( tracepoint.isEnabled() ) {
|
||||
descriptor = CDebugImages.DESC_OBJS_TRACEPOINT_ENABLED;
|
||||
}
|
||||
else {
|
||||
descriptor = CDebugImages.DESC_OBJS_TRACEPOINT_DISABLED;
|
||||
}
|
||||
return getImageCache().getImageFor( new OverlayImageDescriptor( fDebugImageRegistry.get( descriptor ), computeOverlays( tracepoint ) ) );
|
||||
}
|
||||
|
||||
protected Image getLineBreakpointImage( ICLineBreakpoint breakpoint ) throws CoreException {
|
||||
ImageDescriptor descriptor = null;
|
||||
if ( breakpoint.isEnabled() ) {
|
||||
|
@ -338,7 +356,7 @@ public class CDebugModelPresentation extends LabelProvider implements IDebugMode
|
|||
else {
|
||||
descriptor = CDebugImages.DESC_OBJS_BREAKPOINT_DISABLED;
|
||||
}
|
||||
return getImageCache().getImageFor( new OverlayImageDescriptor( fDebugImageRegistry.get( descriptor ), computeBreakpointOverlays( breakpoint ) ) );
|
||||
return getImageCache().getImageFor( new OverlayImageDescriptor( fDebugImageRegistry.get( descriptor ), computeOverlays( breakpoint ) ) );
|
||||
}
|
||||
|
||||
protected Image getWatchpointImage( ICWatchpoint watchpoint ) throws CoreException {
|
||||
|
@ -359,7 +377,7 @@ public class CDebugModelPresentation extends LabelProvider implements IDebugMode
|
|||
else
|
||||
descriptor = CDebugImages.DESC_OBJS_WATCHPOINT_DISABLED;
|
||||
}
|
||||
return getImageCache().getImageFor( new OverlayImageDescriptor( fDebugImageRegistry.get( descriptor ), computeBreakpointOverlays( watchpoint ) ) );
|
||||
return getImageCache().getImageFor( new OverlayImageDescriptor( fDebugImageRegistry.get( descriptor ), computeOverlays( watchpoint ) ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -478,7 +496,7 @@ public class CDebugModelPresentation extends LabelProvider implements IDebugMode
|
|||
return showQualified.booleanValue();
|
||||
}
|
||||
|
||||
private HashMap getAttributes() {
|
||||
private HashMap<String, Object> getAttributes() {
|
||||
return this.fAttributes;
|
||||
}
|
||||
|
||||
|
@ -494,7 +512,7 @@ public class CDebugModelPresentation extends LabelProvider implements IDebugMode
|
|||
return DebugPlugin.getDefault().getBreakpointManager().getBreakpoint( marker );
|
||||
}
|
||||
|
||||
private ImageDescriptor[] computeBreakpointOverlays( ICBreakpoint breakpoint ) {
|
||||
private ImageDescriptor[] computeOverlays( ICBreakpoint breakpoint ) {
|
||||
ImageDescriptor[] overlays = new ImageDescriptor[]{ null, null, null, null };
|
||||
try {
|
||||
if ( CDebugCorePlugin.getDefault().getBreakpointActionManager().breakpointHasActions(breakpoint) ) {
|
||||
|
|
|
@ -127,3 +127,5 @@ AddEventBreakpointActionDelegate.0=Error adding Event Breakpoint
|
|||
AddEventBreakpointActionDelegate.2=Action is not supported by installed debuggers
|
||||
ToggleCBreakpointsTargetFactory.CBreakpointDescription=Standard C/C++ breakpoint type.
|
||||
ToggleCBreakpointsTargetFactory.CBreakpointName=C/C++ Breakpoints
|
||||
ToggleCBreakpointsTargetFactory.CTracepointDescription=Standard C/C++ tracepoint type.
|
||||
ToggleCBreakpointsTargetFactory.CTracepointName=C/C++ Tracepoints
|
||||
|
|
|
@ -0,0 +1,68 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2009 Ericsson 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:
|
||||
* Ericsson - initial API and implementation
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.debug.internal.ui.actions;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import org.eclipse.cdt.debug.ui.CDebugUIPlugin;
|
||||
import org.eclipse.debug.ui.actions.IToggleBreakpointsTarget;
|
||||
import org.eclipse.debug.ui.actions.IToggleBreakpointsTargetFactory;
|
||||
import org.eclipse.jface.viewers.ISelection;
|
||||
import org.eclipse.ui.IWorkbenchPart;
|
||||
|
||||
/**
|
||||
* Toggle tracepoints target factory for the CEditor.
|
||||
* We use a separate factory so that we can control it through an action set.
|
||||
*
|
||||
* @since 6.1
|
||||
*/
|
||||
public class ToggleCTracepointsTargetFactory implements IToggleBreakpointsTargetFactory {
|
||||
|
||||
public static String TOGGLE_C_TRACEPOINT_TARGET_ID = CDebugUIPlugin.getUniqueIdentifier() + ".toggleCTracepointTarget"; //$NON-NLS-1$
|
||||
|
||||
private static Set<String> TOGGLE_TARGET_IDS = new HashSet<String>(1);
|
||||
static {
|
||||
TOGGLE_TARGET_IDS.add(TOGGLE_C_TRACEPOINT_TARGET_ID);
|
||||
}
|
||||
|
||||
private ToggleTracepointAdapter fCToggleTracepointTarget = new ToggleTracepointAdapter();
|
||||
|
||||
public IToggleBreakpointsTarget createToggleTarget(String targetID) {
|
||||
if (TOGGLE_C_TRACEPOINT_TARGET_ID.equals(targetID)) {
|
||||
return fCToggleTracepointTarget;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public String getDefaultToggleTarget(IWorkbenchPart part, ISelection selection) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public String getToggleTargetDescription(String targetID) {
|
||||
if (TOGGLE_C_TRACEPOINT_TARGET_ID.equals(targetID)) {
|
||||
return ActionMessages.getString("ToggleCBreakpointsTargetFactory.CTracepointDescription"); //$NON-NLS-1$
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public String getToggleTargetName(String targetID) {
|
||||
if (TOGGLE_C_TRACEPOINT_TARGET_ID.equals(targetID)) {
|
||||
return ActionMessages.getString("ToggleCBreakpointsTargetFactory.CTracepointName"); //$NON-NLS-1$
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public Set getToggleTargets(IWorkbenchPart part, ISelection selection) {
|
||||
return TOGGLE_TARGET_IDS;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,328 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2009 Ericsson 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:
|
||||
* Ericsson - Initial API and implementation
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.debug.internal.ui.actions;
|
||||
|
||||
import org.eclipse.cdt.core.model.CModelException;
|
||||
import org.eclipse.cdt.core.model.CoreModel;
|
||||
import org.eclipse.cdt.core.model.ICElement;
|
||||
import org.eclipse.cdt.core.model.IDeclaration;
|
||||
import org.eclipse.cdt.core.model.IFunction;
|
||||
import org.eclipse.cdt.core.model.IFunctionDeclaration;
|
||||
import org.eclipse.cdt.core.model.IMethod;
|
||||
import org.eclipse.cdt.core.model.ISourceRange;
|
||||
import org.eclipse.cdt.core.model.ITranslationUnit;
|
||||
import org.eclipse.cdt.debug.core.CDIDebugModel;
|
||||
import org.eclipse.cdt.debug.core.model.ICBreakpointType;
|
||||
import org.eclipse.cdt.debug.core.model.ICFunctionBreakpoint;
|
||||
import org.eclipse.cdt.debug.core.model.ICLineBreakpoint;
|
||||
import org.eclipse.cdt.debug.internal.ui.CDebugUIUtils;
|
||||
import org.eclipse.cdt.debug.internal.ui.IInternalCDebugUIConstants;
|
||||
import org.eclipse.cdt.debug.ui.CDebugUIPlugin;
|
||||
import org.eclipse.cdt.internal.ui.util.ExternalEditorInput;
|
||||
import org.eclipse.cdt.ui.CDTUITools;
|
||||
import org.eclipse.core.resources.IFile;
|
||||
import org.eclipse.core.resources.IResource;
|
||||
import org.eclipse.core.resources.IWorkspaceRoot;
|
||||
import org.eclipse.core.resources.ResourcesPlugin;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
import org.eclipse.core.runtime.IPath;
|
||||
import org.eclipse.core.runtime.IStatus;
|
||||
import org.eclipse.core.runtime.Status;
|
||||
import org.eclipse.debug.core.DebugPlugin;
|
||||
import org.eclipse.debug.ui.actions.IToggleBreakpointsTarget;
|
||||
import org.eclipse.jface.text.IDocument;
|
||||
import org.eclipse.jface.text.ITextSelection;
|
||||
import org.eclipse.jface.viewers.ISelection;
|
||||
import org.eclipse.jface.viewers.IStructuredSelection;
|
||||
import org.eclipse.ui.IEditorInput;
|
||||
import org.eclipse.ui.IEditorPart;
|
||||
import org.eclipse.ui.IFileEditorInput;
|
||||
import org.eclipse.ui.IWorkbenchPart;
|
||||
import org.eclipse.ui.editors.text.ILocationProvider;
|
||||
import org.eclipse.ui.texteditor.ITextEditor;
|
||||
|
||||
/**
|
||||
* Toggles a tracepoint in a C/C++ editor.
|
||||
*/
|
||||
public class ToggleTracepointAdapter implements IToggleBreakpointsTarget {
|
||||
|
||||
/**
|
||||
* Toggle a line tracepoint
|
||||
*/
|
||||
public void toggleLineBreakpoints( IWorkbenchPart part, ISelection selection ) throws CoreException {
|
||||
String errorMessage = null;
|
||||
if ( part instanceof ITextEditor ) {
|
||||
ITextEditor textEditor = (ITextEditor)part;
|
||||
IEditorInput input = textEditor.getEditorInput();
|
||||
if ( input == null ) {
|
||||
errorMessage = ActionMessages.getString( "ToggleBreakpointAdapter.Empty_editor_1" ); //$NON-NLS-1$
|
||||
}
|
||||
else {
|
||||
IDocument document = textEditor.getDocumentProvider().getDocument( input );
|
||||
if ( document == null ) {
|
||||
errorMessage = ActionMessages.getString( "ToggleBreakpointAdapter.Missing_document_1" ); //$NON-NLS-1$
|
||||
}
|
||||
else {
|
||||
IResource resource = getResource( textEditor );
|
||||
if ( resource == null ) {
|
||||
errorMessage = ActionMessages.getString( "ToggleBreakpointAdapter.Missing_resource_1" ); //$NON-NLS-1$
|
||||
}
|
||||
else {
|
||||
BreakpointLocationVerifier bv = new BreakpointLocationVerifier();
|
||||
int lineNumber = bv.getValidLineBreakpointLocation( document, ((ITextSelection)selection).getStartLine() );
|
||||
if ( lineNumber == -1 ) {
|
||||
errorMessage = ActionMessages.getString( "ToggleBreakpointAdapter.Invalid_line_1" ); //$NON-NLS-1$
|
||||
}
|
||||
else {
|
||||
String sourceHandle = getSourceHandle( input );
|
||||
// the method lineBreakpointExists also works for tracepoints
|
||||
ICLineBreakpoint breakpoint = CDIDebugModel.lineBreakpointExists( sourceHandle, resource, lineNumber );
|
||||
if ( breakpoint != null ) {
|
||||
DebugPlugin.getDefault().getBreakpointManager().removeBreakpoint( breakpoint, true );
|
||||
}
|
||||
else {
|
||||
CDIDebugModel.createLineTracepoint( sourceHandle,
|
||||
resource,
|
||||
ICBreakpointType.REGULAR,
|
||||
lineNumber,
|
||||
true,
|
||||
0,
|
||||
"", //$NON-NLS-1$
|
||||
true );
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
errorMessage = ActionMessages.getString( "RunToLineAdapter.Operation_is_not_supported_1" ); //$NON-NLS-1$
|
||||
}
|
||||
throw new CoreException( new Status( IStatus.ERROR, CDebugUIPlugin.getUniqueIdentifier(), IInternalCDebugUIConstants.INTERNAL_ERROR, errorMessage, null ) );
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.debug.ui.actions.IToggleBreakpointsTarget#canToggleLineBreakpoints(org.eclipse.ui.IWorkbenchPart, org.eclipse.jface.viewers.ISelection)
|
||||
*/
|
||||
public boolean canToggleLineBreakpoints( IWorkbenchPart part, ISelection selection ) {
|
||||
return ( selection instanceof ITextSelection );
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.debug.ui.actions.IToggleBreakpointsTarget#toggleMethodBreakpoints(org.eclipse.ui.IWorkbenchPart, org.eclipse.jface.viewers.ISelection)
|
||||
*/
|
||||
public void toggleMethodBreakpoints( IWorkbenchPart part, ISelection selection ) throws CoreException {
|
||||
ICElement element = getCElementFromSelection( part, selection );
|
||||
if ( element instanceof IFunction || element instanceof IMethod ) {
|
||||
toggleMethodBreakpoints0( (IDeclaration)element );
|
||||
}
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.debug.ui.actions.IToggleBreakpointsTarget#canToggleMethodBreakpoints(org.eclipse.ui.IWorkbenchPart, org.eclipse.jface.viewers.ISelection)
|
||||
*/
|
||||
public boolean canToggleMethodBreakpoints( IWorkbenchPart part, ISelection selection ) {
|
||||
ICElement element = getCElementFromSelection( part, selection );
|
||||
return ( element instanceof IFunction || element instanceof IMethod );
|
||||
}
|
||||
|
||||
protected ICElement getCElementFromSelection( IWorkbenchPart part, ISelection selection ) {
|
||||
if ( selection instanceof ITextSelection ) {
|
||||
ITextSelection textSelection = (ITextSelection)selection;
|
||||
String text = textSelection.getText();
|
||||
if ( text != null ) {
|
||||
if (part instanceof ITextEditor) {
|
||||
ICElement editorElement = CDTUITools.getEditorInputCElement(((ITextEditor) part).getEditorInput());
|
||||
if (editorElement instanceof ITranslationUnit) {
|
||||
ITranslationUnit tu = (ITranslationUnit) editorElement;
|
||||
try {
|
||||
if (tu.isStructureKnown() && tu.isConsistent()) {
|
||||
return tu.getElementAtOffset( textSelection.getOffset() );
|
||||
}
|
||||
} catch (CModelException exc) {
|
||||
// ignored on purpose
|
||||
}
|
||||
}
|
||||
} else {
|
||||
IResource resource = getResource( part );
|
||||
if ( resource instanceof IFile ) {
|
||||
ITranslationUnit tu = getTranslationUnit( (IFile)resource );
|
||||
if ( tu != null ) {
|
||||
try {
|
||||
ICElement element = tu.getElement( text.trim() );
|
||||
if ( element == null ) {
|
||||
element = tu.getElementAtLine( textSelection.getStartLine() );
|
||||
}
|
||||
return element;
|
||||
}
|
||||
catch( CModelException e ) {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if ( selection instanceof IStructuredSelection ) {
|
||||
IStructuredSelection ss = (IStructuredSelection)selection;
|
||||
if ( ss.size() == 1 ) {
|
||||
Object object = ss.getFirstElement();
|
||||
if ( object instanceof ICElement ) {
|
||||
return (ICElement)object;
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.debug.ui.actions.IToggleBreakpointsTarget#toggleWatchpoints(org.eclipse.ui.IWorkbenchPart, org.eclipse.jface.viewers.ISelection)
|
||||
*/
|
||||
public void toggleWatchpoints( IWorkbenchPart part, ISelection selection ) throws CoreException {
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.debug.ui.actions.IToggleBreakpointsTarget#canToggleWatchpoints(org.eclipse.ui.IWorkbenchPart, org.eclipse.jface.viewers.ISelection)
|
||||
*/
|
||||
public boolean canToggleWatchpoints( IWorkbenchPart part, ISelection selection ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
protected static IResource getResource( IWorkbenchPart part ) {
|
||||
IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
|
||||
if ( part instanceof IEditorPart ) {
|
||||
IEditorInput editorInput = ((IEditorPart)part).getEditorInput();
|
||||
IResource resource = null;
|
||||
if ( editorInput instanceof IFileEditorInput ) {
|
||||
resource = ((IFileEditorInput)editorInput).getFile();
|
||||
} else if (editorInput instanceof ExternalEditorInput) {
|
||||
resource = ((ExternalEditorInput)editorInput).getMarkerResource();
|
||||
}
|
||||
if (resource != null)
|
||||
return resource;
|
||||
/* This file is not in a project, let default case handle it */
|
||||
ILocationProvider provider = (ILocationProvider)editorInput.getAdapter( ILocationProvider.class );
|
||||
if ( provider != null ) {
|
||||
IPath location = provider.getPath( editorInput );
|
||||
if ( location != null ) {
|
||||
IFile[] files = root.findFilesForLocation( location );
|
||||
if ( files.length > 0 )
|
||||
return files[0];
|
||||
}
|
||||
}
|
||||
}
|
||||
return root;
|
||||
}
|
||||
|
||||
private String getSourceHandle( IEditorInput input ) throws CoreException {
|
||||
return CDebugUIUtils.getEditorFilePath(input);
|
||||
}
|
||||
|
||||
private String getSourceHandle( IDeclaration declaration ) {
|
||||
ITranslationUnit tu = declaration.getTranslationUnit();
|
||||
if ( tu != null ) {
|
||||
IPath location = tu.getLocation();
|
||||
if (location != null) {
|
||||
return location.toOSString();
|
||||
}
|
||||
}
|
||||
return ""; //$NON-NLS-1$
|
||||
}
|
||||
|
||||
private IResource getElementResource( IDeclaration declaration ) {
|
||||
return declaration.getUnderlyingResource();
|
||||
}
|
||||
|
||||
private String getFunctionName( IFunction function ) {
|
||||
String functionName = function.getElementName();
|
||||
StringBuffer name = new StringBuffer( functionName );
|
||||
ITranslationUnit tu = function.getTranslationUnit();
|
||||
if ( tu != null && tu.isCXXLanguage() ) {
|
||||
appendParameters( name, function );
|
||||
}
|
||||
return name.toString();
|
||||
}
|
||||
|
||||
private String getMethodName( IMethod method ) {
|
||||
StringBuffer name = new StringBuffer();
|
||||
String methodName = method.getElementName();
|
||||
ICElement parent = method.getParent();
|
||||
while ( parent != null && ( parent.getElementType() == ICElement.C_NAMESPACE || parent.getElementType() == ICElement.C_CLASS
|
||||
|| parent.getElementType() == ICElement.C_STRUCT || parent.getElementType() == ICElement.C_UNION ) ) {
|
||||
name.append( parent.getElementName() ).append( "::" ); //$NON-NLS-1$
|
||||
parent = parent.getParent();
|
||||
}
|
||||
name.append( methodName );
|
||||
appendParameters( name, method );
|
||||
return name.toString();
|
||||
}
|
||||
|
||||
private void appendParameters( StringBuffer sb, IFunctionDeclaration fd ) {
|
||||
String[] params = fd.getParameterTypes();
|
||||
sb.append( '(' );
|
||||
for( int i = 0; i < params.length; ++i ) {
|
||||
sb.append( params[i] );
|
||||
if ( i != params.length - 1 )
|
||||
sb.append( ',' );
|
||||
}
|
||||
sb.append( ')' );
|
||||
}
|
||||
|
||||
private ITranslationUnit getTranslationUnit( IFile file ) {
|
||||
Object element = CoreModel.getDefault().create( file );
|
||||
if ( element instanceof ITranslationUnit ) {
|
||||
return (ITranslationUnit)element;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private void toggleMethodBreakpoints0( IDeclaration declaration ) throws CoreException {
|
||||
String sourceHandle = getSourceHandle( declaration );
|
||||
IResource resource = getElementResource( declaration );
|
||||
String functionName = ( declaration instanceof IFunction ) ? getFunctionName( (IFunction)declaration ) : getMethodName( (IMethod)declaration );
|
||||
// The method functionBreakpointExists also works for tracepoints
|
||||
ICFunctionBreakpoint breakpoint = CDIDebugModel.functionBreakpointExists( sourceHandle, resource, functionName );
|
||||
if ( breakpoint != null ) {
|
||||
DebugPlugin.getDefault().getBreakpointManager().removeBreakpoint( breakpoint, true );
|
||||
}
|
||||
else {
|
||||
int lineNumber = -1;
|
||||
int charStart = -1;
|
||||
int charEnd = -1;
|
||||
try {
|
||||
ISourceRange sourceRange = declaration.getSourceRange();
|
||||
if ( sourceRange != null ) {
|
||||
charStart = sourceRange.getStartPos();
|
||||
charEnd = charStart + sourceRange.getLength();
|
||||
if ( charEnd <= 0 ) {
|
||||
charStart = -1;
|
||||
charEnd = -1;
|
||||
}
|
||||
lineNumber = sourceRange.getStartLine();
|
||||
}
|
||||
}
|
||||
catch( CModelException e ) {
|
||||
DebugPlugin.log( e );
|
||||
}
|
||||
CDIDebugModel.createFunctionTracepoint( sourceHandle,
|
||||
resource,
|
||||
ICBreakpointType.REGULAR,
|
||||
functionName,
|
||||
charStart,
|
||||
charEnd,
|
||||
lineNumber,
|
||||
true,
|
||||
0,
|
||||
"", //$NON-NLS-1$
|
||||
true );
|
||||
}
|
||||
}
|
||||
}
|
|
@ -20,6 +20,9 @@ import org.eclipse.swt.layout.GridData;
|
|||
import org.eclipse.swt.widgets.Composite;
|
||||
import org.eclipse.swt.widgets.Label;
|
||||
|
||||
/**
|
||||
* @since 6.1
|
||||
*/
|
||||
public class ReadOnlyFieldEditor extends FieldEditor implements ICBreakpointsUIContributionUser {
|
||||
protected Label textField;
|
||||
protected ICBreakpointsUIContribution contribution;
|
||||
|
|
|
@ -24,4 +24,8 @@ launchTab.sourceLookup.name=Source
|
|||
launchTab.common.name=Common
|
||||
|
||||
editorTextHover.label=GDB Debugger
|
||||
editorTextHover.description=Shows formatted value in debugger hover
|
||||
editorTextHover.description=Shows formatted value in debugger hover
|
||||
|
||||
breakpoints.property.filter=Filter
|
||||
tracepoints.property.common=Common
|
||||
tracepoints.property.actions=Actions
|
||||
|
|
|
@ -183,10 +183,22 @@
|
|||
<extension point="org.eclipse.ui.propertyPages">
|
||||
<page class="org.eclipse.cdt.dsf.gdb.internal.ui.breakpoints.CBreakpointGdbThreadFilterPage"
|
||||
id="org.eclipse.cdt.dsf.gdb.breakpoint.filtering"
|
||||
name="Filter">
|
||||
name="%breakpoints.property.filter">
|
||||
<filter name="debugModelId" value="org.eclipse.cdt.dsf.gdb"/>
|
||||
<enabledWhen>
|
||||
<adapt type="org.eclipse.cdt.debug.core.model.ICBreakpoint"/>
|
||||
<and>
|
||||
<adapt type="org.eclipse.cdt.debug.core.model.ICBreakpoint"/>
|
||||
<not>
|
||||
<adapt type="org.eclipse.cdt.debug.core.model.ICTracepoint"/>
|
||||
</not>
|
||||
</and>
|
||||
</enabledWhen>
|
||||
</page>
|
||||
<page class="org.eclipse.cdt.dsf.gdb.internal.ui.breakpoints.GDBTracepointPropertyPage"
|
||||
id="org.eclipse.cdt.dsf.gdb.tracepoint.common"
|
||||
name="%tracepoints.property.common">
|
||||
<enabledWhen>
|
||||
<adapt type="org.eclipse.cdt.debug.core.model.ICTracepoint"/>
|
||||
</enabledWhen>
|
||||
</page>
|
||||
</extension>
|
||||
|
|
|
@ -0,0 +1,153 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2009 Ericsson, 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
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Ericsson - initial API and implementation
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.dsf.gdb.internal.ui.breakpoints;
|
||||
|
||||
import java.math.BigInteger;
|
||||
import java.net.URI;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import org.eclipse.cdt.debug.core.CDIDebugModel;
|
||||
import org.eclipse.cdt.debug.core.model.ICBreakpointType;
|
||||
import org.eclipse.cdt.dsf.debug.internal.ui.disassembly.provisional.DisassemblySelection;
|
||||
import org.eclipse.cdt.dsf.debug.internal.ui.disassembly.provisional.IDisassemblyPart;
|
||||
import org.eclipse.cdt.dsf.debug.internal.ui.disassembly.provisional.IDisassemblySelection;
|
||||
import org.eclipse.cdt.utils.Addr64;
|
||||
import org.eclipse.core.filesystem.URIUtil;
|
||||
import org.eclipse.core.resources.IMarker;
|
||||
import org.eclipse.core.resources.IResource;
|
||||
import org.eclipse.core.resources.ResourcesPlugin;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
import org.eclipse.core.runtime.IPath;
|
||||
import org.eclipse.debug.core.DebugPlugin;
|
||||
import org.eclipse.debug.core.model.IBreakpoint;
|
||||
import org.eclipse.debug.ui.actions.IToggleBreakpointsTargetExtension;
|
||||
import org.eclipse.jface.text.BadLocationException;
|
||||
import org.eclipse.jface.text.IDocument;
|
||||
import org.eclipse.jface.text.ITextSelection;
|
||||
import org.eclipse.jface.text.Position;
|
||||
import org.eclipse.jface.text.source.IAnnotationModel;
|
||||
import org.eclipse.jface.viewers.ISelection;
|
||||
import org.eclipse.ui.IWorkbenchPart;
|
||||
import org.eclipse.ui.texteditor.SimpleMarkerAnnotation;
|
||||
|
||||
/**
|
||||
* Toggle tracepoint target implementation for the disassembly part.
|
||||
*/
|
||||
public class DisassemblyToggleTracepointsTarget implements IToggleBreakpointsTargetExtension {
|
||||
|
||||
public void toggleLineBreakpoints(IWorkbenchPart part, ISelection selection) throws CoreException {
|
||||
assert part instanceof IDisassemblyPart && selection instanceof ITextSelection;
|
||||
|
||||
if (!(selection instanceof IDisassemblySelection)) {
|
||||
selection = new DisassemblySelection((ITextSelection) selection, (IDisassemblyPart) part);
|
||||
}
|
||||
IDisassemblySelection disassemblySelection = (IDisassemblySelection)selection;
|
||||
int line = disassemblySelection.getStartLine();
|
||||
IBreakpoint[] bp = getBreakpointsAtLine((IDisassemblyPart) part, line);
|
||||
if (bp == null || bp.length == 0) {
|
||||
insertBreakpoint(disassemblySelection);
|
||||
} else {
|
||||
for (int i = 0; i < bp.length; i++) {
|
||||
bp[i].delete();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public boolean canToggleLineBreakpoints(IWorkbenchPart part, ISelection selection) {
|
||||
return part instanceof IDisassemblyPart && selection instanceof ITextSelection;
|
||||
}
|
||||
|
||||
public void toggleMethodBreakpoints(IWorkbenchPart part, ISelection selection) throws CoreException {
|
||||
}
|
||||
|
||||
public boolean canToggleMethodBreakpoints(IWorkbenchPart part, ISelection selection) {
|
||||
return false;
|
||||
}
|
||||
|
||||
public void toggleWatchpoints(IWorkbenchPart part, ISelection selection) throws CoreException {
|
||||
}
|
||||
|
||||
public boolean canToggleWatchpoints(IWorkbenchPart part, ISelection selection) {
|
||||
return false;
|
||||
}
|
||||
/*
|
||||
* @see org.eclipse.debug.ui.actions.IToggleBreakpointsTargetExtension#canToggleBreakpoints(org.eclipse.ui.IWorkbenchPart, org.eclipse.jface.viewers.ISelection)
|
||||
*/
|
||||
public boolean canToggleBreakpoints(IWorkbenchPart part, ISelection selection) {
|
||||
return canToggleLineBreakpoints(part, selection);
|
||||
}
|
||||
/*
|
||||
* @see org.eclipse.debug.ui.actions.IToggleBreakpointsTargetExtension#toggleBreakpoints(org.eclipse.ui.IWorkbenchPart, org.eclipse.jface.viewers.ISelection)
|
||||
*/
|
||||
public void toggleBreakpoints(IWorkbenchPart part, ISelection selection) throws CoreException {
|
||||
toggleLineBreakpoints(part, selection);
|
||||
}
|
||||
|
||||
private IBreakpoint[] getBreakpointsAtLine(IDisassemblyPart part, int line) {
|
||||
List<IBreakpoint> breakpoints = new ArrayList<IBreakpoint>();
|
||||
IAnnotationModel annotationModel = part.getTextViewer().getAnnotationModel();
|
||||
IDocument document = part.getTextViewer().getDocument();
|
||||
if (annotationModel != null) {
|
||||
Iterator<?> iterator = annotationModel.getAnnotationIterator();
|
||||
while (iterator.hasNext()) {
|
||||
Object object = iterator.next();
|
||||
if (object instanceof SimpleMarkerAnnotation) {
|
||||
SimpleMarkerAnnotation markerAnnotation = (SimpleMarkerAnnotation) object;
|
||||
IMarker marker = markerAnnotation.getMarker();
|
||||
try {
|
||||
if (marker.isSubtypeOf(IBreakpoint.BREAKPOINT_MARKER)) {
|
||||
Position position = annotationModel.getPosition(markerAnnotation);
|
||||
int bpLine = document.getLineOfOffset(position.getOffset());
|
||||
if (line == bpLine) {
|
||||
IBreakpoint breakpoint = DebugPlugin.getDefault().getBreakpointManager().getBreakpoint(marker);
|
||||
if (breakpoint != null) {
|
||||
breakpoints.add(breakpoint);
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (CoreException e) {
|
||||
} catch (BadLocationException e) {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
IBreakpoint[] breakpointsArray = new IBreakpoint[breakpoints.size()];
|
||||
return breakpoints.toArray(breakpointsArray );
|
||||
}
|
||||
private void insertBreakpoint(IDisassemblySelection selection) throws CoreException {
|
||||
BigInteger address = selection.getStartAddress();
|
||||
if (address == null) {
|
||||
return;
|
||||
}
|
||||
URI fileUri = selection.getSourceLocationURI();
|
||||
if (fileUri != null) {
|
||||
String filePath = null;
|
||||
IResource resource = selection.getSourceFile();
|
||||
if (resource != null) {
|
||||
final IPath location= resource.getLocation();
|
||||
if (location == null) {
|
||||
return;
|
||||
}
|
||||
filePath = location.toOSString();
|
||||
} else {
|
||||
resource = ResourcesPlugin.getWorkspace().getRoot();
|
||||
filePath = URIUtil.toPath(fileUri).toOSString();
|
||||
}
|
||||
int srcLine = selection.getSourceLine();
|
||||
CDIDebugModel.createLineTracepoint(filePath, resource, ICBreakpointType.REGULAR, srcLine + 1, true, 0, "", true); //$NON-NLS-1$
|
||||
} else {
|
||||
IResource resource = ResourcesPlugin.getWorkspace().getRoot();
|
||||
CDIDebugModel.createAddressTracepoint(null, null, resource, ICBreakpointType.REGULAR, -1, new Addr64(address), true, 0, "", true); //$NON-NLS-1$
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,443 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2009 Ericsson 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:
|
||||
* Ericsson - Initial API and implementation
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.dsf.gdb.internal.ui.breakpoints;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import org.eclipse.cdt.debug.core.model.ICAddressBreakpoint;
|
||||
import org.eclipse.cdt.debug.core.model.ICFunctionBreakpoint;
|
||||
import org.eclipse.cdt.debug.core.model.ICTracepoint;
|
||||
import org.eclipse.cdt.debug.ui.preferences.ReadOnlyFieldEditor;
|
||||
import org.eclipse.cdt.dsf.gdb.internal.ui.GdbUIPlugin;
|
||||
import org.eclipse.core.resources.IMarker;
|
||||
import org.eclipse.core.resources.IWorkspaceRunnable;
|
||||
import org.eclipse.core.resources.ResourcesPlugin;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
import org.eclipse.core.runtime.IAdaptable;
|
||||
import org.eclipse.core.runtime.IProgressMonitor;
|
||||
import org.eclipse.debug.core.model.ILineBreakpoint;
|
||||
import org.eclipse.jface.preference.BooleanFieldEditor;
|
||||
import org.eclipse.jface.preference.FieldEditor;
|
||||
import org.eclipse.jface.preference.FieldEditorPreferencePage;
|
||||
import org.eclipse.jface.preference.IPreferenceStore;
|
||||
import org.eclipse.jface.preference.IntegerFieldEditor;
|
||||
import org.eclipse.jface.preference.StringFieldEditor;
|
||||
import org.eclipse.jface.util.IPropertyChangeListener;
|
||||
import org.eclipse.jface.util.PropertyChangeEvent;
|
||||
import org.eclipse.swt.widgets.Composite;
|
||||
import org.eclipse.swt.widgets.Text;
|
||||
import org.eclipse.ui.IWorkbenchPropertyPage;
|
||||
|
||||
/**
|
||||
* The preference page used to present the properties of a GDB tracepoint as preferences.
|
||||
* A TracepointPreferenceStore is used to interface between this page and the tracepoint.
|
||||
*/
|
||||
public class GDBTracepointPropertyPage extends FieldEditorPreferencePage implements IWorkbenchPropertyPage {
|
||||
|
||||
class TracepointIntegerFieldEditor extends IntegerFieldEditor {
|
||||
|
||||
public TracepointIntegerFieldEditor(String name, String labelText, Composite parent) {
|
||||
super(name, labelText, parent);
|
||||
setErrorMessage(Messages.TracepointPropertyPage_integer_negative);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see IntegerFieldEditor#checkState()
|
||||
*/
|
||||
@Override
|
||||
protected boolean checkState() {
|
||||
Text control = getTextControl();
|
||||
if (!control.isEnabled()) {
|
||||
clearErrorMessage();
|
||||
return true;
|
||||
}
|
||||
return super.checkState();
|
||||
}
|
||||
|
||||
/**
|
||||
* Only store if the text control is enabled
|
||||
*
|
||||
* @see FieldEditor#doStore()
|
||||
*/
|
||||
@Override
|
||||
protected void doStore() {
|
||||
Text text = getTextControl();
|
||||
if (text.isEnabled()) {
|
||||
super.doStore();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Clears the error message from the message line if the error message is the error message from this field editor.
|
||||
*/
|
||||
@Override
|
||||
protected void clearErrorMessage() {
|
||||
if (getPage() != null) {
|
||||
String message = getPage().getErrorMessage();
|
||||
if ( message != null ) {
|
||||
if (getErrorMessage().equals(message)) {
|
||||
super.clearErrorMessage();
|
||||
}
|
||||
}
|
||||
else {
|
||||
super.clearErrorMessage();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class TracepointStringFieldEditor extends StringFieldEditor {
|
||||
|
||||
public TracepointStringFieldEditor(String name, String labelText, Composite parent) {
|
||||
super(name, labelText, parent);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see StringFieldEditor#checkState()
|
||||
*/
|
||||
@Override
|
||||
protected boolean checkState() {
|
||||
Text control = getTextControl();
|
||||
if (!control.isEnabled()) {
|
||||
clearErrorMessage();
|
||||
return true;
|
||||
}
|
||||
return super.checkState();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doStore() {
|
||||
Text text = getTextControl();
|
||||
if (text.isEnabled()) {
|
||||
super.doStore();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Clears the error message from the message line if the error message is the error message from this field editor.
|
||||
*/
|
||||
@Override
|
||||
protected void clearErrorMessage() {
|
||||
if (getPage() != null) {
|
||||
String message = getPage().getErrorMessage();
|
||||
if ( message != null ) {
|
||||
if (getErrorMessage().equals(message)) {
|
||||
super.clearErrorMessage();
|
||||
}
|
||||
}
|
||||
else {
|
||||
super.clearErrorMessage();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class LabelFieldEditor extends ReadOnlyFieldEditor {
|
||||
private String fValue;
|
||||
|
||||
public LabelFieldEditor(Composite parent, String title, String value) {
|
||||
super(title, title, parent);
|
||||
fValue = value;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doLoad() {
|
||||
if (textField != null) {
|
||||
textField.setText(fValue);
|
||||
}
|
||||
}
|
||||
@Override
|
||||
protected void doLoadDefault() {
|
||||
// nothing
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private BooleanFieldEditor fEnabled;
|
||||
|
||||
private TracepointStringFieldEditor fCondition;
|
||||
|
||||
private Text fIgnoreCountTextControl;
|
||||
private TracepointIntegerFieldEditor fIgnoreCount;
|
||||
|
||||
private Text fPassCountTextControl;
|
||||
private TracepointIntegerFieldEditor fPassCount;
|
||||
|
||||
private IAdaptable fElement;
|
||||
|
||||
/**
|
||||
* The "fake" preference store used to interface between
|
||||
* the tracepoint and the tracepoint preference page.
|
||||
*/
|
||||
private TracepointPreferenceStore fTracepointPreferenceStore;
|
||||
|
||||
/**
|
||||
* Constructor for GDBTracepointPropertyPage.
|
||||
*
|
||||
*/
|
||||
public GDBTracepointPropertyPage() {
|
||||
super( GRID );
|
||||
noDefaultAndApplyButton();
|
||||
fTracepointPreferenceStore = new TracepointPreferenceStore();
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.eclipse.jface.preference.FieldEditorPreferencePage#createFieldEditors()
|
||||
*/
|
||||
@Override
|
||||
protected void createFieldEditors() {
|
||||
ICTracepoint tracepoint = getTracepoint();
|
||||
createMainLabel(tracepoint);
|
||||
createTypeSpecificLabelFieldEditors(tracepoint);
|
||||
createEnabledField(getFieldEditorParent());
|
||||
IPreferenceStore store = getPreferenceStore();
|
||||
try {
|
||||
String condition = tracepoint.getCondition();
|
||||
if ( condition == null ) {
|
||||
condition = ""; //$NON-NLS-1$
|
||||
}
|
||||
store.setValue(TracepointPreferenceStore.CONDITION, condition);
|
||||
createConditionEditor(getFieldEditorParent());
|
||||
store.setValue(TracepointPreferenceStore.ENABLED, tracepoint.isEnabled());
|
||||
// GDB does not support ignore count right now
|
||||
// int ignoreCount = tracepoint.getIgnoreCount();
|
||||
// store.setValue(TracepointPreferenceStore.IGNORE_COUNT, (ignoreCount >= 0) ? ignoreCount : 0);
|
||||
// createIgnoreCountEditor(getFieldEditorParent());
|
||||
int passCount = tracepoint.getPassCount();
|
||||
store.setValue(TracepointPreferenceStore.PASS_COUNT, (passCount >= 0) ? passCount : 0);
|
||||
createPassCountEditor(getFieldEditorParent());
|
||||
}
|
||||
catch( CoreException ce ) {
|
||||
GdbUIPlugin.log(ce);
|
||||
}
|
||||
}
|
||||
|
||||
private void createMainLabel(ICTracepoint tracepoint) {
|
||||
addField(createLabelEditor(getFieldEditorParent(),
|
||||
Messages.TracepointPropertyPage_Class,
|
||||
getTracepointMainLabel(tracepoint)));
|
||||
}
|
||||
|
||||
/**
|
||||
* Method createTypeSpecificLabelFieldEditors.
|
||||
*
|
||||
* @param tracepoint
|
||||
*/
|
||||
private void createTypeSpecificLabelFieldEditors(ICTracepoint tracepoint) {
|
||||
|
||||
if (tracepoint instanceof ICFunctionBreakpoint) {
|
||||
ICFunctionBreakpoint ftrpt = (ICFunctionBreakpoint)tracepoint;
|
||||
String function = Messages.TracepointPropertyPage_NotAvailable;
|
||||
try {
|
||||
function = ftrpt.getFunction();
|
||||
}
|
||||
catch(CoreException e) {
|
||||
GdbUIPlugin.log(e);
|
||||
}
|
||||
if (function != null) {
|
||||
addField(createLabelEditor(getFieldEditorParent(), Messages.TracepointPropertyPage_FunctionName, function));
|
||||
}
|
||||
}
|
||||
else if (tracepoint instanceof ICAddressBreakpoint) {
|
||||
ICAddressBreakpoint atrpt = (ICAddressBreakpoint)tracepoint;
|
||||
String address = Messages.TracepointPropertyPage_NotAvailable;
|
||||
try {
|
||||
address = atrpt.getAddress();
|
||||
}
|
||||
catch(CoreException e) {
|
||||
GdbUIPlugin.log(e);
|
||||
}
|
||||
if (address != null) {
|
||||
addField(createLabelEditor(getFieldEditorParent(), Messages.TracepointPropertyPage_Address, address));
|
||||
}
|
||||
}
|
||||
else { // LineTracepoint
|
||||
String fileName = null;
|
||||
try {
|
||||
fileName = tracepoint.getSourceHandle();
|
||||
}
|
||||
catch(CoreException e) {
|
||||
GdbUIPlugin.log(e);
|
||||
}
|
||||
if (fileName != null) {
|
||||
addField(createLabelEditor(getFieldEditorParent(), Messages.TracepointPropertyPage_File, fileName));
|
||||
}
|
||||
ILineBreakpoint ltrpt = tracepoint;
|
||||
|
||||
int lNumber = 0;
|
||||
try {
|
||||
lNumber = ltrpt.getLineNumber();
|
||||
} catch (CoreException e) {
|
||||
GdbUIPlugin.log(e);
|
||||
}
|
||||
|
||||
if (lNumber > 0) {
|
||||
getPreferenceStore().setValue(TracepointPreferenceStore.LINE, lNumber);
|
||||
createLineNumberEditor(getFieldEditorParent());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private String getTracepointMainLabel(ICTracepoint tracepoint) {
|
||||
if (tracepoint instanceof ICFunctionBreakpoint)
|
||||
return Messages.TracepointPropertyPage_FunctionTracepoint;
|
||||
if (tracepoint instanceof ICAddressBreakpoint)
|
||||
return Messages.TracepointPropertyPage_AddressTracepoint;
|
||||
|
||||
return Messages.TracepointPropertyPage_LineTracepoint;
|
||||
}
|
||||
|
||||
protected void createLineNumberEditor(Composite parent) {
|
||||
String title = Messages.TracepointPropertyPage_LineNumber;
|
||||
TracepointIntegerFieldEditor labelFieldEditor = new TracepointIntegerFieldEditor(TracepointPreferenceStore.LINE ,title, parent);
|
||||
labelFieldEditor.setValidRange(1, Integer.MAX_VALUE);
|
||||
addField(labelFieldEditor);
|
||||
}
|
||||
|
||||
protected void createEnabledField(Composite parent) {
|
||||
fEnabled = new BooleanFieldEditor(TracepointPreferenceStore.ENABLED, Messages.TracepointPropertyPage_Enabled, parent);
|
||||
addField(fEnabled);
|
||||
}
|
||||
|
||||
protected void createConditionEditor( Composite parent ) {
|
||||
fCondition = new TracepointStringFieldEditor(TracepointPreferenceStore.CONDITION, Messages.TracepointPropertyPage_Condition, parent);
|
||||
fCondition.setEmptyStringAllowed(true);
|
||||
fCondition.setErrorMessage(Messages.TracepointPropertyPage_InvalidCondition);
|
||||
addField(fCondition);
|
||||
}
|
||||
|
||||
protected void createIgnoreCountEditor(Composite parent) {
|
||||
fIgnoreCount = new TracepointIntegerFieldEditor(TracepointPreferenceStore.IGNORE_COUNT, Messages.TracepointPropertyPage_IgnoreCount, parent);
|
||||
fIgnoreCount.setValidRange(0, Integer.MAX_VALUE);
|
||||
fIgnoreCountTextControl = fIgnoreCount.getTextControl(parent);
|
||||
try {
|
||||
fIgnoreCountTextControl.setEnabled(getTracepoint().getIgnoreCount() >= 0);
|
||||
}
|
||||
catch(CoreException ce) {
|
||||
GdbUIPlugin.log(ce);
|
||||
}
|
||||
addField(fIgnoreCount);
|
||||
}
|
||||
|
||||
protected void createPassCountEditor(Composite parent) {
|
||||
fPassCount = new TracepointIntegerFieldEditor(TracepointPreferenceStore.PASS_COUNT, Messages.TracepointPropertyPage_PassCount, parent);
|
||||
fPassCount.setValidRange(0, Integer.MAX_VALUE);
|
||||
fPassCountTextControl = fPassCount.getTextControl(parent);
|
||||
try {
|
||||
fPassCountTextControl.setEnabled(getTracepoint().getPassCount() >= 0);
|
||||
}
|
||||
catch(CoreException ce) {
|
||||
GdbUIPlugin.log(ce);
|
||||
}
|
||||
addField(fPassCount);
|
||||
}
|
||||
|
||||
protected FieldEditor createLabelEditor(Composite parent, String title, String value) {
|
||||
return new LabelFieldEditor(parent, title, value);
|
||||
}
|
||||
|
||||
protected ICTracepoint getTracepoint() {
|
||||
IAdaptable element = getElement();
|
||||
return (element instanceof ICTracepoint) ? (ICTracepoint)element : (ICTracepoint)element.getAdapter(ICTracepoint.class);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.ui.IWorkbenchPropertyPage#getElement()
|
||||
*/
|
||||
public IAdaptable getElement() {
|
||||
return fElement;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.ui.IWorkbenchPropertyPage#setElement(org.eclipse.core.runtime.IAdaptable)
|
||||
*/
|
||||
public void setElement(IAdaptable element) {
|
||||
fElement = element;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IPreferenceStore getPreferenceStore() {
|
||||
return fTracepointPreferenceStore;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean performOk() {
|
||||
final List<String> changedProperties = new ArrayList<String>(5);
|
||||
getPreferenceStore().addPropertyChangeListener( new IPropertyChangeListener() {
|
||||
|
||||
/**
|
||||
* @see IPropertyChangeListener#propertyChange(PropertyChangeEvent)
|
||||
*/
|
||||
public void propertyChange(PropertyChangeEvent event) {
|
||||
changedProperties.add(event.getProperty());
|
||||
}
|
||||
} );
|
||||
boolean result = super.performOk();
|
||||
setBreakpointProperties(changedProperties);
|
||||
return result;
|
||||
}
|
||||
|
||||
protected void setBreakpointProperties(final List<String> changedProperties) {
|
||||
IWorkspaceRunnable wr = new IWorkspaceRunnable() {
|
||||
|
||||
public void run( IProgressMonitor monitor ) throws CoreException {
|
||||
ICTracepoint tracepoint = getTracepoint();
|
||||
Iterator<String> changed = changedProperties.iterator();
|
||||
while(changed.hasNext()) {
|
||||
String property = changed.next();
|
||||
if (property.equals(TracepointPreferenceStore.ENABLED)) {
|
||||
tracepoint.setEnabled(getPreferenceStore().getBoolean(TracepointPreferenceStore.ENABLED));
|
||||
}
|
||||
else if (property.equals(TracepointPreferenceStore.IGNORE_COUNT)) {
|
||||
tracepoint.setIgnoreCount(getPreferenceStore().getInt(TracepointPreferenceStore.IGNORE_COUNT));
|
||||
}
|
||||
else if (property.equals(TracepointPreferenceStore.PASS_COUNT)) {
|
||||
tracepoint.setPassCount(getPreferenceStore().getInt(TracepointPreferenceStore.PASS_COUNT));
|
||||
}
|
||||
else if (property.equals(TracepointPreferenceStore.CONDITION)) {
|
||||
tracepoint.setCondition(getPreferenceStore().getString(TracepointPreferenceStore.CONDITION));
|
||||
}
|
||||
else if (property.equals(TracepointPreferenceStore.LINE)) {
|
||||
// already workspace runnable, setting markers are safe
|
||||
tracepoint.getMarker().setAttribute(IMarker.LINE_NUMBER, getPreferenceStore().getInt(TracepointPreferenceStore.LINE));
|
||||
} else {
|
||||
// this allow set attributes contributed by other plugins
|
||||
String value = getPropertyAsString(property);
|
||||
tracepoint.getMarker().setAttribute(property, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
try {
|
||||
ResourcesPlugin.getWorkspace().run(wr, null);
|
||||
}
|
||||
catch(CoreException ce) {
|
||||
GdbUIPlugin.log(ce);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return string value of given property or null.
|
||||
*/
|
||||
protected String getPropertyAsString(String property) {
|
||||
// currently only supports String and Integer
|
||||
IPreferenceStore store = getPreferenceStore();
|
||||
|
||||
if (store.contains(property)) {
|
||||
String value = store.getString(property);
|
||||
return value;
|
||||
} else return null;
|
||||
}
|
||||
}
|
|
@ -17,7 +17,25 @@ public class Messages extends NLS {
|
|||
|
||||
public static String ToggleBreakpointsTargetFactory_description;
|
||||
public static String ToggleBreakpointsTargetFactory_name;
|
||||
|
||||
public static String ToggleTracepointsTargetFactory_description;
|
||||
public static String ToggleTracepointsTargetFactory_name;
|
||||
public static String TracepointPropertyPage_integer_negative;
|
||||
public static String TracepointPropertyPage_NotAvailable;
|
||||
public static String TracepointPropertyPage_FunctionName;
|
||||
public static String TracepointPropertyPage_FunctionTracepoint;
|
||||
public static String TracepointPropertyPage_Address;
|
||||
public static String TracepointPropertyPage_AddressTracepoint;
|
||||
public static String TracepointPropertyPage_File;
|
||||
public static String TracepointPropertyPage_LineTracepoint;
|
||||
public static String TracepointPropertyPage_LineNumber;
|
||||
public static String TracepointPropertyPage_Project;
|
||||
public static String TracepointPropertyPage_Condition;
|
||||
public static String TracepointPropertyPage_InvalidCondition;
|
||||
public static String TracepointPropertyPage_IgnoreCount;
|
||||
public static String TracepointPropertyPage_PassCount;
|
||||
public static String TracepointPropertyPage_Class;
|
||||
public static String TracepointPropertyPage_Enabled;
|
||||
|
||||
static {
|
||||
// initialize resource bundle
|
||||
NLS.initializeMessages(BUNDLE_NAME, Messages.class);
|
||||
|
|
|
@ -41,12 +41,10 @@ public class ToggleBreakpointsTargetFactory implements IToggleBreakpointsTargetF
|
|||
* for the editor.
|
||||
*/
|
||||
public static final String TOGGLE_C_BREAKPOINT_TARGET_ID = CDebugUIPlugin.PLUGIN_ID + ".toggleCBreakpointTarget"; //$NON-NLS-1$
|
||||
// public static final String TOGGLE_C_TRACEPOINT_TARGET_ID = CDebugUIPlugin.PLUGIN_ID + ".toggleCTracepointTarget"; //$NON-NLS-1$
|
||||
|
||||
private static final Set<String> TOGGLE_TARGET_IDS = new HashSet<String>(2);
|
||||
private static final Set<String> TOGGLE_TARGET_IDS = new HashSet<String>(1);
|
||||
static {
|
||||
TOGGLE_TARGET_IDS.add(TOGGLE_C_BREAKPOINT_TARGET_ID);
|
||||
// TOGGLE_TARGET_IDS.add(TOGGLE_C_TRACEPOINT_TARGET_ID);
|
||||
}
|
||||
|
||||
private static final IToggleBreakpointsTarget fgDisassemblyToggleBreakpointsTarget = new DisassemblyToggleBreakpointsTarget();
|
||||
|
|
|
@ -0,0 +1,88 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2009 Ericsson, 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
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Ericsson - initial API and implementation
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.dsf.gdb.internal.ui.breakpoints;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import org.eclipse.cdt.debug.ui.CDebugUIPlugin;
|
||||
import org.eclipse.cdt.dsf.debug.internal.ui.disassembly.provisional.IDisassemblyPart;
|
||||
import org.eclipse.debug.ui.actions.IToggleBreakpointsTarget;
|
||||
import org.eclipse.debug.ui.actions.IToggleBreakpointsTargetFactory;
|
||||
import org.eclipse.jface.viewers.ISelection;
|
||||
import org.eclipse.ui.IWorkbenchPart;
|
||||
|
||||
/**
|
||||
* Toggle tracepoints target factory for disassembly parts.
|
||||
* We use a separate factory so that we can control it through an action set.
|
||||
*
|
||||
* @since 2.1
|
||||
*/
|
||||
public class ToggleTracepointsTargetFactory implements IToggleBreakpointsTargetFactory {
|
||||
|
||||
/**
|
||||
* Toggle tracepoint target-id for normal C tracepointspoints.
|
||||
* Note: The id must be the same as in <code>ToggleCBreakpointsTargetFactory</code>
|
||||
* which is used for the editor. We need the id to be the same so that when
|
||||
* the user goes from editor to DSF disassembly view, the choice of breakpoint
|
||||
* targets looks the same and is remembered.
|
||||
* To use the same id though, we must be careful not to have the two factories
|
||||
* return the same id for the same part, or else it may confuse things.
|
||||
* This is why this factory only returns this id for the DSF disassembly part,
|
||||
* leaving <code>ToggleCBreakpointsTargetFactory</code> to return the same id
|
||||
* for the editor.
|
||||
*/
|
||||
public static final String TOGGLE_C_TRACEPOINT_TARGET_ID = CDebugUIPlugin.PLUGIN_ID + ".toggleCTracepointTarget"; //$NON-NLS-1$
|
||||
|
||||
private static final Set<String> TOGGLE_TARGET_IDS_ALL = new HashSet<String>(1);
|
||||
static {
|
||||
TOGGLE_TARGET_IDS_ALL.add(TOGGLE_C_TRACEPOINT_TARGET_ID);
|
||||
}
|
||||
|
||||
private static final IToggleBreakpointsTarget fgDisassemblyToggleTracepointsTarget = new DisassemblyToggleTracepointsTarget();
|
||||
|
||||
public ToggleTracepointsTargetFactory() {
|
||||
}
|
||||
|
||||
public IToggleBreakpointsTarget createToggleTarget(String targetID) {
|
||||
if (TOGGLE_C_TRACEPOINT_TARGET_ID.equals(targetID)) {
|
||||
return fgDisassemblyToggleTracepointsTarget;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public String getDefaultToggleTarget(IWorkbenchPart part, ISelection selection) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public String getToggleTargetDescription(String targetID) {
|
||||
if (TOGGLE_C_TRACEPOINT_TARGET_ID.equals(targetID)) {
|
||||
return Messages.ToggleTracepointsTargetFactory_description;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public String getToggleTargetName(String targetID) {
|
||||
if (TOGGLE_C_TRACEPOINT_TARGET_ID.equals(targetID)) {
|
||||
return Messages.ToggleTracepointsTargetFactory_name;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public Set<String> getToggleTargets(IWorkbenchPart part, ISelection selection) {
|
||||
if (part instanceof IDisassemblyPart) {
|
||||
return TOGGLE_TARGET_IDS_ALL;
|
||||
}
|
||||
return Collections.emptySet();
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,47 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2009 Ericsson 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:
|
||||
* Ericsson - Initial API and implementation
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.dsf.gdb.internal.ui.breakpoints;
|
||||
|
||||
import org.eclipse.jface.preference.IPreferenceStore;
|
||||
import org.eclipse.jface.preference.PreferenceStore;
|
||||
|
||||
/**
|
||||
* A preference store that presents the state of the properties of a C/C++ Tracepoint.
|
||||
*/
|
||||
public class TracepointPreferenceStore extends PreferenceStore implements IPreferenceStore {
|
||||
|
||||
protected final static String ENABLED = "ENABLED"; //$NON-NLS-1$
|
||||
|
||||
protected final static String CONDITION = "CONDITION"; //$NON-NLS-1$
|
||||
|
||||
protected final static String IGNORE_COUNT = "IGNORE_COUNT"; //$NON-NLS-1$
|
||||
|
||||
protected final static String PASS_COUNT = "PASS_COUNT"; //$NON-NLS-1$
|
||||
|
||||
protected final static String LINE = "LINE"; //$NON-NLS-1$
|
||||
|
||||
/**
|
||||
* Constructor for TracepointPreferenceStore.
|
||||
*/
|
||||
public TracepointPreferenceStore() {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Override to not save.
|
||||
* This store used for temporary tracepoint setting in dialogs
|
||||
* and does not require permanent storage.
|
||||
*/
|
||||
@Override
|
||||
public boolean needsSaving() {
|
||||
return false;
|
||||
}
|
||||
}
|
|
@ -7,7 +7,27 @@
|
|||
#
|
||||
# Contributors:
|
||||
# Wind River Systems - initial API and implementation
|
||||
# Ericsson - added Tracepoint support
|
||||
###############################################################################
|
||||
|
||||
ToggleBreakpointsTargetFactory_description=Standard C/C++ Breakpoint Type
|
||||
ToggleBreakpointsTargetFactory_name=C/C++ Breakpoint
|
||||
ToggleBreakpointsTargetFactory_description=Standard C/C++ breakpoint type.
|
||||
ToggleBreakpointsTargetFactory_name=C/C++ Breakpoints
|
||||
ToggleTracepointsTargetFactory_description=Standard C/C++ tracepoint type.
|
||||
ToggleTracepointsTargetFactory_name=C/C++ Tracepoints
|
||||
|
||||
TracepointPropertyPage_integer_negative=Count must be a nonnegative integer
|
||||
TracepointPropertyPage_NotAvailable=Not available
|
||||
TracepointPropertyPage_FunctionName=Function name:
|
||||
TracepointPropertyPage_FunctionTracepoint=C/C++ function tracepoint
|
||||
TracepointPropertyPage_Address=Address:
|
||||
TracepointPropertyPage_AddressTracepoint=C/C++ address tracepoint
|
||||
TracepointPropertyPage_File=File:
|
||||
TracepointPropertyPage_LineTracepoint=C/C++ line tracepoint
|
||||
TracepointPropertyPage_LineNumber=Line number:
|
||||
TracepointPropertyPage_Project=Project:
|
||||
TracepointPropertyPage_Condition=&Condition:
|
||||
TracepointPropertyPage_InvalidCondition=Invalid condition.
|
||||
TracepointPropertyPage_IgnoreCount=&Ignore count:
|
||||
TracepointPropertyPage_PassCount=&Pass count:
|
||||
TracepointPropertyPage_Class=Class:
|
||||
TracepointPropertyPage_Enabled=Enabled
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -83,6 +83,9 @@ public class GdbDebugServicesFactory extends AbstractDsfDebugServicesFactory {
|
|||
|
||||
@Override
|
||||
protected IBreakpoints createBreakpointService(DsfSession session) {
|
||||
if (GDB_7_0_VERSION.compareTo(fVersion) <= 0) {
|
||||
return new GDBBreakpoints_7_0(session);
|
||||
}
|
||||
return new MIBreakpoints(session);
|
||||
}
|
||||
|
||||
|
|
|
@ -39,7 +39,8 @@ public class MIBreakpointDMData implements IBreakpointDMData {
|
|||
private final Map<String, Object> fProperties;
|
||||
|
||||
// Breakpoint types
|
||||
public static enum MIBreakpointNature { UNKNOWN, BREAKPOINT, WATCHPOINT, CATCHPOINT };
|
||||
public static enum MIBreakpointNature { UNKNOWN, BREAKPOINT, WATCHPOINT, CATCHPOINT,
|
||||
/** @since 2.1*/ TRACEPOINT };
|
||||
private final MIBreakpointNature fNature;
|
||||
|
||||
|
||||
|
@ -66,9 +67,15 @@ public class MIBreakpointDMData implements IBreakpointDMData {
|
|||
*/
|
||||
public MIBreakpointDMData(MIBreakpoint dsfMIBreakpoint) {
|
||||
|
||||
// We only support breakpoint and watchpoint (so far)
|
||||
// No support for catchpoints yet
|
||||
fBreakpoint = dsfMIBreakpoint;
|
||||
fNature = dsfMIBreakpoint.isWatchpoint() ? MIBreakpointNature.WATCHPOINT : MIBreakpointNature.BREAKPOINT;
|
||||
if (dsfMIBreakpoint.isTracepoint()) {
|
||||
fNature = MIBreakpointNature.TRACEPOINT;
|
||||
} else if (dsfMIBreakpoint.isWatchpoint()) {
|
||||
fNature = MIBreakpointNature.WATCHPOINT;
|
||||
} else {
|
||||
fNature = MIBreakpointNature.BREAKPOINT;
|
||||
}
|
||||
|
||||
fProperties = new HashMap<String,Object>();
|
||||
switch (fNature) {
|
||||
|
@ -109,7 +116,31 @@ public class MIBreakpointDMData implements IBreakpointDMData {
|
|||
fProperties.put(NUMBER, dsfMIBreakpoint.getNumber());
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
case TRACEPOINT:
|
||||
{
|
||||
// Generic breakpoint attributes
|
||||
fProperties.put(MIBreakpoints.BREAKPOINT_TYPE, MIBreakpoints.TRACEPOINT);
|
||||
fProperties.put(MIBreakpoints.FILE_NAME, dsfMIBreakpoint.getFile());
|
||||
fProperties.put(MIBreakpoints.LINE_NUMBER, dsfMIBreakpoint.getLine());
|
||||
fProperties.put(MIBreakpoints.FUNCTION, dsfMIBreakpoint.getFunction());
|
||||
fProperties.put(MIBreakpoints.ADDRESS, dsfMIBreakpoint.getAddress());
|
||||
fProperties.put(MIBreakpoints.CONDITION, dsfMIBreakpoint.getCondition());
|
||||
fProperties.put(MIBreakpoints.IGNORE_COUNT, dsfMIBreakpoint.getPassCount());
|
||||
fProperties.put(MIBreakpoints.IS_ENABLED, new Boolean(dsfMIBreakpoint.isEnabled()));
|
||||
|
||||
// MI-specific breakpoint attributes
|
||||
fProperties.put(NUMBER, dsfMIBreakpoint.getNumber());
|
||||
fProperties.put(TYPE, dsfMIBreakpoint.getType());
|
||||
fProperties.put(THREAD_ID, dsfMIBreakpoint.getThreadId());
|
||||
fProperties.put(FULL_NAME, dsfMIBreakpoint.getFullName());
|
||||
fProperties.put(HITS, dsfMIBreakpoint.getTimes());
|
||||
fProperties.put(IS_TEMPORARY, new Boolean(dsfMIBreakpoint.isTemporary()));
|
||||
fProperties.put(IS_HARDWARE, new Boolean(dsfMIBreakpoint.isHardware()));
|
||||
fProperties.put(LOCATION, formatLocation());
|
||||
break;
|
||||
}
|
||||
|
||||
// Not reachable
|
||||
default:
|
||||
{
|
||||
|
@ -201,6 +232,20 @@ public class MIBreakpointDMData implements IBreakpointDMData {
|
|||
return fBreakpoint.isEnabled();
|
||||
}
|
||||
|
||||
/**
|
||||
* @since 2.1
|
||||
*/
|
||||
public int getPassCount() {
|
||||
return fBreakpoint.getPassCount();
|
||||
}
|
||||
|
||||
/**
|
||||
* @since 2.1
|
||||
*/
|
||||
public String getCommands() {
|
||||
return fBreakpoint.getCommands();
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// MIBreakpointDMData
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
@ -251,6 +296,14 @@ public class MIBreakpointDMData implements IBreakpointDMData {
|
|||
fBreakpoint.setEnabled(isEnabled);
|
||||
fProperties.put(MIBreakpoints.IS_ENABLED, isEnabled);
|
||||
}
|
||||
|
||||
/**
|
||||
* @since 2.1
|
||||
*/
|
||||
public void setPassCount(int count) {
|
||||
fBreakpoint.setPassCount(count);
|
||||
fProperties.put(MIBreakpoints.IGNORE_COUNT, count);
|
||||
}
|
||||
|
||||
public boolean isReadWatchpoint() {
|
||||
return fBreakpoint.isReadWatchpoint();
|
||||
|
|
|
@ -66,6 +66,8 @@ public class MIBreakpoints extends AbstractDsfService implements IBreakpoints
|
|||
public static final String BREAKPOINT = "breakpoint"; //$NON-NLS-1$
|
||||
public static final String WATCHPOINT = "watchpoint"; //$NON-NLS-1$
|
||||
public static final String CATCHPOINT = "catchpoint"; //$NON-NLS-1$
|
||||
/** @since 2.1 */
|
||||
public static final String TRACEPOINT = "tracepoint"; //$NON-NLS-1$
|
||||
|
||||
// Basic set of breakpoint attribute markers
|
||||
public static final String FILE_NAME = PREFIX + ".fileName"; //$NON-NLS-1$
|
||||
|
@ -74,7 +76,11 @@ public class MIBreakpoints extends AbstractDsfService implements IBreakpoints
|
|||
public static final String ADDRESS = PREFIX + ".address"; //$NON-NLS-1$
|
||||
public static final String CONDITION = PREFIX + ".condition"; //$NON-NLS-1$
|
||||
public static final String IGNORE_COUNT = PREFIX + ".ignoreCount"; //$NON-NLS-1$
|
||||
/** @since 2.1 */
|
||||
public static final String PASS_COUNT = PREFIX + ".passCount"; //$NON-NLS-1$
|
||||
public static final String IS_ENABLED = PREFIX + ".isEnabled"; //$NON-NLS-1$
|
||||
/** @since 2.1 */
|
||||
public static final String COMMANDS = PREFIX + ".commands"; //$NON-NLS-1$
|
||||
|
||||
// Basic set of watchpoint attribute markers
|
||||
public static final String EXPRESSION = PREFIX + ".expression"; //$NON-NLS-1$
|
||||
|
|
|
@ -31,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.ICBreakpointExtension;
|
||||
import org.eclipse.cdt.debug.core.model.ICLineBreakpoint;
|
||||
import org.eclipse.cdt.debug.core.model.ICTracepoint;
|
||||
import org.eclipse.cdt.debug.core.model.ICWatchpoint;
|
||||
import org.eclipse.cdt.debug.internal.core.breakpoints.BreakpointProblems;
|
||||
import org.eclipse.cdt.dsf.concurrent.CountingRequestMonitor;
|
||||
|
@ -416,7 +417,9 @@ public class MIBreakpointsManager extends AbstractDsfService implements IBreakpo
|
|||
@Override
|
||||
protected void handleSuccess() {
|
||||
// Install only if the breakpoint is enabled at startup (Bug261082)
|
||||
boolean bpEnabled = attributes.get(ICBreakpoint.ENABLED).equals(true) && fBreakpointManager.isEnabled();
|
||||
// Note that Tracepoints are not affected by "skip-all"
|
||||
boolean bpEnabled = attributes.get(ICBreakpoint.ENABLED).equals(true) &&
|
||||
(breakpoint instanceof ICTracepoint || fBreakpointManager.isEnabled());
|
||||
if (bpEnabled)
|
||||
installBreakpoint(dmc, breakpoint, attributes, countingRm);
|
||||
else
|
||||
|
@ -784,7 +787,9 @@ public class MIBreakpointsManager extends AbstractDsfService implements IBreakpo
|
|||
// some attribute might have changed which will make the install succeed.
|
||||
if (!breakpointIDs.containsKey(breakpoint) && !targetBPs.containsValue(breakpoint)) {
|
||||
// Install only if the breakpoint is enabled
|
||||
boolean bpEnabled = attributes.get(ICBreakpoint.ENABLED).equals(true) && fBreakpointManager.isEnabled();
|
||||
// Note that Tracepoints are not affected by "skip-all"
|
||||
boolean bpEnabled = attributes.get(ICBreakpoint.ENABLED).equals(true) &&
|
||||
(breakpoint instanceof ICTracepoint || fBreakpointManager.isEnabled());
|
||||
if (bpEnabled) {
|
||||
attributes.put(ATTR_DEBUGGER_PATH, NULL_STRING);
|
||||
attributes.put(ATTR_THREAD_FILTER, extractThreads(dmc, breakpoint));
|
||||
|
@ -967,7 +972,8 @@ public class MIBreakpointsManager extends AbstractDsfService implements IBreakpo
|
|||
// Convert the breakpoint attributes for the back-end
|
||||
// Refresh the set of attributes at each iteration just in case...
|
||||
Map<String,Object> attrs = convertToTargetBreakpoint(breakpoint, attributes);
|
||||
if (!fBreakpointManager.isEnabled()) {
|
||||
// Tracepoints are not affected by "skip-all"
|
||||
if (!(breakpoint instanceof ICTracepoint) && !fBreakpointManager.isEnabled()) {
|
||||
attrs.put(MIBreakpoints.IS_ENABLED, false);
|
||||
}
|
||||
// Add the secret ingredient..
|
||||
|
@ -1010,7 +1016,8 @@ public class MIBreakpointsManager extends AbstractDsfService implements IBreakpo
|
|||
for (IBreakpointsTargetDMContext context : fBreakpointIDs.keySet()) {
|
||||
for (ICBreakpoint breakpoint : fBreakpointIDs.get(context).keySet()) {
|
||||
try {
|
||||
if (breakpoint.isEnabled()) {
|
||||
// Note that Tracepoints are not affected by "skip-all"
|
||||
if (!(breakpoint instanceof ICTracepoint) && breakpoint.isEnabled()) {
|
||||
for (IBreakpointDMContext ref : fBreakpointIDs.get(context).get(breakpoint)) {
|
||||
Map<String,Object> delta = new HashMap<String,Object>();
|
||||
delta.put(MIBreakpoints.IS_ENABLED, enabled);
|
||||
|
@ -1090,7 +1097,8 @@ public class MIBreakpointsManager extends AbstractDsfService implements IBreakpo
|
|||
// Retrieve the breakpoint attributes
|
||||
@SuppressWarnings("unchecked")
|
||||
final Map<String, Object> attrs = breakpoint.getMarker().getAttributes();
|
||||
if (!fBreakpointManager.isEnabled()) {
|
||||
// Tracepoints are not affected by "skip-all"
|
||||
if (!(breakpoint instanceof ICTracepoint) && !fBreakpointManager.isEnabled()) {
|
||||
attrs.put(ICBreakpoint.ENABLED, false);
|
||||
}
|
||||
|
||||
|
@ -1136,7 +1144,7 @@ public class MIBreakpointsManager extends AbstractDsfService implements IBreakpo
|
|||
new RequestMonitor(getExecutor(), countingRm) {
|
||||
@Override
|
||||
protected void handleSuccess() {
|
||||
modifyBreakpoint(dmc, (ICBreakpoint) breakpoint, attrs, delta, new RequestMonitor(getExecutor(), countingRm));
|
||||
modifyBreakpoint(dmc, (ICBreakpoint) breakpoint, attrs, delta, countingRm);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -1499,6 +1507,9 @@ public class MIBreakpointsManager extends AbstractDsfService implements IBreakpo
|
|||
if (cdt_attributes.containsKey(IMarker.LINE_NUMBER))
|
||||
result.put(MIBreakpoints.LINE_NUMBER, cdt_attributes.get(IMarker.LINE_NUMBER));
|
||||
|
||||
if (cdt_attributes.containsKey(BreakpointActionManager.BREAKPOINT_ACTION_ATTRIBUTE))
|
||||
result.put(MIBreakpoints.COMMANDS, cdt_attributes.get(BreakpointActionManager.BREAKPOINT_ACTION_ATTRIBUTE));
|
||||
|
||||
// ICLineBreakpoint attributes
|
||||
if (cdt_attributes.containsKey(ICLineBreakpoint.FUNCTION))
|
||||
result.put(MIBreakpoints.FUNCTION, cdt_attributes.get(ICLineBreakpoint.FUNCTION));
|
||||
|
@ -1513,6 +1524,9 @@ public class MIBreakpointsManager extends AbstractDsfService implements IBreakpo
|
|||
if (cdt_attributes.containsKey(ICBreakpoint.IGNORE_COUNT))
|
||||
result.put(MIBreakpoints.IGNORE_COUNT, cdt_attributes.get(ICBreakpoint.IGNORE_COUNT));
|
||||
|
||||
if (cdt_attributes.containsKey(ICTracepoint.PASS_COUNT))
|
||||
result.put(MIBreakpoints.PASS_COUNT, cdt_attributes.get(ICTracepoint.PASS_COUNT));
|
||||
|
||||
if (cdt_attributes.containsKey(ICBreakpoint.ENABLED))
|
||||
result.put(MIBreakpoints.IS_ENABLED, cdt_attributes.get(ICBreakpoint.ENABLED));
|
||||
|
||||
|
@ -1633,6 +1647,12 @@ public class MIBreakpointsManager extends AbstractDsfService implements IBreakpo
|
|||
properties.put(MIBreakpoints.LINE_NUMBER, attributes.get(IMarker.LINE_NUMBER));
|
||||
properties.put(MIBreakpoints.FUNCTION, attributes.get(ICLineBreakpoint.FUNCTION));
|
||||
properties.put(MIBreakpoints.ADDRESS, attributes.get(ICLineBreakpoint.ADDRESS));
|
||||
|
||||
if (breakpoint instanceof ICTracepoint) {
|
||||
// A tracepoint is a LineBreakpoint, but needs its own type
|
||||
properties.put(MIBreakpoints.BREAKPOINT_TYPE, MIBreakpoints.TRACEPOINT);
|
||||
properties.put(MIBreakpoints.PASS_COUNT, attributes.get(ICTracepoint.PASS_COUNT));
|
||||
}
|
||||
} else {
|
||||
// catchpoint?
|
||||
}
|
||||
|
@ -1644,7 +1664,8 @@ public class MIBreakpointsManager extends AbstractDsfService implements IBreakpo
|
|||
properties.put(MIBreakpointDMData.THREAD_ID, attributes.get(ATTR_THREAD_ID));
|
||||
|
||||
// Adjust for "skip-all"
|
||||
if (!fBreakpointManager.isEnabled()) {
|
||||
// Tracepoints are not affected by "skip-all"
|
||||
if (!(breakpoint instanceof ICTracepoint ) && !fBreakpointManager.isEnabled()) {
|
||||
properties.put(MIBreakpoints.IS_ENABLED, false);
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,30 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2009 Ericsson 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:
|
||||
* Ericsson - Initial API and implementation
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.dsf.mi.service.command.commands;
|
||||
|
||||
import org.eclipse.cdt.dsf.debug.service.IBreakpoints.IBreakpointsTargetDMContext;
|
||||
import org.eclipse.cdt.dsf.mi.service.command.output.MIInfo;
|
||||
|
||||
/**
|
||||
* Set the passcount of a tracepoint. The passcount is a way to automatically stop a trace experiment.
|
||||
* If a tracepoint's passcount is N, then the trace experiment will be automatically stopped on the N'th
|
||||
* time that tracepoint is hit. If no passcount is given, the trace experiment will run until stopped
|
||||
* explicitly by the user.
|
||||
|
||||
* @since 2.1
|
||||
*/
|
||||
public class CLIPasscount extends CLICommand<MIInfo> {
|
||||
public CLIPasscount(IBreakpointsTargetDMContext ctx, int breakpoint, int passcount) {
|
||||
super(ctx, "passcount"); //$NON-NLS-1$
|
||||
setParameters(new String[] { Integer.toString(passcount), Integer.toString(breakpoint) });
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,49 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2009 Ericsson 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:
|
||||
* Ericsson - Initial API and implementation
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.dsf.mi.service.command.commands;
|
||||
|
||||
import org.eclipse.cdt.dsf.debug.service.IBreakpoints.IBreakpointsTargetDMContext;
|
||||
import org.eclipse.cdt.dsf.mi.service.command.output.CLITraceInfo;
|
||||
import org.eclipse.cdt.dsf.mi.service.command.output.MIInfo;
|
||||
import org.eclipse.cdt.dsf.mi.service.command.output.MIOutput;
|
||||
|
||||
/**
|
||||
* This command creates a tracepoint.
|
||||
* @since 2.1
|
||||
*/
|
||||
public class CLITrace extends CLICommand<CLITraceInfo> {
|
||||
public CLITrace(IBreakpointsTargetDMContext ctx, String location) {
|
||||
this(ctx, location, null);
|
||||
}
|
||||
|
||||
// In this particular case, because of a GDB peculiarity, setParameters() is
|
||||
// not used and the whole command is formatted on the parent's constructor.
|
||||
// See bug 213076 for more information.
|
||||
public CLITrace(IBreakpointsTargetDMContext ctx, String location, String condition) {
|
||||
super(ctx, "trace " + location + //$NON-NLS-1$
|
||||
((condition != null && condition.trim().length() > 0) ? " if " + condition : "")); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public CLITraceInfo getResult(MIOutput output) {
|
||||
return (CLITraceInfo)getMIInfo(output);
|
||||
}
|
||||
|
||||
public MIInfo getMIInfo(MIOutput out) {
|
||||
MIInfo info = null;
|
||||
if (out != null) {
|
||||
info = new CLITraceInfo(out);
|
||||
}
|
||||
return info;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2000, 2008 QNX Software Systems and others.
|
||||
* Copyright (c) 2009 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
|
||||
|
@ -9,6 +9,7 @@
|
|||
* QNX Software Systems - Initial API and implementation
|
||||
* Wind River Systems - Modified for new DSF Reference Implementation
|
||||
* Ericsson - Modified for bug 219920
|
||||
* Ericsson - Modified for tracepoints (284286)
|
||||
*******************************************************************************/
|
||||
|
||||
package org.eclipse.cdt.dsf.mi.service.command.commands;
|
||||
|
@ -18,11 +19,11 @@ import org.eclipse.cdt.dsf.mi.service.command.output.MIBreakInsertInfo;
|
|||
import org.eclipse.cdt.dsf.mi.service.command.output.MIOutput;
|
||||
|
||||
/**
|
||||
* -break-insert [ -t ] [ -h ] [ -r ]
|
||||
* -break-insert [ -t ] [ -h ] [ -f ] [ -d ] [ -a ]
|
||||
* [ -c CONDITION ] [ -i IGNORE-COUNT ]
|
||||
* [ -p THREAD ] [ LINE | ADDR ]
|
||||
* [ -p THREAD ] [ LOCATION ]
|
||||
*
|
||||
* If specified, LINE, can be one of:
|
||||
* If specified, LOCATION, can be one of:
|
||||
* * function
|
||||
* * filename:linenum
|
||||
* * filename:function
|
||||
|
@ -35,20 +36,31 @@ import org.eclipse.cdt.dsf.mi.service.command.output.MIOutput;
|
|||
*
|
||||
* '-h'
|
||||
* Insert a hardware breakpoint.
|
||||
*
|
||||
* '-r'
|
||||
* Insert a regular breakpoint in all the functions whose names match
|
||||
* the given regular expression. Other flags are not applicable to
|
||||
* regular expression.
|
||||
* When inserting a tracepoint (-a), this option indicates a fast tracepoint
|
||||
*
|
||||
* '-c CONDITION'
|
||||
* Make the breakpoint conditional on CONDITION.
|
||||
* Make the breakpoint conditional on CONDITION.
|
||||
*
|
||||
* '-i IGNORE-COUNT'
|
||||
* Initialize the IGNORE-COUNT (number of breakpoint hits before breaking).
|
||||
* Initialize the IGNORE-COUNT (number of breakpoint hits before breaking).
|
||||
*
|
||||
* '-f'
|
||||
* If location cannot be parsed (for example if it refers to unknown files or
|
||||
* functions), create a pending breakpoint. Without this flag, if a location
|
||||
* cannot be parsed, the breakpoint will not be created and an error will be
|
||||
* reported.
|
||||
* Only available starting GDB 6.8
|
||||
*
|
||||
* '-d'
|
||||
* Create a disabled breakpoint.
|
||||
* Only available starting GDB 7.0
|
||||
*
|
||||
* '-a'
|
||||
* Insert a tracepoint instead of a breakpoint
|
||||
* Only available starting GDB 7.1
|
||||
*
|
||||
* '-p THREAD'
|
||||
* THREAD on which to apply the breakpoint
|
||||
* THREAD on which to apply the breakpoint
|
||||
*/
|
||||
public class MIBreakInsert extends MICommand<MIBreakInsertInfo>
|
||||
{
|
||||
|
@ -58,8 +70,30 @@ public class MIBreakInsert extends MICommand<MIBreakInsertInfo>
|
|||
|
||||
public MIBreakInsert(IBreakpointsTargetDMContext ctx, boolean isTemporary, boolean isHardware,
|
||||
String condition, int ignoreCount, String line, int tid) {
|
||||
this(ctx, isTemporary, isHardware, condition, ignoreCount, line, tid, false, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* This constructor allows to specify if the breakpoint should actually be
|
||||
* a tracepoint (this will only work starting with GDB 7.1)
|
||||
* It also includes if a breakpoint should be created disabled (starting GDB 7.0)
|
||||
* @since 2.1
|
||||
*/
|
||||
public MIBreakInsert(IBreakpointsTargetDMContext ctx, boolean isTemporary, boolean isHardware,
|
||||
String condition, int ignoreCount, String line, int tid, boolean disabled, boolean isTracepoint) {
|
||||
super(ctx, "-break-insert"); //$NON-NLS-1$
|
||||
|
||||
// For a tracepoint, force certain parameters to what is allowed
|
||||
if (isTracepoint) {
|
||||
// A tracepoint cannot be temporary
|
||||
isTemporary = false;
|
||||
// GDB 7.1 does not support ignore-counts for tracepoints
|
||||
// and passcounts cannot be set by a -break-insert
|
||||
ignoreCount = 0;
|
||||
// GDB 7.1 only supports tracepoints that apply to all threads
|
||||
tid = 0;
|
||||
}
|
||||
|
||||
// Determine the number of optional parameters that are present
|
||||
// and allocate a corresponding string array
|
||||
int i = 0;
|
||||
|
@ -78,6 +112,12 @@ public class MIBreakInsert extends MICommand<MIBreakInsertInfo>
|
|||
if (tid > 0) {
|
||||
i += 2;
|
||||
}
|
||||
if (disabled) {
|
||||
i++;
|
||||
}
|
||||
if (isTracepoint) {
|
||||
i ++;
|
||||
}
|
||||
String[] opts = new String[i];
|
||||
|
||||
// Fill in the optional parameters
|
||||
|
@ -87,6 +127,7 @@ public class MIBreakInsert extends MICommand<MIBreakInsertInfo>
|
|||
i++;
|
||||
}
|
||||
if (isHardware) {
|
||||
// For tracepoints, this will request a fast tracepoint
|
||||
opts[i] = "-h"; //$NON-NLS-1$
|
||||
i++;
|
||||
}
|
||||
|
@ -107,6 +148,14 @@ public class MIBreakInsert extends MICommand<MIBreakInsertInfo>
|
|||
i++;
|
||||
opts[i] = Integer.toString(tid);
|
||||
}
|
||||
if (disabled) {
|
||||
opts[i] = "-d"; //$NON-NLS-1$
|
||||
i ++;
|
||||
}
|
||||
if (isTracepoint) {
|
||||
opts[i] = "-a"; //$NON-NLS-1$
|
||||
i ++;
|
||||
}
|
||||
|
||||
if (opts.length > 0) {
|
||||
setOptions(opts);
|
||||
|
|
|
@ -0,0 +1,35 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2009 Ericsson 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:
|
||||
* Ericsson - Initial API and implementation
|
||||
*******************************************************************************/
|
||||
|
||||
package org.eclipse.cdt.dsf.mi.service.command.commands;
|
||||
|
||||
import org.eclipse.cdt.dsf.debug.service.IBreakpoints.IBreakpointsTargetDMContext;
|
||||
import org.eclipse.cdt.dsf.mi.service.command.output.MIInfo;
|
||||
|
||||
/**
|
||||
*
|
||||
* -break-passcount TRACEPOINT-NUMBER PASSCOUNT
|
||||
*
|
||||
* Set the passcount for tracepoint TRACEPOINT_NUMBER to PASSCOUNT. If the breakpoint
|
||||
* referred to by TRACEPOINT_NUMBER is not a tracepoint, an error is emitted. This
|
||||
* corresponds to the CLI command 'passcount'.
|
||||
*
|
||||
* Available starting with GDB 7.1
|
||||
*
|
||||
* @since 2.1
|
||||
*/
|
||||
|
||||
public class MIBreakPasscount extends MICommand<MIInfo>
|
||||
{
|
||||
public MIBreakPasscount(IBreakpointsTargetDMContext ctx, int tracepoint, int passCount) {
|
||||
super(ctx, "-break-passcount", null, new String[] { Integer.toString(tracepoint), Integer.toString(passCount) }); //$NON-NLS-1$
|
||||
}
|
||||
}
|
|
@ -0,0 +1,62 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2009 Ericsson 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:
|
||||
* Ericsson - Initial API and implementation
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.dsf.mi.service.command.output;
|
||||
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
|
||||
/**
|
||||
* GDB/MI trace command output parsing.
|
||||
*
|
||||
* ~"Tracepoint 2 at 0x4035a9: file /scratch/marc/test/src/main.cxx, line 109"
|
||||
*
|
||||
* @since 2.1
|
||||
*/
|
||||
public class CLITraceInfo extends MIInfo {
|
||||
|
||||
public CLITraceInfo(MIOutput out) {
|
||||
super(out);
|
||||
parse();
|
||||
}
|
||||
|
||||
Integer fReference = null;
|
||||
|
||||
public Integer getTraceReference(){
|
||||
return fReference;
|
||||
}
|
||||
|
||||
protected void parse() {
|
||||
if (isDone()) {
|
||||
MIOutput out = getMIOutput();
|
||||
MIOOBRecord[] oobs = out.getMIOOBRecords();
|
||||
for (int i = 0; i < oobs.length; i++) {
|
||||
if (oobs[i] instanceof MIConsoleStreamOutput) {
|
||||
MIStreamRecord cons = (MIStreamRecord) oobs[i];
|
||||
String str = cons.getString();
|
||||
str.trim();
|
||||
if(str.length() > 0 ){
|
||||
Pattern pattern = Pattern.compile("^Tracepoint\\s(\\d+)", Pattern.MULTILINE); //$NON-NLS-1$
|
||||
Matcher matcher = pattern.matcher(str);
|
||||
if (matcher.find()) {
|
||||
String id = matcher.group(1);
|
||||
try {
|
||||
fReference = Integer.parseInt(id);
|
||||
} catch (NumberFormatException e) {
|
||||
fReference = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2000, 2006 QNX Software Systems and others.
|
||||
* Copyright (c) 2009 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
|
||||
|
@ -9,6 +9,7 @@
|
|||
* QNX Software Systems - Initial API and implementation
|
||||
* Wind River Systems - Modified for new DSF Reference Implementation
|
||||
* Ericsson - Modified for the breakpoint service
|
||||
* Ericsson - Added Tracepoint support (284286)
|
||||
*******************************************************************************/
|
||||
|
||||
package org.eclipse.cdt.dsf.mi.service.command.output;
|
||||
|
@ -41,7 +42,12 @@ package org.eclipse.cdt.dsf.mi.service.command.output;
|
|||
* -break-watch p
|
||||
* ^done,wpt={number="6",exp="p"}
|
||||
* (gdb)
|
||||
*/
|
||||
*
|
||||
* Tracepoints:
|
||||
* bkpt={number="5",type="tracepoint",disp="keep",enabled="y",addr="0x0804846b",func="main",file="hello.c",line="4",thread="0",thread="0",times="0"}
|
||||
* bkpt={number="1",type="tracepoint",disp="keep",enabled="y",addr="0x0041bca0",func="main",file="hello.c",line="4",times="0",pass="4",original-location="hello.c:4"},
|
||||
* bkpt={number="5",type="fast tracepoint",disp="keep",enabled="y",addr="0x0804852d",func="testTracepoints()",file="TracepointTestApp.cc",fullname="/local/src/TracepointTestApp.cc",line="84",times="0",original-location="TracepointTestApp.cc:84"}
|
||||
* */
|
||||
public class MIBreakpoint {
|
||||
|
||||
int number = -1;
|
||||
|
@ -58,6 +64,10 @@ public class MIBreakpoint {
|
|||
String exp = ""; //$NON-NLS-1$
|
||||
String threadId = "0"; //$NON-NLS-1$
|
||||
int ignore = 0;
|
||||
String commands = ""; //$NON-NLS-1$
|
||||
|
||||
// For tracepoints
|
||||
int passcount = 0;
|
||||
|
||||
boolean isWpt = false;
|
||||
boolean isAWpt = false;
|
||||
|
@ -65,6 +75,10 @@ public class MIBreakpoint {
|
|||
boolean isWWpt = false;
|
||||
boolean isHdw = false;
|
||||
|
||||
// Indicate if we are dealing with a tracepoint.
|
||||
// (if its a fast or slow tracepoint can be known through the 'type' field)
|
||||
boolean isTpt = false;
|
||||
|
||||
public MIBreakpoint() {
|
||||
}
|
||||
|
||||
|
@ -73,7 +87,6 @@ public class MIBreakpoint {
|
|||
type = new String(other.type);
|
||||
disp = new String(other.disp);
|
||||
enabled = other.enabled;
|
||||
type = new String(other.type);
|
||||
address = new String(other.address);
|
||||
func = new String(other.func);
|
||||
fullName = new String(other.fullName);
|
||||
|
@ -84,11 +97,14 @@ public class MIBreakpoint {
|
|||
exp = new String(other.exp);
|
||||
threadId = new String(other.threadId);
|
||||
ignore = other.ignore;
|
||||
commands = other.commands;
|
||||
passcount= other.passcount;
|
||||
isWpt = other.isWpt;
|
||||
isAWpt = other.isAWpt;
|
||||
isRWpt = other.isRWpt;
|
||||
isWWpt = other.isWWpt;
|
||||
isHdw = other.isHdw;
|
||||
isTpt = other.isTpt;
|
||||
}
|
||||
|
||||
public MIBreakpoint(MITuple tuple) {
|
||||
|
@ -171,6 +187,11 @@ public class MIBreakpoint {
|
|||
return getDisposition().equals("del"); //$NON-NLS-1$
|
||||
}
|
||||
|
||||
/**
|
||||
* Will return true if we are dealing with a hardware breakpoint.
|
||||
* Note that this method will return false for tracepoint, even
|
||||
* if it is a fast tracepoint.
|
||||
*/
|
||||
public boolean isHardware() {
|
||||
return isHdw;
|
||||
}
|
||||
|
@ -215,6 +236,56 @@ public class MIBreakpoint {
|
|||
isWWpt = b;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return whether this breakpoint is actually a tracepoint.
|
||||
* This method will return true for both fast and slow tracepoints.
|
||||
* To know of fast vs slow tracepoint use {@link getType()} and look
|
||||
* for "tracepoint" or "fast tracepoint"
|
||||
*
|
||||
* @since 2.1
|
||||
*/
|
||||
public boolean isTracepoint() {
|
||||
return isTpt;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the passcount of a tracepoint. Will return 0 if this
|
||||
* breakpoint is not a tracepoint.
|
||||
*
|
||||
* @since 2.1
|
||||
*/
|
||||
public int getPassCount() {
|
||||
return passcount;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the passcount of a tracepoint. Will not do anything if
|
||||
* this breakpoint is not a tracepoint.
|
||||
* @since 2.1
|
||||
*/
|
||||
public void setPassCount(int count) {
|
||||
if (isTpt == false) return;
|
||||
passcount = count;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the commands associated with this breakpoint (or tracepoint)
|
||||
*
|
||||
* @since 2.1
|
||||
*/
|
||||
public String getCommands() {
|
||||
return commands;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the commands associated with this breakpoint (or tracepoint)
|
||||
*
|
||||
* @since 2.1
|
||||
*/
|
||||
public void setCommands(String cmds) {
|
||||
commands = cmds;
|
||||
}
|
||||
|
||||
// Parse the result string
|
||||
void parse(MITuple tuple) {
|
||||
MIResult[] results = tuple.getMIResults();
|
||||
|
@ -249,6 +320,10 @@ public class MIBreakpoint {
|
|||
isRWpt = true;
|
||||
isWpt = true;
|
||||
}
|
||||
if (type.startsWith("tracepoint") || //$NON-NLS-1$
|
||||
type.startsWith("fast tracepoint")) { //$NON-NLS-1$
|
||||
isTpt = true;
|
||||
}
|
||||
// type="breakpoint"
|
||||
// default ok.
|
||||
} else if (var.equals("disp")) { //$NON-NLS-1$
|
||||
|
@ -285,6 +360,11 @@ public class MIBreakpoint {
|
|||
ignore = Integer.parseInt(str.trim());
|
||||
} catch (NumberFormatException e) {
|
||||
}
|
||||
} else if (var.equals("pass")) { //$NON-NLS-1$
|
||||
try {
|
||||
passcount = Integer.parseInt(str.trim());
|
||||
} catch (NumberFormatException e) {
|
||||
}
|
||||
} else if (var.equals("cond")) { //$NON-NLS-1$
|
||||
cond = str;
|
||||
}
|
||||
|
|
|
@ -3,4 +3,5 @@ SpecialTestApp.exe
|
|||
GDBMIGenericTestApp.exe
|
||||
MemoryTestApp.exe
|
||||
ExpressionTestApp.exe
|
||||
MultiThread.exe
|
||||
MultiThread.exe
|
||||
TracepointTestApp.exe
|
|
@ -0,0 +1,96 @@
|
|||
#include <stdio.h>
|
||||
|
||||
int gIntVar = 543;
|
||||
double gDoubleVar = 543.543;
|
||||
char gCharVar = 'g';
|
||||
bool gBoolVar = false;
|
||||
|
||||
int gIntArray[2] = {987, 654};
|
||||
double gDoubleArray[2] = {987.654, 654.321};
|
||||
char gCharArray[2] = {'g', 'd'};
|
||||
bool gBoolArray[2] = {true, false};
|
||||
|
||||
int *gIntPtr = &gIntVar;
|
||||
double *gDoublePtr = &gDoubleVar;
|
||||
char *gCharPtr = &gCharVar;
|
||||
bool *gBoolPtr = &gBoolVar;
|
||||
|
||||
int *gIntPtr2 = (int*)0x8;
|
||||
double *gDoublePtr2 = (double*)0x5432;
|
||||
char *gCharPtr2 = (char*)0x4321;
|
||||
bool *gBoolPtr2 = (bool*)0x12ABCDEF;
|
||||
|
||||
class bar {
|
||||
public:
|
||||
int d;
|
||||
private:
|
||||
int e[2];
|
||||
};
|
||||
|
||||
class bar2 {
|
||||
public:
|
||||
int f;
|
||||
private:
|
||||
int g[2];
|
||||
};
|
||||
|
||||
class foo: public bar, bar2 {
|
||||
public:
|
||||
int a[2];
|
||||
bar b;
|
||||
private:
|
||||
int c;
|
||||
};
|
||||
|
||||
struct Z {
|
||||
public:
|
||||
int x;
|
||||
int y;
|
||||
};
|
||||
struct childStruct {
|
||||
public:
|
||||
Z z;
|
||||
};
|
||||
|
||||
void testTracepoints() {
|
||||
printf("Running TracepointTest App\n");
|
||||
|
||||
int lIntVar = 12345;
|
||||
double lDoubleVar = 12345.12345;
|
||||
char lCharVar = 'm';
|
||||
bool lBoolVar = false;
|
||||
|
||||
int lIntArray[2] = {6789, 12345};
|
||||
double lDoubleArray[2] = {456.789, 12345.12345};
|
||||
char lCharArray[2] = {'i', 'm'};
|
||||
bool lBoolArray[2] = {true, false};
|
||||
|
||||
int *lIntPtr = &lIntVar;
|
||||
double *lDoublePtr = &lDoubleVar;
|
||||
char *lCharPtr = &lCharVar;
|
||||
bool *lBoolPtr = &gBoolVar;
|
||||
|
||||
int *lIntPtr2 = (int*)0x1;
|
||||
double *lDoublePtr2 = (double*)0x2345;
|
||||
char *lCharPtr2 = (char*)0x1234;
|
||||
bool *lBoolPtr2 = (bool*)0x123ABCDE;
|
||||
|
||||
int counter = 0;
|
||||
// Small loop
|
||||
for (counter=0; counter<10;) {
|
||||
counter++;
|
||||
}
|
||||
|
||||
counter = 185;
|
||||
|
||||
// Large loop
|
||||
for (counter=0; counter<10000;) {
|
||||
counter++;
|
||||
}
|
||||
}
|
||||
|
||||
int main() {
|
||||
testTracepoints();
|
||||
return 0;
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load diff
|
@ -29,6 +29,7 @@ import org.junit.runners.Suite;
|
|||
@RunWith(Suite.class)
|
||||
@Suite.SuiteClasses({
|
||||
// We need specific name for the tests of this suite, because of bug https://bugs.eclipse.org/172256
|
||||
GDBRemoteTracepointsTest_7_0.class,
|
||||
MIRegistersTest_7_0.class,
|
||||
MIRunControlTest_7_0.class,
|
||||
MIExpressionsTest_7_0.class,
|
||||
|
|
Loading…
Add table
Reference in a new issue