mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-23 22:52:11 +02:00
Contributing new disassembly.
This commit is contained in:
parent
9b984524cc
commit
b45f93e8ce
10 changed files with 278 additions and 24 deletions
|
@ -15,6 +15,6 @@ package org.eclipse.cdt.debug.core.model;
|
|||
* org.eclipse.cdt.debug.core.model.IDisassemblyLine:
|
||||
* //TODO Add description.
|
||||
*/
|
||||
public interface IDisassemblyLine {
|
||||
public interface IDisassemblyLine extends ICDebugElement {
|
||||
|
||||
}
|
||||
|
|
|
@ -19,9 +19,15 @@ import java.util.List;
|
|||
import org.eclipse.cdt.core.IAddressFactory;
|
||||
import org.eclipse.cdt.debug.core.CDebugCorePlugin;
|
||||
import org.eclipse.cdt.debug.core.cdi.CDIException;
|
||||
import org.eclipse.cdt.debug.core.cdi.event.ICDIBreakpointMovedEvent;
|
||||
import org.eclipse.cdt.debug.core.cdi.event.ICDIBreakpointProblemEvent;
|
||||
import org.eclipse.cdt.debug.core.cdi.event.ICDIChangedEvent;
|
||||
import org.eclipse.cdt.debug.core.cdi.event.ICDICreatedEvent;
|
||||
import org.eclipse.cdt.debug.core.cdi.event.ICDIDestroyedEvent;
|
||||
import org.eclipse.cdt.debug.core.cdi.event.ICDIEvent;
|
||||
import org.eclipse.cdt.debug.core.cdi.event.ICDIEventListener;
|
||||
import org.eclipse.cdt.debug.core.cdi.model.ICDIInstruction;
|
||||
import org.eclipse.cdt.debug.core.cdi.model.ICDILocationBreakpoint;
|
||||
import org.eclipse.cdt.debug.core.cdi.model.ICDIMixedInstruction;
|
||||
import org.eclipse.cdt.debug.core.cdi.model.ICDITarget;
|
||||
import org.eclipse.cdt.debug.core.model.ICStackFrame;
|
||||
|
@ -30,6 +36,7 @@ import org.eclipse.cdt.debug.core.model.IDisassemblyLine;
|
|||
import org.eclipse.core.runtime.Assert;
|
||||
import org.eclipse.core.runtime.IStatus;
|
||||
import org.eclipse.core.runtime.Status;
|
||||
import org.eclipse.debug.core.DebugEvent;
|
||||
import org.eclipse.debug.core.DebugException;
|
||||
|
||||
public class DisassemblyRetrieval extends CDebugElement implements ICDIEventListener {
|
||||
|
@ -58,10 +65,38 @@ public class DisassemblyRetrieval extends CDebugElement implements ICDIEventList
|
|||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.debug.core.cdi.event.ICDIEventListener#handleDebugEvents(org.eclipse.cdt.debug.core.cdi.event.ICDIEvent[])
|
||||
*/
|
||||
public void handleDebugEvents( ICDIEvent[] event ) {
|
||||
// TODO Auto-generated method stub
|
||||
public void handleDebugEvents( ICDIEvent[] events ) {
|
||||
for ( ICDIEvent event : events ) {
|
||||
Object source = event.getSource();
|
||||
if ( (event instanceof ICDICreatedEvent
|
||||
|| event instanceof ICDIChangedEvent
|
||||
|| event instanceof ICDIDestroyedEvent
|
||||
|| event instanceof ICDIBreakpointMovedEvent
|
||||
|| event instanceof ICDIBreakpointProblemEvent )
|
||||
&& source instanceof ICDILocationBreakpoint ) {
|
||||
BigInteger address = ((ICDILocationBreakpoint)source).getLocator().getAddress();
|
||||
if ( address != null ) {
|
||||
int index = getIndexForAddress( address, fLines );
|
||||
if ( index >= 0 ) {
|
||||
fireEvent( new DebugEvent( fLines[index], DebugEvent.CHANGE, DebugEvent.STATE ) );
|
||||
}
|
||||
if ( event instanceof ICDIBreakpointMovedEvent ) {
|
||||
address = ((ICDIBreakpointMovedEvent)event).getNewLocation().getAddress();
|
||||
if ( address != null ) {
|
||||
index = getIndexForAddress( address, fLines );
|
||||
if ( index >= 0 ) {
|
||||
fireEvent( new DebugEvent( fLines[index], DebugEvent.CHANGE, DebugEvent.STATE ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.debug.core.model.IDisassemblyRetrieval#getInput()
|
||||
*/
|
||||
public Object getInput() {
|
||||
return fInput;
|
||||
}
|
||||
|
|
|
@ -1354,6 +1354,16 @@
|
|||
<adapter
|
||||
type="org.eclipse.cdt.debug.ui.disassembly.IDocumentElementAnnotationProvider">
|
||||
</adapter>
|
||||
<adapter
|
||||
type="org.eclipse.cdt.debug.ui.disassembly.IElementToggleBreakpointAdapter">
|
||||
</adapter>
|
||||
</factory>
|
||||
<factory
|
||||
adaptableType="org.eclipse.cdt.debug.internal.core.model.DisassemblyRetrieval"
|
||||
class="org.eclipse.cdt.debug.internal.ui.elements.adapters.CDebugElementAdapterFactory">
|
||||
<adapter
|
||||
type="org.eclipse.debug.internal.ui.viewers.model.provisional.IModelProxyFactory">
|
||||
</adapter>
|
||||
</factory>
|
||||
</extension>
|
||||
<extension
|
||||
|
|
|
@ -77,11 +77,17 @@ public class ToggleBreakpointAdapter implements IToggleBreakpointsTarget {
|
|||
if ( part instanceof DisassemblyEditor && selection instanceof ITextSelection ) {
|
||||
DisassemblyEditor editor = (DisassemblyEditor)part;
|
||||
int lineNumber = ((ITextSelection)selection).getStartLine();
|
||||
if ( lineNumber != -1 ) {
|
||||
if ( lineNumber == -1 ) {
|
||||
errorMessage = ActionMessages.getString( "ToggleBreakpointAdapter.Invalid_line_1" ); //$NON-NLS-1$
|
||||
}
|
||||
else {
|
||||
IEditorInput input = editor.getEditorInput();
|
||||
if ( input != null ) {
|
||||
VirtualDocument document = (VirtualDocument)editor.getDocumentProvider().getDocument( input );
|
||||
if ( document != null ) {
|
||||
if ( document == null ) {
|
||||
errorMessage = ActionMessages.getString( "ToggleBreakpointAdapter.Missing_document_1" ); //$NON-NLS-1$
|
||||
}
|
||||
else {
|
||||
IPresentationContext presentationContext = document.getPresentationContext();
|
||||
Object element = document.getElementAtLine( lineNumber );
|
||||
if ( element != null ) {
|
||||
|
@ -90,6 +96,7 @@ public class ToggleBreakpointAdapter implements IToggleBreakpointsTarget {
|
|||
adapter.toggleLineBreakpoints( presentationContext, element );
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -78,9 +78,11 @@ public class DocumentContentProvider implements IModelChangedListener {
|
|||
}
|
||||
if ( !update.isCanceled() ) {
|
||||
disposeLineProxies();
|
||||
fLineElements.clear();
|
||||
getDocument().setCurrentOffset( update.getOffset() );
|
||||
Object[] elements = update.getElements();
|
||||
for ( int i = 0; i < elements.length; ++i ) {
|
||||
fLineElements.put( elements[i], Integer.valueOf( i ) );
|
||||
installLineProxy( i, elements[i] );
|
||||
getDocument().updateElement( getInput(), i, elements[i] );
|
||||
}
|
||||
|
@ -348,7 +350,6 @@ public class DocumentContentProvider implements IModelChangedListener {
|
|||
final IModelProxy proxy = modelProxyFactory.createModelProxy( element, getPresentationContext() );
|
||||
if ( proxy != null ) {
|
||||
fLineProxies.add( index, proxy );
|
||||
fLineElements.put( element, Integer.valueOf( index ) );
|
||||
Job job = new Job( "Model Proxy installed notification job" ) {//$NON-NLS-1$
|
||||
|
||||
/* (non-Javadoc)
|
||||
|
@ -407,7 +408,6 @@ public class DocumentContentProvider implements IModelChangedListener {
|
|||
proxy.dispose();
|
||||
}
|
||||
fLineProxies.clear();
|
||||
fLineElements.clear();
|
||||
}
|
||||
|
||||
protected VirtualSourceViewer getViewer() {
|
||||
|
|
|
@ -22,11 +22,13 @@ import org.eclipse.cdt.debug.core.model.ICThread;
|
|||
import org.eclipse.cdt.debug.core.model.IDisassemblyLine;
|
||||
import org.eclipse.cdt.debug.core.model.IModuleRetrieval;
|
||||
import org.eclipse.cdt.debug.internal.core.CDisassemblyContextProvider;
|
||||
import org.eclipse.cdt.debug.internal.core.model.DisassemblyRetrieval;
|
||||
import org.eclipse.cdt.debug.internal.ui.views.modules.ModuleContentProvider;
|
||||
import org.eclipse.cdt.debug.internal.ui.views.modules.ModuleMementoProvider;
|
||||
import org.eclipse.cdt.debug.ui.disassembly.IDocumentElementAnnotationProvider;
|
||||
import org.eclipse.cdt.debug.ui.disassembly.IDocumentElementContentProvider;
|
||||
import org.eclipse.cdt.debug.ui.disassembly.IDocumentElementLabelProvider;
|
||||
import org.eclipse.cdt.debug.ui.disassembly.IElementToggleBreakpointAdapter;
|
||||
import org.eclipse.core.runtime.IAdapterFactory;
|
||||
import org.eclipse.debug.internal.ui.viewers.model.provisional.IElementContentProvider;
|
||||
import org.eclipse.debug.internal.ui.viewers.model.provisional.IElementMementoProvider;
|
||||
|
@ -48,6 +50,7 @@ public class CDebugElementAdapterFactory implements IAdapterFactory {
|
|||
private static IDocumentElementContentProvider fgDisassemblyContentProvider = new DisassemblyElementContentProvider();
|
||||
private static IDocumentElementLabelProvider fgDisassemblyLabelProvider = new DisassemblyElementLabelProvider();
|
||||
private static IDocumentElementAnnotationProvider fgDisassemblyAnnotationProvider = new DisassemblyElementAnnotationProvider();
|
||||
private static IElementToggleBreakpointAdapter fgDisassemblyToggleBreakpointAdapter = new DisassemblyToggleBreakpointAdapter();
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.core.runtime.IAdapterFactory#getAdapter(java.lang.Object, java.lang.Class)
|
||||
|
@ -67,8 +70,7 @@ public class CDebugElementAdapterFactory implements IAdapterFactory {
|
|||
return fgStackFrameContentProvider;
|
||||
}
|
||||
if ( adaptableObject instanceof ICModule ||
|
||||
adaptableObject instanceof ICElement )
|
||||
{
|
||||
adaptableObject instanceof ICElement ) {
|
||||
return fgModuleContentProvider;
|
||||
}
|
||||
}
|
||||
|
@ -85,7 +87,9 @@ public class CDebugElementAdapterFactory implements IAdapterFactory {
|
|||
if ( adaptableObject instanceof IModuleRetrieval ) {
|
||||
return fgDebugElementProxyFactory;
|
||||
}
|
||||
|
||||
if ( adaptableObject instanceof DisassemblyRetrieval ) {
|
||||
return fgDebugElementProxyFactory;
|
||||
}
|
||||
}
|
||||
if ( adapterType.equals( IElementMementoProvider.class ) ) {
|
||||
if ( adaptableObject instanceof ICStackFrame ) {
|
||||
|
@ -119,6 +123,11 @@ public class CDebugElementAdapterFactory implements IAdapterFactory {
|
|||
return fgDisassemblyAnnotationProvider;
|
||||
}
|
||||
}
|
||||
if ( adapterType.equals( IElementToggleBreakpointAdapter.class ) ) {
|
||||
if ( adaptableObject instanceof IDisassemblyLine ) {
|
||||
return fgDisassemblyToggleBreakpointAdapter;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -134,6 +143,7 @@ public class CDebugElementAdapterFactory implements IAdapterFactory {
|
|||
IDocumentElementContentProvider.class,
|
||||
IDocumentElementLabelProvider.class,
|
||||
IDocumentElementAnnotationProvider.class,
|
||||
IElementToggleBreakpointAdapter.class,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,7 +14,9 @@ package org.eclipse.cdt.debug.internal.ui.elements.adapters;
|
|||
|
||||
import org.eclipse.cdt.debug.core.model.ICDebugTarget;
|
||||
import org.eclipse.cdt.debug.core.model.IModuleRetrieval;
|
||||
import org.eclipse.cdt.debug.internal.core.model.DisassemblyRetrieval;
|
||||
import org.eclipse.cdt.debug.internal.ui.views.modules.ModulesViewModelProxy;
|
||||
import org.eclipse.cdt.debug.ui.ICDebugUIConstants;
|
||||
import org.eclipse.core.runtime.IAdaptable;
|
||||
import org.eclipse.debug.internal.ui.viewers.model.provisional.IModelProxy;
|
||||
import org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationContext;
|
||||
|
@ -27,17 +29,22 @@ public class CDebugElementProxyFactory extends DefaultModelProxyFactory {
|
|||
* @see org.eclipse.debug.internal.ui.viewers.provisional.IModelProxyFactoryAdapter#createModelProxy(java.lang.Object, org.eclipse.debug.internal.ui.viewers.provisional.IPresentationContext)
|
||||
*/
|
||||
public IModelProxy createModelProxy( Object element, IPresentationContext context ) {
|
||||
if ( IDebugUIConstants.ID_MODULE_VIEW.equals( context.getId() ) ) {
|
||||
IModuleRetrieval mr = null;
|
||||
if ( element instanceof IAdaptable ) {
|
||||
ICDebugTarget target = (ICDebugTarget)((IAdaptable)element).getAdapter( ICDebugTarget.class );
|
||||
if ( target != null )
|
||||
mr = (IModuleRetrieval)target.getAdapter( IModuleRetrieval.class );
|
||||
}
|
||||
if ( mr != null ) {
|
||||
return new ModulesViewModelProxy( mr );
|
||||
}
|
||||
}
|
||||
return super.createModelProxy(element, context);
|
||||
}
|
||||
if ( IDebugUIConstants.ID_MODULE_VIEW.equals( context.getId() ) ) {
|
||||
IModuleRetrieval mr = null;
|
||||
if ( element instanceof IAdaptable ) {
|
||||
ICDebugTarget target = (ICDebugTarget)((IAdaptable)element).getAdapter( ICDebugTarget.class );
|
||||
if ( target != null )
|
||||
mr = (IModuleRetrieval)target.getAdapter( IModuleRetrieval.class );
|
||||
}
|
||||
if ( mr != null ) {
|
||||
return new ModulesViewModelProxy( mr );
|
||||
}
|
||||
}
|
||||
else if ( ICDebugUIConstants.ID_DEFAULT_DISASSEMBLY_EDITOR.equals( context.getId() ) ) {
|
||||
if ( element instanceof DisassemblyRetrieval ) {
|
||||
return new DisassemblyElementProxy( (DisassemblyRetrieval)element );
|
||||
}
|
||||
}
|
||||
return super.createModelProxy( element, context );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,7 +17,6 @@ import org.eclipse.cdt.debug.core.CDebugCorePlugin;
|
|||
import org.eclipse.cdt.debug.core.model.ICLineBreakpoint;
|
||||
import org.eclipse.cdt.debug.core.model.ICStackFrame;
|
||||
import org.eclipse.cdt.debug.core.model.IDisassemblyInstruction;
|
||||
import org.eclipse.cdt.debug.internal.core.CBreakpointManager;
|
||||
import org.eclipse.cdt.debug.internal.core.model.CDebugTarget;
|
||||
import org.eclipse.cdt.debug.internal.core.model.DisassemblyRetrieval;
|
||||
import org.eclipse.cdt.debug.internal.ui.views.disassembly.DisassemblyInstructionPointerAnnotation;
|
||||
|
|
|
@ -0,0 +1,88 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2008 ARM Limited 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:
|
||||
* ARM Limited - Initial API and implementation
|
||||
*******************************************************************************/
|
||||
|
||||
package org.eclipse.cdt.debug.internal.ui.elements.adapters;
|
||||
|
||||
import org.eclipse.cdt.debug.core.model.ICDebugTarget;
|
||||
import org.eclipse.cdt.debug.core.model.IDisassemblyLine;
|
||||
import org.eclipse.cdt.debug.internal.core.model.CDebugTarget;
|
||||
import org.eclipse.cdt.debug.internal.core.model.DisassemblyRetrieval;
|
||||
import org.eclipse.debug.core.DebugEvent;
|
||||
import org.eclipse.debug.core.DebugPlugin;
|
||||
import org.eclipse.debug.core.IDebugEventSetListener;
|
||||
import org.eclipse.debug.internal.ui.viewers.model.provisional.IModelDelta;
|
||||
import org.eclipse.debug.internal.ui.viewers.model.provisional.ModelDelta;
|
||||
import org.eclipse.debug.internal.ui.viewers.provisional.AbstractModelProxy;
|
||||
import org.eclipse.jface.viewers.Viewer;
|
||||
|
||||
/**
|
||||
* org.eclipse.cdt.debug.internal.ui.elements.adapters.DisassemblyElementProxy:
|
||||
* //TODO Add description.
|
||||
*/
|
||||
public class DisassemblyElementProxy extends AbstractModelProxy implements IDebugEventSetListener {
|
||||
|
||||
private Object fElement;
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.debug.core.IDebugEventSetListener#handleDebugEvents(org.eclipse.debug.core.DebugEvent[])
|
||||
*/
|
||||
public DisassemblyElementProxy( Object element ) {
|
||||
super();
|
||||
fElement = element;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.debug.internal.ui.viewers.provisional.AbstractModelProxy#installed(org.eclipse.jface.viewers.Viewer)
|
||||
*/
|
||||
@Override
|
||||
public void installed( Viewer viewer ) {
|
||||
super.installed( viewer );
|
||||
DebugPlugin.getDefault().addDebugEventListener( this );
|
||||
fireModelChanged( new ModelDelta( fElement, IModelDelta.CONTENT ) );
|
||||
}
|
||||
|
||||
public void handleDebugEvents( DebugEvent[] events ) {
|
||||
for ( DebugEvent event : events ) {
|
||||
Object source = event.getSource();
|
||||
int kind = event.getKind();
|
||||
int detail = event.getDetail();
|
||||
if ( source instanceof IDisassemblyLine ) {
|
||||
if ( kind == DebugEvent.CHANGE && detail == DebugEvent.STATE ) {
|
||||
IDisassemblyLine line = (IDisassemblyLine)source;
|
||||
DisassemblyRetrieval dr = ((CDebugTarget)line.getDebugTarget()).getDisassemblyRetrieval();
|
||||
if ( getElement().equals( dr ) ) {
|
||||
fireModelChanged( createDelta( line ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.debug.internal.ui.viewers.provisional.AbstractModelProxy#dispose()
|
||||
*/
|
||||
@Override
|
||||
public synchronized void dispose() {
|
||||
DebugPlugin.getDefault().removeDebugEventListener( this );
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
protected Object getElement() {
|
||||
return fElement;
|
||||
}
|
||||
|
||||
protected IModelDelta createDelta( IDisassemblyLine line ) {
|
||||
DisassemblyRetrieval dr = ((CDebugTarget)line.getDebugTarget()).getDisassemblyRetrieval();
|
||||
ModelDelta delta = new ModelDelta( dr, IModelDelta.NO_CHANGE );
|
||||
delta.addNode( line, IModelDelta.STATE );
|
||||
return delta;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,98 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2008 ARM Limited 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:
|
||||
* ARM Limited - Initial API and implementation
|
||||
*******************************************************************************/
|
||||
|
||||
package org.eclipse.cdt.debug.internal.ui.elements.adapters;
|
||||
|
||||
import java.math.BigInteger;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.eclipse.cdt.core.IAddress;
|
||||
import org.eclipse.cdt.debug.core.CDIDebugModel;
|
||||
import org.eclipse.cdt.debug.core.CDebugCorePlugin;
|
||||
import org.eclipse.cdt.debug.core.CDebugUtils;
|
||||
import org.eclipse.cdt.debug.core.model.ICAddressBreakpoint;
|
||||
import org.eclipse.cdt.debug.core.model.ICBreakpoint;
|
||||
import org.eclipse.cdt.debug.core.model.ICDebugTarget;
|
||||
import org.eclipse.cdt.debug.core.model.ICLineBreakpoint;
|
||||
import org.eclipse.cdt.debug.core.model.IDisassemblyInstruction;
|
||||
import org.eclipse.cdt.debug.core.model.IDisassemblySourceLine;
|
||||
import org.eclipse.cdt.debug.internal.core.breakpoints.CAddressBreakpoint;
|
||||
import org.eclipse.cdt.debug.ui.disassembly.IElementToggleBreakpointAdapter;
|
||||
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.debug.core.DebugException;
|
||||
import org.eclipse.debug.core.DebugPlugin;
|
||||
import org.eclipse.debug.core.model.IBreakpoint;
|
||||
import org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationContext;
|
||||
|
||||
/**
|
||||
* org.eclipse.cdt.debug.internal.ui.elements.adapters.DisassemblyToggleBreakpointAdapter:
|
||||
* //TODO Add description.
|
||||
*/
|
||||
public class DisassemblyToggleBreakpointAdapter implements IElementToggleBreakpointAdapter {
|
||||
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see com.arm.eclipse.rvd.ui.disassembly.IElementToggleBreakpointAdapter#canToggleLineBreakpoints(org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationContext, java.lang.Object)
|
||||
*/
|
||||
public boolean canToggleLineBreakpoints( IPresentationContext presentationContext, Object element ) {
|
||||
if ( element instanceof IDisassemblyInstruction ) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see com.arm.eclipse.rvd.ui.disassembly.IElementToggleBreakpointAdapter#toggleLineBreakpoints(org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationContext, java.lang.Object)
|
||||
*/
|
||||
public void toggleLineBreakpoints( IPresentationContext presentationContext, Object element ) throws CoreException {
|
||||
if ( element instanceof IDisassemblyInstruction ) {
|
||||
IDisassemblyInstruction instruction = (IDisassemblyInstruction)element;
|
||||
IBreakpoint breakpoint = findBreakpoint( instruction );
|
||||
if ( breakpoint != null ) {
|
||||
DebugPlugin.getDefault().getBreakpointManager().removeBreakpoint( breakpoint, true );
|
||||
}
|
||||
else {
|
||||
IAddress address = instruction.getAdress();
|
||||
CDIDebugModel.createAddressBreakpoint(
|
||||
null,
|
||||
"", //$NON-NLS-1$
|
||||
ResourcesPlugin.getWorkspace().getRoot(),
|
||||
-1,
|
||||
address,
|
||||
true,
|
||||
0,
|
||||
"", //$NON-NLS-1$
|
||||
true );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private IBreakpoint findBreakpoint( IDisassemblyInstruction instruction ) {
|
||||
BigInteger address = instruction.getAdress().getValue();
|
||||
IBreakpoint[] breakpoints = DebugPlugin.getDefault().getBreakpointManager().getBreakpoints();
|
||||
for ( IBreakpoint bp : breakpoints ) {
|
||||
if ( bp instanceof ICLineBreakpoint ) {
|
||||
try {
|
||||
IAddress bpAddress = ((ICDebugTarget)instruction.getDebugTarget()).getBreakpointAddress( (ICLineBreakpoint)bp );
|
||||
if ( bpAddress != null && address.compareTo( bpAddress.getValue() ) == 0 )
|
||||
return bp;
|
||||
}
|
||||
catch( DebugException e ) {
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
Loading…
Add table
Reference in a new issue