mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-06 09:16:02 +02:00
Managing breakpoints from the gdb console.
This commit is contained in:
parent
01c7d568b7
commit
8fdc0ff5f8
17 changed files with 452 additions and 45 deletions
|
@ -1,3 +1,18 @@
|
|||
2003-01-27 Mikhail Khodjaiants
|
||||
Managing breakpoints from the gdb console.
|
||||
* CDebugCorePlugin.java
|
||||
* CDebugModel.java
|
||||
* IAsyncExecutor.java
|
||||
* ICSourceLocator.java
|
||||
* CAddressBreakpoint.java
|
||||
* CBreakpoint.java
|
||||
* CFunctionBreakpoint.java
|
||||
* CLineBreakpoint.java
|
||||
* CWatchpoint.java
|
||||
* CDebugTarget.java
|
||||
* CSourceLocator.java
|
||||
* CSourceManager.java
|
||||
|
||||
2003-01-27 Mikhail Khodjaiants
|
||||
Use 'equals' to compare CDI variables instead of names.
|
||||
* CStackFrame.java
|
||||
|
|
|
@ -39,6 +39,8 @@ public class CDebugCorePlugin extends Plugin
|
|||
|
||||
private HashMap fDebugConfigurations;
|
||||
|
||||
private IAsyncExecutor fAsyncExecutor = null;
|
||||
|
||||
/**
|
||||
* The constructor.
|
||||
*/
|
||||
|
@ -199,4 +201,15 @@ public class CDebugCorePlugin extends Plugin
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void setAsyncExecutor( IAsyncExecutor executor )
|
||||
{
|
||||
fAsyncExecutor = executor;
|
||||
}
|
||||
|
||||
public void asyncExec( Runnable runnable )
|
||||
{
|
||||
if ( fAsyncExecutor != null )
|
||||
fAsyncExecutor.asyncExec( runnable );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,10 +14,12 @@ import org.eclipse.cdt.debug.core.cdi.ICDIConfiguration;
|
|||
import org.eclipse.cdt.debug.core.cdi.ICDILocation;
|
||||
import org.eclipse.cdt.debug.core.cdi.ICDISessionObject;
|
||||
import org.eclipse.cdt.debug.core.cdi.event.ICDISuspendedEvent;
|
||||
import org.eclipse.cdt.debug.core.cdi.model.ICDIBreakpoint;
|
||||
import org.eclipse.cdt.debug.core.cdi.model.ICDIExpression;
|
||||
import org.eclipse.cdt.debug.core.cdi.model.ICDIMemoryBlock;
|
||||
import org.eclipse.cdt.debug.core.cdi.model.ICDIObject;
|
||||
import org.eclipse.cdt.debug.core.cdi.model.ICDITarget;
|
||||
import org.eclipse.cdt.debug.core.cdi.model.ICDIWatchpoint;
|
||||
import org.eclipse.cdt.debug.core.model.ICAddressBreakpoint;
|
||||
import org.eclipse.cdt.debug.core.model.ICBreakpoint;
|
||||
import org.eclipse.cdt.debug.core.model.ICDebugTargetType;
|
||||
|
@ -307,6 +309,23 @@ public class CDebugModel
|
|||
return new CLineBreakpoint( resource, attributes, add );
|
||||
}
|
||||
|
||||
public static ICLineBreakpoint createLineBreakpoint( IResource resource,
|
||||
int lineNumber,
|
||||
boolean enabled,
|
||||
int ignoreCount,
|
||||
String condition,
|
||||
ICDIBreakpoint cdiBreakpoint,
|
||||
boolean add ) throws DebugException
|
||||
{
|
||||
HashMap attributes = new HashMap( 10 );
|
||||
attributes.put( ICBreakpoint.ID, getPluginIdentifier() );
|
||||
attributes.put( IMarker.LINE_NUMBER, new Integer( lineNumber ) );
|
||||
attributes.put( ICBreakpoint.ENABLED, new Boolean( enabled ) );
|
||||
attributes.put( ICBreakpoint.IGNORE_COUNT, new Integer( ignoreCount ) );
|
||||
attributes.put( ICBreakpoint.CONDITION, condition );
|
||||
return new CLineBreakpoint( resource, attributes, cdiBreakpoint, add );
|
||||
}
|
||||
|
||||
public static ICAddressBreakpoint addressBreakpointExists( IResource resource, long address ) throws CoreException
|
||||
{
|
||||
String modelId = getPluginIdentifier();
|
||||
|
@ -341,7 +360,6 @@ public class CDebugModel
|
|||
}
|
||||
|
||||
public static ICAddressBreakpoint createAddressBreakpoint( IResource resource,
|
||||
int lineNumber,
|
||||
long address,
|
||||
boolean enabled,
|
||||
int ignoreCount,
|
||||
|
@ -350,7 +368,6 @@ public class CDebugModel
|
|||
{
|
||||
HashMap attributes = new HashMap( 10 );
|
||||
attributes.put( ICBreakpoint.ID, getPluginIdentifier() );
|
||||
// attributes.put( IMarker.LINE_NUMBER, new Integer( lineNumber ) );
|
||||
attributes.put( IMarker.CHAR_START, new Integer( 0 ) );
|
||||
attributes.put( IMarker.CHAR_END, new Integer( 0 ) );
|
||||
attributes.put( IMarker.LINE_NUMBER, new Integer( -1 ) );
|
||||
|
@ -361,6 +378,26 @@ public class CDebugModel
|
|||
return new CAddressBreakpoint( resource, attributes, add );
|
||||
}
|
||||
|
||||
public static ICAddressBreakpoint createAddressBreakpoint( IResource resource,
|
||||
long address,
|
||||
boolean enabled,
|
||||
int ignoreCount,
|
||||
String condition,
|
||||
ICDIBreakpoint breakpoint,
|
||||
boolean add ) throws DebugException
|
||||
{
|
||||
HashMap attributes = new HashMap( 10 );
|
||||
attributes.put( ICBreakpoint.ID, getPluginIdentifier() );
|
||||
attributes.put( IMarker.CHAR_START, new Integer( 0 ) );
|
||||
attributes.put( IMarker.CHAR_END, new Integer( 0 ) );
|
||||
attributes.put( IMarker.LINE_NUMBER, new Integer( -1 ) );
|
||||
attributes.put( ICAddressBreakpoint.ADDRESS, Long.toString( address ) );
|
||||
attributes.put( ICBreakpoint.ENABLED, new Boolean( enabled ) );
|
||||
attributes.put( ICBreakpoint.IGNORE_COUNT, new Integer( ignoreCount ) );
|
||||
attributes.put( ICBreakpoint.CONDITION, condition );
|
||||
return new CAddressBreakpoint( resource, attributes, breakpoint, add );
|
||||
}
|
||||
|
||||
public static ICWatchpoint watchpointExists( IResource resource, boolean write, boolean read, String expression ) throws CoreException
|
||||
{
|
||||
String modelId = getPluginIdentifier();
|
||||
|
@ -406,6 +443,27 @@ public class CDebugModel
|
|||
return new CWatchpoint( resource, attributes, add );
|
||||
}
|
||||
|
||||
public static ICWatchpoint createWatchpoint( IResource resource,
|
||||
boolean writeAccess,
|
||||
boolean readAccess,
|
||||
String expression,
|
||||
boolean enabled,
|
||||
int ignoreCount,
|
||||
String condition,
|
||||
ICDIWatchpoint watchpoint,
|
||||
boolean add ) throws DebugException
|
||||
{
|
||||
HashMap attributes = new HashMap( 10 );
|
||||
attributes.put( ICBreakpoint.ID, getPluginIdentifier() );
|
||||
attributes.put( ICBreakpoint.ENABLED, new Boolean( enabled ) );
|
||||
attributes.put( ICBreakpoint.IGNORE_COUNT, new Integer( ignoreCount ) );
|
||||
attributes.put( ICBreakpoint.CONDITION, condition );
|
||||
attributes.put( ICWatchpoint.EXPRESSION, expression );
|
||||
attributes.put( ICWatchpoint.READ, new Boolean( readAccess ) );
|
||||
attributes.put( ICWatchpoint.WRITE, new Boolean( writeAccess ) );
|
||||
return new CWatchpoint( resource, attributes, watchpoint, add );
|
||||
}
|
||||
|
||||
public static IExpression createExpression( IDebugTarget target, String text ) throws DebugException
|
||||
{
|
||||
if ( target != null && target instanceof CDebugTarget )
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
/*
|
||||
*(c) Copyright QNX Software Systems Ltd. 2002.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
*/
|
||||
package org.eclipse.cdt.debug.core;
|
||||
|
||||
/**
|
||||
* Enter type comment.
|
||||
*
|
||||
* @since: Jan 27, 2003
|
||||
*/
|
||||
public interface IAsyncExecutor
|
||||
{
|
||||
void asyncExec( Runnable runnable );
|
||||
}
|
|
@ -50,4 +50,6 @@ public interface ICSourceLocator extends ISourceLocator
|
|||
* @return whether this locator is able to locate the given resource
|
||||
*/
|
||||
boolean contains( IResource resource );
|
||||
|
||||
Object findSourceElement( String fileName );
|
||||
}
|
|
@ -7,6 +7,7 @@ package org.eclipse.cdt.debug.internal.core.breakpoints;
|
|||
|
||||
import java.util.Map;
|
||||
|
||||
import org.eclipse.cdt.debug.core.cdi.model.ICDIBreakpoint;
|
||||
import org.eclipse.cdt.debug.core.model.ICAddressBreakpoint;
|
||||
import org.eclipse.core.resources.IMarker;
|
||||
import org.eclipse.core.resources.IResource;
|
||||
|
@ -35,7 +36,15 @@ public class CAddressBreakpoint extends CBreakpoint implements ICAddressBreakpoi
|
|||
*/
|
||||
public CAddressBreakpoint( IResource resource, Map attributes, boolean add ) throws DebugException
|
||||
{
|
||||
super( resource, C_ADDRESS_BREAKPOINT, attributes, add );
|
||||
super( resource, getMarkerType(), attributes, add );
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor for CAddressBreakpoint.
|
||||
*/
|
||||
public CAddressBreakpoint( IResource resource, Map attributes, ICDIBreakpoint cdiBreakpoint, boolean add ) throws DebugException
|
||||
{
|
||||
super( resource, getMarkerType(), attributes, cdiBreakpoint, add );
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
|
|
|
@ -9,6 +9,7 @@ package org.eclipse.cdt.debug.internal.core.breakpoints;
|
|||
import java.util.Map;
|
||||
|
||||
import org.eclipse.cdt.debug.core.CDebugModel;
|
||||
import org.eclipse.cdt.debug.core.cdi.model.ICDIBreakpoint;
|
||||
import org.eclipse.cdt.debug.core.model.ICBreakpoint;
|
||||
import org.eclipse.core.resources.IMarker;
|
||||
import org.eclipse.core.resources.IResource;
|
||||
|
@ -32,6 +33,12 @@ public abstract class CBreakpoint extends Breakpoint
|
|||
implements ICBreakpoint,
|
||||
IDebugEventSetListener
|
||||
{
|
||||
/**
|
||||
* This field is used to pass a CDI breakpoint to the target if the breakpoint
|
||||
* is created in gdb console.
|
||||
*/
|
||||
private ICDIBreakpoint fExternalBreakpoint = null;
|
||||
|
||||
/**
|
||||
* Constructor for CBreakpoint.
|
||||
*/
|
||||
|
@ -64,6 +71,32 @@ public abstract class CBreakpoint extends Breakpoint
|
|||
run( wr );
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor for CBreakpoint.
|
||||
*/
|
||||
public CBreakpoint( final IResource resource, final String markerType, final Map attributes, final ICDIBreakpoint cdiBreakpoint, final boolean add ) throws DebugException
|
||||
{
|
||||
setExternalBreakpoint( cdiBreakpoint );
|
||||
IWorkspaceRunnable wr= new IWorkspaceRunnable()
|
||||
{
|
||||
public void run( IProgressMonitor monitor ) throws CoreException
|
||||
{
|
||||
// create the marker
|
||||
setMarker( resource.createMarker( markerType ) );
|
||||
|
||||
// set attributes
|
||||
ensureMarker().setAttributes( attributes );
|
||||
|
||||
//set the marker message
|
||||
setAttribute( IMarker.MESSAGE, getMarkerMessage() );
|
||||
|
||||
// add to breakpoint manager if requested
|
||||
register( add );
|
||||
}
|
||||
};
|
||||
run( wr );
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.debug.core.model.IBreakpoint#getModelIdentifier()
|
||||
*/
|
||||
|
@ -224,4 +257,14 @@ public abstract class CBreakpoint extends Breakpoint
|
|||
{
|
||||
super.setAttribute( attributeName, value );
|
||||
}
|
||||
|
||||
public ICDIBreakpoint getExternalBreakpoint()
|
||||
{
|
||||
return fExternalBreakpoint;
|
||||
}
|
||||
|
||||
public void setExternalBreakpoint( ICDIBreakpoint cdiBreakpoint )
|
||||
{
|
||||
fExternalBreakpoint = cdiBreakpoint;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,6 +7,7 @@ package org.eclipse.cdt.debug.internal.core.breakpoints;
|
|||
|
||||
import java.util.Map;
|
||||
|
||||
import org.eclipse.cdt.debug.core.cdi.model.ICDIBreakpoint;
|
||||
import org.eclipse.cdt.debug.core.model.ICFunctionBreakpoint;
|
||||
import org.eclipse.core.resources.IMarker;
|
||||
import org.eclipse.core.resources.IResource;
|
||||
|
@ -42,7 +43,15 @@ public class CFunctionBreakpoint extends CBreakpoint implements ICFunctionBreakp
|
|||
*/
|
||||
public CFunctionBreakpoint( IResource resource, Map attributes, boolean add ) throws DebugException
|
||||
{
|
||||
super( resource, C_FUNCTION_BREAKPOINT, attributes, add );
|
||||
super( resource, getMarkerType(), attributes, add );
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor for CFunctionBreakpoint.
|
||||
*/
|
||||
public CFunctionBreakpoint( IResource resource, Map attributes, ICDIBreakpoint cdiBreakpoint, boolean add ) throws DebugException
|
||||
{
|
||||
super( resource, getMarkerType(), attributes, cdiBreakpoint, add );
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
|
|
|
@ -7,6 +7,7 @@ package org.eclipse.cdt.debug.internal.core.breakpoints;
|
|||
|
||||
import java.util.Map;
|
||||
|
||||
import org.eclipse.cdt.debug.core.cdi.model.ICDIBreakpoint;
|
||||
import org.eclipse.cdt.debug.core.model.ICLineBreakpoint;
|
||||
import org.eclipse.core.resources.IMarker;
|
||||
import org.eclipse.core.resources.IResource;
|
||||
|
@ -38,6 +39,14 @@ public class CLineBreakpoint extends CBreakpoint implements ICLineBreakpoint
|
|||
super( resource, getMarkerType(), attributes, add );
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor for CLineBreakpoint.
|
||||
*/
|
||||
public CLineBreakpoint( IResource resource, Map attributes, ICDIBreakpoint cdiBreakpoint, boolean add ) throws DebugException
|
||||
{
|
||||
super( resource, getMarkerType(), attributes, cdiBreakpoint, add );
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.debug.core.model.ILineBreakpoint#getLineNumber()
|
||||
*/
|
||||
|
|
|
@ -7,6 +7,7 @@ package org.eclipse.cdt.debug.internal.core.breakpoints;
|
|||
|
||||
import java.util.Map;
|
||||
|
||||
import org.eclipse.cdt.debug.core.cdi.model.ICDIWatchpoint;
|
||||
import org.eclipse.cdt.debug.core.model.ICWatchpoint;
|
||||
import org.eclipse.core.resources.IResource;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
|
@ -31,17 +32,20 @@ public class CWatchpoint extends CBreakpoint implements ICWatchpoint
|
|||
|
||||
/**
|
||||
* Constructor for CWatchpoint.
|
||||
* @param resource
|
||||
* @param markerType
|
||||
* @param attributes
|
||||
* @param add
|
||||
* @throws DebugException
|
||||
*/
|
||||
public CWatchpoint( IResource resource, Map attributes, boolean add ) throws DebugException
|
||||
{
|
||||
super( resource, getMarkerType(), attributes, add );
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor for CWatchpoint.
|
||||
*/
|
||||
public CWatchpoint( IResource resource, Map attributes, ICDIWatchpoint watchpoint, boolean add ) throws DebugException
|
||||
{
|
||||
super( resource, getMarkerType(), attributes, watchpoint, add );
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.debug.core.ICWatchpoint#isWriteType()
|
||||
*/
|
||||
|
|
|
@ -74,6 +74,7 @@ import org.eclipse.cdt.debug.internal.core.CMemoryManager;
|
|||
import org.eclipse.cdt.debug.internal.core.CSharedLibraryManager;
|
||||
import org.eclipse.cdt.debug.internal.core.ICDebugInternalConstants;
|
||||
import org.eclipse.cdt.debug.internal.core.breakpoints.CBreakpoint;
|
||||
import org.eclipse.cdt.debug.internal.core.breakpoints.CWatchpoint;
|
||||
import org.eclipse.cdt.debug.internal.core.sourcelookup.CSourceManager;
|
||||
import org.eclipse.cdt.debug.internal.core.sourcelookup.DisassemblyManager;
|
||||
import org.eclipse.core.resources.IFile;
|
||||
|
@ -901,6 +902,14 @@ public class CDebugTarget extends CDebugElement
|
|||
if ( ((ICDISharedLibrary)source).areSymbolsLoaded() )
|
||||
setRetryBreakpoints( true );
|
||||
}
|
||||
if ( source instanceof ICDILocationBreakpoint )
|
||||
{
|
||||
handleLocationBreakpointCreatedEvent( (ICDILocationBreakpoint)source );
|
||||
}
|
||||
if ( source instanceof ICDIWatchpoint )
|
||||
{
|
||||
handleWatchpointCreatedEvent( (ICDIWatchpoint)source );
|
||||
}
|
||||
}
|
||||
else if ( event instanceof ICDISuspendedEvent )
|
||||
{
|
||||
|
@ -933,6 +942,10 @@ public class CDebugTarget extends CDebugElement
|
|||
{
|
||||
getSharedLibraryManager().sharedLibraryUnloaded( (ICDISharedLibrary)source );
|
||||
}
|
||||
if ( source instanceof ICDIBreakpoint )
|
||||
{
|
||||
handleBreakpointDestroyedEvent( (ICDIBreakpoint)source );
|
||||
}
|
||||
}
|
||||
else if ( event instanceof ICDIDisconnectedEvent )
|
||||
{
|
||||
|
@ -1463,6 +1476,126 @@ public class CDebugTarget extends CDebugElement
|
|||
}
|
||||
}
|
||||
|
||||
private void handleLocationBreakpointCreatedEvent( final ICDILocationBreakpoint breakpoint )
|
||||
{
|
||||
Runnable runnable = new Runnable()
|
||||
{
|
||||
public void run()
|
||||
{
|
||||
doHandleLocationBreakpointCreatedEvent( breakpoint );
|
||||
}
|
||||
|
||||
};
|
||||
CDebugCorePlugin.getDefault().asyncExec( runnable );
|
||||
}
|
||||
|
||||
protected void doHandleLocationBreakpointCreatedEvent( ICDILocationBreakpoint breakpoint )
|
||||
{
|
||||
if ( breakpoint.isTemporary() || getBreakpoints().containsValue( breakpoint ) )
|
||||
return;
|
||||
try
|
||||
{
|
||||
if ( breakpoint.getLocation().getFile() != null && breakpoint.getLocation().getFile().length() > 0 )
|
||||
{
|
||||
if ( getSourceLocator() instanceof IAdaptable && ((IAdaptable)getSourceLocator()).getAdapter( ICSourceLocator.class ) != null )
|
||||
{
|
||||
Object sourceElement = ((ICSourceLocator)((IAdaptable)getSourceLocator()).getAdapter( ICSourceLocator.class )).findSourceElement( breakpoint.getLocation().getFile() );
|
||||
if ( sourceElement != null && sourceElement instanceof IFile )
|
||||
{
|
||||
CDebugModel.createLineBreakpoint( (IFile)sourceElement,
|
||||
breakpoint.getLocation().getLineNumber(),
|
||||
breakpoint.isEnabled(),
|
||||
breakpoint.getCondition().getIgnoreCount(),
|
||||
breakpoint.getCondition().getExpression(),
|
||||
breakpoint,
|
||||
true );
|
||||
}
|
||||
}
|
||||
}
|
||||
else if ( breakpoint.getLocation().getAddress() > 0 )
|
||||
{
|
||||
CDebugModel.createAddressBreakpoint( getExecFile(),
|
||||
breakpoint.getLocation().getAddress(),
|
||||
breakpoint.isEnabled(),
|
||||
breakpoint.getCondition().getIgnoreCount(),
|
||||
breakpoint.getCondition().getExpression(),
|
||||
breakpoint,
|
||||
true );
|
||||
}
|
||||
}
|
||||
catch( CDIException e )
|
||||
{
|
||||
}
|
||||
catch( DebugException e )
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
private void handleWatchpointCreatedEvent( final ICDIWatchpoint watchpoint )
|
||||
{
|
||||
Runnable runnable = new Runnable()
|
||||
{
|
||||
public void run()
|
||||
{
|
||||
doHandleWatchpointCreatedEvent( watchpoint );
|
||||
}
|
||||
|
||||
};
|
||||
CDebugCorePlugin.getDefault().asyncExec( runnable );
|
||||
}
|
||||
|
||||
protected void doHandleWatchpointCreatedEvent( ICDIWatchpoint watchpoint )
|
||||
{
|
||||
if ( getBreakpoints().containsValue( watchpoint ) )
|
||||
return;
|
||||
try
|
||||
{
|
||||
CDebugModel.createWatchpoint( getExecFile().getProject(),
|
||||
watchpoint.isWriteType(),
|
||||
watchpoint.isReadType(),
|
||||
watchpoint.getWatchExpression(),
|
||||
watchpoint.isEnabled(),
|
||||
watchpoint.getCondition().getIgnoreCount(),
|
||||
watchpoint.getCondition().getExpression(),
|
||||
watchpoint,
|
||||
true );
|
||||
}
|
||||
catch( CDIException e )
|
||||
{
|
||||
}
|
||||
catch( DebugException e )
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
private void handleBreakpointDestroyedEvent( final ICDIBreakpoint breakpoint )
|
||||
{
|
||||
Runnable runnable = new Runnable()
|
||||
{
|
||||
public void run()
|
||||
{
|
||||
doHandleBreakpointDestroyedEvent( breakpoint );
|
||||
}
|
||||
|
||||
};
|
||||
CDebugCorePlugin.getDefault().asyncExec( runnable );
|
||||
}
|
||||
|
||||
protected void doHandleBreakpointDestroyedEvent( ICDIBreakpoint cdiBreakpoint )
|
||||
{
|
||||
IBreakpoint breakpoint = findBreakpoint( cdiBreakpoint );
|
||||
if ( breakpoint != null )
|
||||
{
|
||||
try
|
||||
{
|
||||
DebugPlugin.getDefault().getBreakpointManager().removeBreakpoint( breakpoint, true );
|
||||
}
|
||||
catch( CoreException e )
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Finds and returns the model thread for the associated CDI thread,
|
||||
* or <code>null</code> if not found.
|
||||
|
@ -1615,20 +1748,21 @@ public class CDebugTarget extends CDebugElement
|
|||
|
||||
private void setLineBreakpoint( ICLineBreakpoint breakpoint ) throws DebugException
|
||||
{
|
||||
ICDIBreakpointManager bm = getCDISession().getBreakpointManager();
|
||||
try
|
||||
{
|
||||
ICDILocation location = bm.createLocation( breakpoint.getMarker().getResource().getLocation().lastSegment(), null, breakpoint.getLineNumber() );
|
||||
ICDICondition condition = bm.createCondition( breakpoint.getIgnoreCount(), breakpoint.getCondition() );
|
||||
ICDIBreakpoint cdiBreakpoint = bm.setLocationBreakpoint( ICDIBreakpoint.REGULAR, location, condition, null );
|
||||
if ( !getBreakpoints().containsKey( breakpoint ) )
|
||||
ICDIBreakpoint cdiBreakpoint = ((CBreakpoint)breakpoint).getExternalBreakpoint();
|
||||
if ( cdiBreakpoint == null )
|
||||
{
|
||||
setLineBreakpoint0( breakpoint );
|
||||
}
|
||||
else
|
||||
{
|
||||
getBreakpoints().put( breakpoint, cdiBreakpoint );
|
||||
((CBreakpoint)breakpoint).incrementInstallCount();
|
||||
if ( !breakpoint.isEnabled() )
|
||||
{
|
||||
cdiBreakpoint.setEnabled( false );
|
||||
}
|
||||
}
|
||||
((CBreakpoint)breakpoint).incrementInstallCount();
|
||||
if ( !breakpoint.isEnabled() )
|
||||
{
|
||||
cdiBreakpoint.setEnabled( false );
|
||||
}
|
||||
}
|
||||
catch( CoreException ce )
|
||||
|
@ -1640,23 +1774,33 @@ public class CDebugTarget extends CDebugElement
|
|||
requestFailed( "Operation failed. Reason: ", e );
|
||||
}
|
||||
}
|
||||
|
||||
private synchronized void setLineBreakpoint0( ICLineBreakpoint breakpoint ) throws CDIException, CoreException
|
||||
{
|
||||
ICDIBreakpointManager bm = getCDISession().getBreakpointManager();
|
||||
ICDILocation location = bm.createLocation( breakpoint.getMarker().getResource().getLocation().lastSegment(), null, breakpoint.getLineNumber() );
|
||||
ICDICondition condition = bm.createCondition( breakpoint.getIgnoreCount(), breakpoint.getCondition() );
|
||||
ICDIBreakpoint cdiBreakpoint = bm.setLocationBreakpoint( ICDIBreakpoint.REGULAR, location, condition, null );
|
||||
getBreakpoints().put( breakpoint, cdiBreakpoint );
|
||||
}
|
||||
|
||||
private void setAddressBreakpoint( ICAddressBreakpoint breakpoint ) throws DebugException
|
||||
{
|
||||
ICDIBreakpointManager bm = getCDISession().getBreakpointManager();
|
||||
try
|
||||
{
|
||||
ICDILocation location = bm.createLocation( Long.parseLong( breakpoint.getAddress() ) );
|
||||
ICDICondition condition = bm.createCondition( breakpoint.getIgnoreCount(), breakpoint.getCondition() );
|
||||
ICDIBreakpoint cdiBreakpoint = bm.setLocationBreakpoint( ICDIBreakpoint.REGULAR, location, condition, null );
|
||||
if ( !getBreakpoints().containsKey( breakpoint ) )
|
||||
ICDIBreakpoint cdiBreakpoint = ((CBreakpoint)breakpoint).getExternalBreakpoint();
|
||||
if ( cdiBreakpoint == null )
|
||||
{
|
||||
setAddressBreakpoint0( breakpoint );
|
||||
}
|
||||
else
|
||||
{
|
||||
getBreakpoints().put( breakpoint, cdiBreakpoint );
|
||||
((CBreakpoint)breakpoint).incrementInstallCount();
|
||||
if ( !breakpoint.isEnabled() )
|
||||
{
|
||||
cdiBreakpoint.setEnabled( false );
|
||||
}
|
||||
}
|
||||
((CBreakpoint)breakpoint).incrementInstallCount();
|
||||
if ( !breakpoint.isEnabled() )
|
||||
{
|
||||
cdiBreakpoint.setEnabled( false );
|
||||
}
|
||||
}
|
||||
catch( CoreException ce )
|
||||
|
@ -1672,26 +1816,33 @@ public class CDebugTarget extends CDebugElement
|
|||
requestFailed( "Operation failed. Reason: ", e );
|
||||
}
|
||||
}
|
||||
|
||||
private synchronized void setAddressBreakpoint0( ICAddressBreakpoint breakpoint ) throws CDIException, CoreException
|
||||
{
|
||||
ICDIBreakpointManager bm = getCDISession().getBreakpointManager();
|
||||
ICDILocation location = bm.createLocation( Long.parseLong( breakpoint.getAddress() ) );
|
||||
ICDICondition condition = bm.createCondition( breakpoint.getIgnoreCount(), breakpoint.getCondition() );
|
||||
ICDIBreakpoint cdiBreakpoint = bm.setLocationBreakpoint( ICDIBreakpoint.REGULAR, location, condition, null );
|
||||
getBreakpoints().put( breakpoint, cdiBreakpoint );
|
||||
}
|
||||
|
||||
private void setWatchpoint( ICWatchpoint watchpoint ) throws DebugException
|
||||
{
|
||||
ICDIBreakpointManager bm = getCDISession().getBreakpointManager();
|
||||
try
|
||||
{
|
||||
ICDICondition condition = bm.createCondition( watchpoint.getIgnoreCount(), watchpoint.getCondition() );
|
||||
int accessType = 0;
|
||||
accessType |= ( watchpoint.isWriteType() ) ? ICDIWatchpoint.WRITE : 0;
|
||||
accessType |= ( watchpoint.isReadType() ) ? ICDIWatchpoint.READ : 0;
|
||||
String expression = watchpoint.getExpression();
|
||||
ICDIWatchpoint cdiWatchpoint = bm.setWatchpoint( ICDIBreakpoint.REGULAR, accessType, expression, condition );
|
||||
if ( !getBreakpoints().containsKey( watchpoint ) )
|
||||
ICDIWatchpoint cdiWatchpoint = (ICDIWatchpoint)((CWatchpoint)watchpoint).getExternalBreakpoint();
|
||||
if ( cdiWatchpoint == null )
|
||||
{
|
||||
setWatchpoint0( watchpoint );
|
||||
}
|
||||
else
|
||||
{
|
||||
getBreakpoints().put( watchpoint, cdiWatchpoint );
|
||||
((CBreakpoint)watchpoint).incrementInstallCount();
|
||||
if ( !watchpoint.isEnabled() )
|
||||
{
|
||||
cdiWatchpoint.setEnabled( false );
|
||||
}
|
||||
}
|
||||
((CBreakpoint)watchpoint).incrementInstallCount();
|
||||
if ( !watchpoint.isEnabled() )
|
||||
{
|
||||
cdiWatchpoint.setEnabled( false );
|
||||
}
|
||||
}
|
||||
catch( CoreException ce )
|
||||
|
@ -1704,6 +1855,18 @@ public class CDebugTarget extends CDebugElement
|
|||
}
|
||||
}
|
||||
|
||||
private synchronized void setWatchpoint0( ICWatchpoint watchpoint ) throws CDIException, CoreException
|
||||
{
|
||||
ICDIBreakpointManager bm = getCDISession().getBreakpointManager();
|
||||
ICDICondition condition = bm.createCondition( watchpoint.getIgnoreCount(), watchpoint.getCondition() );
|
||||
int accessType = 0;
|
||||
accessType |= ( watchpoint.isWriteType() ) ? ICDIWatchpoint.WRITE : 0;
|
||||
accessType |= ( watchpoint.isReadType() ) ? ICDIWatchpoint.READ : 0;
|
||||
String expression = watchpoint.getExpression();
|
||||
ICDIWatchpoint cdiWatchpoint = bm.setWatchpoint( ICDIBreakpoint.REGULAR, accessType, expression, condition );
|
||||
getBreakpoints().put( watchpoint, cdiWatchpoint );
|
||||
}
|
||||
|
||||
private ICDIBreakpoint findCDIBreakpoint( IBreakpoint breakpoint )
|
||||
{
|
||||
return (ICDIBreakpoint)getBreakpoints().get( breakpoint );
|
||||
|
|
|
@ -216,4 +216,34 @@ public class CSourceLocator implements ICSourceLocator
|
|||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.debug.core.sourcelookup.ICSourceLocator#findSourceElement(String)
|
||||
*/
|
||||
public Object findSourceElement( String fileName )
|
||||
{
|
||||
Object result = null;
|
||||
if ( fileName != null && fileName.length() > 0 )
|
||||
{
|
||||
result = findFileByAbsolutePath( fileName );
|
||||
if ( result == null )
|
||||
{
|
||||
ICSourceLocation[] locations = getSourceLocations();
|
||||
for ( int i = 0; i < locations.length; ++i )
|
||||
{
|
||||
try
|
||||
{
|
||||
result = locations[i].findSourceElement( fileName );
|
||||
}
|
||||
catch( CoreException e )
|
||||
{
|
||||
// do nothing
|
||||
}
|
||||
if ( result != null )
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -190,4 +190,16 @@ public class CSourceManager implements ICSourceLocator, ISourceMode, IAdaptable
|
|||
list.add( location );
|
||||
setSourceLocations( (ICSourceLocation[])list.toArray( new ICSourceLocation[list.size()] ) );
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.debug.core.sourcelookup.ICSourceLocator#findSourceElement(String)
|
||||
*/
|
||||
public Object findSourceElement( String fileName )
|
||||
{
|
||||
if ( getCSourceLocator() != null )
|
||||
{
|
||||
return getCSourceLocator().findSourceElement( fileName );
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,3 +1,9 @@
|
|||
2003-01-27 Mikhail Khodjaiants
|
||||
Managing breakpoints from the gdb console.
|
||||
* AddAddressBreakpointActionDelegate.java
|
||||
* ManageBreakpointRulerAction.java
|
||||
* CDebugUIPlugin.java
|
||||
|
||||
2003-01-23 Mikhail Khodjaiants
|
||||
Ignore the text selection when hovering.
|
||||
* DebugTextHovering.java
|
||||
|
|
|
@ -71,7 +71,6 @@ public class AddAddressBreakpointActionDelegate extends AbstractListenerActionDe
|
|||
if ( dialog.open() == dialog.OK )
|
||||
{
|
||||
CDebugModel.createAddressBreakpoint( ((IExecFileInfo)getDebugTarget( element ).getAdapter( IExecFileInfo.class )).getExecFile(),
|
||||
-1,
|
||||
parseValue( dialog.getValue().trim() ),
|
||||
true,
|
||||
0,
|
||||
|
|
|
@ -286,7 +286,7 @@ public class ManageBreakpointRulerAction extends Action implements IUpdate
|
|||
long address = ((IDisassemblyStorage)editorInput.getStorage()).getAddress( lineNumber );
|
||||
if ( address != 0 && CDebugModel.addressBreakpointExists( resource, address ) == null )
|
||||
{
|
||||
CDebugModel.createAddressBreakpoint( resource, lineNumber, address, true, 0, "", true );
|
||||
CDebugModel.createAddressBreakpoint( resource, address, true, 0, "", true );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,6 +5,8 @@ import java.util.Map;
|
|||
import java.util.MissingResourceException;
|
||||
import java.util.ResourceBundle;
|
||||
|
||||
import org.eclipse.cdt.debug.core.CDebugCorePlugin;
|
||||
import org.eclipse.cdt.debug.core.IAsyncExecutor;
|
||||
import org.eclipse.cdt.debug.core.model.ISwitchToFrame;
|
||||
import org.eclipse.cdt.debug.core.model.ISwitchToThread;
|
||||
import org.eclipse.cdt.debug.core.sourcelookup.IDisassemblyStorage;
|
||||
|
@ -55,7 +57,10 @@ import org.eclipse.ui.plugin.AbstractUIPlugin;
|
|||
/**
|
||||
* The main plugin class to be used in the desktop.
|
||||
*/
|
||||
public class CDebugUIPlugin extends AbstractUIPlugin implements ISelectionListener, IDebugEventSetListener
|
||||
public class CDebugUIPlugin extends AbstractUIPlugin
|
||||
implements ISelectionListener,
|
||||
IDebugEventSetListener,
|
||||
IAsyncExecutor
|
||||
{
|
||||
//The shared instance.
|
||||
private static CDebugUIPlugin plugin;
|
||||
|
@ -313,6 +318,7 @@ public class CDebugUIPlugin extends AbstractUIPlugin implements ISelectionListen
|
|||
{
|
||||
fImageDescriptorRegistry.dispose();
|
||||
}
|
||||
CDebugCorePlugin.getDefault().setAsyncExecutor( null );
|
||||
super.shutdown();
|
||||
}
|
||||
|
||||
|
@ -327,6 +333,7 @@ public class CDebugUIPlugin extends AbstractUIPlugin implements ISelectionListen
|
|||
{
|
||||
ww.getSelectionService().addSelectionListener( IDebugUIConstants.ID_DEBUG_VIEW, this );
|
||||
}
|
||||
CDebugCorePlugin.getDefault().setAsyncExecutor( this );
|
||||
DebugPlugin.getDefault().addDebugEventListener( this );
|
||||
}
|
||||
|
||||
|
@ -476,4 +483,16 @@ public class CDebugUIPlugin extends AbstractUIPlugin implements ISelectionListen
|
|||
fDisassemblyDocumentProvider = new DisassemblyDocumentProvider();
|
||||
return fDisassemblyDocumentProvider;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.debug.core.IAsyncExecutor#asyncExec(Runnable)
|
||||
*/
|
||||
public void asyncExec( Runnable runnable )
|
||||
{
|
||||
Display display = getStandardDisplay();
|
||||
if ( display != null )
|
||||
{
|
||||
display.asyncExec( runnable );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue