Index:
ChangeLog =================================================================== RCS
file: /home/tools/org.eclipse.cdt.debug.ui/ChangeLog,v retrieving revision
1.68 diff -u -r1.68 ChangeLog --- ChangeLog 6 Jan 2003 22:12:04
-0000 1.68 +++ ChangeLog 10 Jan 2003 19:32:01 -0000 @@ -1,3
+1,25 @@ +2003-01-10 Mikhail Khodjaiants + Implementation of address
breakpoints. + * CDebugImages.java + *
CDTDebugModelPresentation.java + *
BreakpointLocationVerifier.java + *
CBreakpointPreferencePage.java + *
ManageBreakpointActionDelegate.java + *
ManageBreakpointRulerAction.java + *
ManageBreakpointRulerActionDelegate.java + *
DisassemblyDocumentProvider.java + * DisassemblyEditor.java + *
DisassemblyEditorInput.java + *
DisassemblyMarkerAnnotation.java + *
DisassemblyMarkerAnnotationModel.java + *
CDebugUIPlugin.java + * plugin.properties + *
plugin.xml + + New icons: + *
full/obj16/addrbrkp_obj.gif + *
full/obj16/addrbrkpd_obj.gif + 2003-01-06 Alain
Magloire * build.properties: Patch from Judy
Green. Index:
plugin.properties =================================================================== RCS
file: /home/tools/org.eclipse.cdt.debug.ui/plugin.properties,v retrieving
revision 1.25 diff -u -r1.25 plugin.properties ---
plugin.properties 19 Dec 2002 02:13:39 -0000 1.25 +++
plugin.properties 10 Jan 2003 19:32:18 -0000 @@ -48,3 +48,5
@@ CDebugActionGroup.name=C/C++
Debug SourcePropertyPage.name=Source
Lookup + +DisassemblyEditor.name=Disassembly Editor Index:
plugin.xml =================================================================== RCS
file: /home/tools/org.eclipse.cdt.debug.ui/plugin.xml,v retrieving revision
1.41 diff -u -r1.41 plugin.xml --- plugin.xml 3 Jan 2003 17:29:39
-0000 1.41 +++ plugin.xml 10 Jan 2003 19:32:44 -0000 @@ -720,5
+720,16
@@
id="org.eclipse.cdt.debug.ui.sourcelookup.SourcePropertyPage">
</page> </extension> +
<extension +
id="org.eclipse.cdt.debug.ui.editors" +
point="org.eclipse.ui.editors"> +
<editor +
name="%DisassemblyEditor.name" +
extensions="dasm" +
icon="icons/full/obj16/disassembly_obj.gif" +
class="org.eclipse.cdt.debug.internal.ui.editors.DisassemblyEditor" +
id="org.eclipse.cdt.debug.ui.DisassemblyEditor"> +
</editor> +
</extension> </plugin> Index:
plugin.xml =================================================================== RCS
file: /home/tools/org.eclipse.cdt.debug.ui/plugin.xml,v retrieving revision
1.41 diff -u -r1.41 plugin.xml --- plugin.xml 3 Jan 2003 17:29:39
-0000 1.41 +++ plugin.xml 10 Jan 2003 19:32:44 -0000 @@ -720,5
+720,16
@@
id="org.eclipse.cdt.debug.ui.sourcelookup.SourcePropertyPage">
</page> </extension> +
<extension +
id="org.eclipse.cdt.debug.ui.editors" +
point="org.eclipse.ui.editors"> +
<editor +
name="%DisassemblyEditor.name" +
extensions="dasm" +
icon="icons/full/obj16/disassembly_obj.gif" +
class="org.eclipse.cdt.debug.internal.ui.editors.DisassemblyEditor" +
id="org.eclipse.cdt.debug.ui.DisassemblyEditor"> +
</editor> +
</extension> </plugin>Index:
plugin.xml =================================================================== RCS
file: /home/tools/org.eclipse.cdt.debug.ui/plugin.xml,v retrieving revision
1.41 diff -u -r1.41 plugin.xml --- plugin.xml 3 Jan 2003 17:29:39
-0000 1.41 +++ plugin.xml 10 Jan 2003 19:32:44 -0000 @@ -720,5
+720,16
@@
id="org.eclipse.cdt.debug.ui.sourcelookup.SourcePropertyPage">
</page> </extension> +
<extension +
id="org.eclipse.cdt.debug.ui.editors" +
point="org.eclipse.ui.editors"> +
<editor +
name="%DisassemblyEditor.name" +
extensions="dasm" +
icon="icons/full/obj16/disassembly_obj.gif" +
class="org.eclipse.cdt.debug.internal.ui.editors.DisassemblyEditor" +
id="org.eclipse.cdt.debug.ui.DisassemblyEditor"> +
</editor> +
</extension> </plugin> Index:
plugin.xml =================================================================== RCS
file: /home/tools/org.eclipse.cdt.debug.ui/plugin.xml,v retrieving revision
1.41 diff -u -r1.41 plugin.xml --- plugin.xml 3 Jan 2003 17:29:39
-0000 1.41 +++ plugin.xml 10 Jan 2003 19:32:44 -0000 @@ -720,5
+720,16
@@
id="org.eclipse.cdt.debug.ui.sourcelookup.SourcePropertyPage">
</page> </extension> +
<extension +
id="org.eclipse.cdt.debug.ui.editors" +
point="org.eclipse.ui.editors"> +
<editor +
name="%DisassemblyEditor.name" +
extensions="dasm" +
icon="icons/full/obj16/disassembly_obj.gif" +
class="org.eclipse.cdt.debug.internal.ui.editors.DisassemblyEditor" +
id="org.eclipse.cdt.debug.ui.DisassemblyEditor"> +
</editor> +
</extension> </plugin>Index:
plugin.xml =================================================================== RCS
file: /home/tools/org.eclipse.cdt.debug.ui/plugin.xml,v retrieving revision
1.41 diff -u -r1.41 plugin.xml --- plugin.xml 3 Jan 2003 17:29:39
-0000 1.41 +++ plugin.xml 10 Jan 2003 19:32:44 -0000 @@ -720,5
+720,16
@@
id="org.eclipse.cdt.debug.ui.sourcelookup.SourcePropertyPage">
</page> </extension> +
<extension +
id="org.eclipse.cdt.debug.ui.editors" +
point="org.eclipse.ui.editors"> +
<editor +
name="%DisassemblyEditor.name" +
extensions="dasm" +
icon="icons/full/obj16/disassembly_obj.gif" +
class="org.eclipse.cdt.debug.internal.ui.editors.DisassemblyEditor" +
id="org.eclipse.cdt.debug.ui.DisassemblyEditor"> +
</editor> +
</extension> </plugin>
Index:
org/eclipse/cdt/debug/internal/ui/CDTDebugModelPresentation.java =================================================================== RCS
file:
/home/tools/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/CDTDebugModelPresentation.java,v retrieving
revision 1.30 diff -u -r1.30 CDTDebugModelPresentation.java ---
org/eclipse/cdt/debug/internal/ui/CDTDebugModelPresentation.java 10 Dec
2002 17:57:54 -0000 1.30 +++
org/eclipse/cdt/debug/internal/ui/CDTDebugModelPresentation.java 10 Jan
2003 19:33:57 -0000 @@ -25,9 +25,12 @@ import
org.eclipse.cdt.debug.core.model.ICValue; import
org.eclipse.cdt.debug.core.model.ICWatchpoint; import
org.eclipse.cdt.debug.core.model.IDummyStackFrame; +import
org.eclipse.cdt.debug.core.model.IExecFileInfo; import
org.eclipse.cdt.debug.core.model.IStackFrameInfo; import
org.eclipse.cdt.debug.core.model.IState; import
org.eclipse.cdt.debug.core.sourcelookup.IDisassemblyStorage; +import
org.eclipse.cdt.debug.internal.core.CDebugUtils; +import
org.eclipse.cdt.debug.internal.core.sourcelookup.DisassemblyManager; import
org.eclipse.cdt.debug.internal.ui.editors.DisassemblyEditorInput; import
org.eclipse.cdt.debug.ui.CDebugUIPlugin; import
org.eclipse.cdt.internal.ui.util.ExternalEditorInput; @@ -126,19 +129,24
@@ */ public IEditorInput getEditorInput( Object
element ) { - IFile file =
null; if ( element instanceof IMarker
) { IResource resource =
((IMarker)element).getResource(); if ( resource
instanceof IFile ) - file = (IFile)resource;
+ return new FileEditorInput( (IFile)resource );
} if ( element instanceof IFile
) - file =
(IFile)element; + { + return new
FileEditorInput( (IFile)element ); + } + if (
element instanceof ICAddressBreakpoint
) + { + return getDisassemblyEditorInput(
(ICAddressBreakpoint)element ); + } if (
element instanceof ICLineBreakpoint ) - file =
(IFile)((ICLineBreakpoint)element).getMarker().getResource().getAdapter(
IFile.class ); - if ( file != null ) - return
new FileEditorInput( file ); + { + return new
FileEditorInput(
(IFile)((ICLineBreakpoint)element).getMarker().getResource().getAdapter(
IFile.class ) ); + } if ( element instanceof
FileStorage ) { return new
ExternalEditorInput( (IStorage)element ); @@ -491,6 +499,10
@@ protected Image getBreakpointImage( ICBreakpoint
breakpoint ) throws CoreException { + if (
breakpoint instanceof ICAddressBreakpoint
) + { + return getAddressBreakpointImage(
(ICAddressBreakpoint)breakpoint ); + } if (
breakpoint instanceof ICLineBreakpoint
) { return
getLineBreakpointImage( (ICLineBreakpoint)breakpoint ); @@ -517,6 +529,21
@@ return fDebugImageRegistry.get( descriptor
); } + protected Image
getAddressBreakpointImage( ICAddressBreakpoint breakpoint ) throws
CoreException + { + int flags =
computeBreakpointAdornmentFlags( breakpoint ); + CImageDescriptor
descriptor = null; + if ( breakpoint.isEnabled()
) + { + descriptor = new CImageDescriptor(
CDebugImages.DESC_OBJS_ADDRESS_BREAKPOINT_ENABLED, flags
); + } + else + { + descriptor
= new CImageDescriptor(
CDebugImages.DESC_OBJS_ADDRESS_BREAKPOINT_DISABLED, flags
); + } + return fDebugImageRegistry.get( descriptor
); + } + protected Image getWatchpointImage(
ICWatchpoint watchpoint ) throws
CoreException { int flags =
computeBreakpointAdornmentFlags( watchpoint ); @@ -549,15 +576,14
@@ protected String getBreakpointText( IBreakpoint
breakpoint, boolean qualified ) throws
CoreException { - - if ( breakpoint instanceof
ICLineBreakpoint ) - { - return
getLineBreakpointText( (ICLineBreakpoint)breakpoint, qualified
); - } if ( breakpoint instanceof
ICAddressBreakpoint ) { return
getAddressBreakpointText( (ICAddressBreakpoint)breakpoint, qualified
); } + if ( breakpoint instanceof
ICLineBreakpoint ) + { + return
getLineBreakpointText( (ICLineBreakpoint)breakpoint, qualified
); + } if ( breakpoint instanceof
ICFunctionBreakpoint ) { return
getFunctionBreakpointText( (ICFunctionBreakpoint)breakpoint, qualified ); @@
-591,7 +617,12 @@ protected String
getAddressBreakpointText( ICAddressBreakpoint breakpoint, boolean qualified )
throws CoreException { - return
null; + StringBuffer label = new
StringBuffer(); + appendResourceName( breakpoint, label, qualified
); + appendAddress( breakpoint, label
); + appendIgnoreCount( breakpoint, label
); + appendCondition( breakpoint, label ); + return
label.toString(); } protected String
getFunctionBreakpointText( ICFunctionBreakpoint breakpoint, boolean qualified )
throws CoreException @@ -605,7 +636,7 @@ if (
!path.isEmpty() ) label.append( qualified ?
path.toOSString() : path.lastSegment() ); return
label; -} + } protected StringBuffer
appendLineNumber( ICLineBreakpoint breakpoint, StringBuffer label ) throws
CoreException { @@ -621,6 +652,21
@@ return
label; } + protected StringBuffer
appendAddress( ICAddressBreakpoint breakpoint, StringBuffer label ) throws
CoreException + { + try + { + long
address = Long.parseLong( breakpoint.getAddress()
); + label.append( " [address: "
); + label.append( CDebugUtils.toHexAddressString( address )
); + label.append( ']'
); + } + catch( NumberFormatException e
) + { + } + return
label; + } + protected StringBuffer appendIgnoreCount(
ICBreakpoint breakpoint, StringBuffer label ) throws
CoreException { int ignoreCount =
breakpoint.getIgnoreCount(); @@ -722,5 +768,34 @@ protected
Image getExpressionImage( IExpression element ) throws
DebugException { return
fDebugImageRegistry.get( new CImageDescriptor( DebugUITools.getImageDescriptor(
IDebugUIConstants.IMG_OBJS_EXPRESSION ), 0 )
); + } + + protected DisassemblyEditorInput
getDisassemblyEditorInput( ICAddressBreakpoint breakpoint
) + { + IDebugTarget[] targets =
DebugPlugin.getDefault().getLaunchManager().getDebugTargets(); + for
( int i = 0; i < targets.length; ++i
) + { + IResource resource =
breakpoint.getMarker().getResource(); + if ( resource !=
null && resource instanceof IFile &&
+ targets[i].getAdapter( IExecFileInfo.class )!=
null && +
((IFile)resource).getLocation().toOSString().equals(
((IExecFileInfo)targets[i].getAdapter( IExecFileInfo.class
)).getExecFile().getLocation().toOSString() )
) + { + if (
targets[i].getAdapter( DisassemblyManager.class ) != null
) + { + try + { + long
address = Long.parseLong( breakpoint.getAddress()
); + return new DisassemblyEditorInput(
(IStorage)(((DisassemblyManager)targets[i].getAdapter( DisassemblyManager.class
)).getSourceElement( address ) )
); + } + catch(
NumberFormatException e
) + { + } + catch(
CoreException e
) + { + } + } + } + } + return
null; } } Index:
org/eclipse/cdt/debug/internal/ui/CDebugImages.java =================================================================== RCS
file:
/home/tools/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/CDebugImages.java,v retrieving
revision 1.11 diff -u -r1.11 CDebugImages.java ---
org/eclipse/cdt/debug/internal/ui/CDebugImages.java 30 Dec 2002 00:07:15
-0000 1.11 +++
org/eclipse/cdt/debug/internal/ui/CDebugImages.java 10 Jan 2003 19:33:58
-0000 @@ -48,6 +48,8 @@ */ public static
final String IMG_OBJS_BREAKPOINT_INSTALLED = NAME_PREFIX + "installed_ovr.gif";
//$NON-NLS-1$ public static final String
IMG_OBJS_BREAKPOINT_INSTALLED_DISABLED = NAME_PREFIX +
"installed_ovr_disabled.gif"; //$NON-NLS-1$ + public static final String
IMG_OBJS_ADDRESS_BREAKPOINT_ENABLED = NAME_PREFIX +
"addrbrkp_obj.gif"; //$NON-NLS-1$ + public static final String
IMG_OBJS_ADDRESS_BREAKPOINT_DISABLED = NAME_PREFIX +
"addrbrkpd_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$ @@ -93,6 +95,8
@@ public static final ImageDescriptor
DESC_OBJS_BREAKPOINT_INSTALLED = createManaged( T_OVR,
IMG_OBJS_BREAKPOINT_INSTALLED ); public static final
ImageDescriptor DESC_OBJS_BREAKPOINT_INSTALLED_DISABLED = createManaged( T_OVR,
IMG_OBJS_BREAKPOINT_INSTALLED_DISABLED ); + public static final
ImageDescriptor DESC_OBJS_ADDRESS_BREAKPOINT_ENABLED = createManaged( T_OBJ,
IMG_OBJS_ADDRESS_BREAKPOINT_ENABLED ); + public static final
ImageDescriptor DESC_OBJS_ADDRESS_BREAKPOINT_DISABLED = createManaged( T_OBJ,
IMG_OBJS_ADDRESS_BREAKPOINT_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 ); Index:
org/eclipse/cdt/debug/internal/ui/actions/BreakpointLocationVerifier.java =================================================================== RCS
file:
/home/tools/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/BreakpointLocationVerifier.java,v retrieving
revision 1.1 diff -u -r1.1 BreakpointLocationVerifier.java ---
org/eclipse/cdt/debug/internal/ui/actions/BreakpointLocationVerifier.java 30
Aug 2002 23:30:27 -0000 1.1 +++
org/eclipse/cdt/debug/internal/ui/actions/BreakpointLocationVerifier.java 10
Jan 2003 19:33:58 -0000 @@ -20,9 +20,15 @@ * valid location
for a breakpoint in the given document, or -1 if a valid
location * cannot be found. */ - public
int getValidBreakpointLocation( IDocument doc, int lineNumber )
+ public int getValidLineBreakpointLocation( IDocument doc, int
lineNumber ) { // for
now return lineNumber +
1; + } + + public int getValidAddressBreakpointLocation(
IDocument doc, int lineNumber ) + { + // for
now + return lineNumber; } } Index:
org/eclipse/cdt/debug/internal/ui/actions/CBreakpointPreferencePage.java =================================================================== RCS
file:
/home/tools/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/CBreakpointPreferencePage.java,v retrieving
revision 1.5 diff -u -r1.5 CBreakpointPreferencePage.java ---
org/eclipse/cdt/debug/internal/ui/actions/CBreakpointPreferencePage.java 2
Dec 2002 23:22:19 -0000 1.5 +++
org/eclipse/cdt/debug/internal/ui/actions/CBreakpointPreferencePage.java 10
Jan 2003 19:33:58 -0000 @@ -5,8 +5,10 @@ */ package
org.eclipse.cdt.debug.internal.ui.actions; +import
org.eclipse.cdt.debug.core.model.ICAddressBreakpoint; import
org.eclipse.cdt.debug.core.model.ICBreakpoint; import
org.eclipse.cdt.debug.core.model.ICWatchpoint; +import
org.eclipse.cdt.debug.internal.core.CDebugUtils; import
org.eclipse.cdt.debug.ui.CDebugUIPlugin; import
org.eclipse.core.runtime.CoreException; import
org.eclipse.debug.core.model.ILineBreakpoint; @@ -287,7 +289,27
@@ */ private void
createTypeSpecificLabelFieldEditors( ICBreakpoint breakpoint
) { - if ( breakpoint instanceof ILineBreakpoint
) + if ( breakpoint instanceof ICAddressBreakpoint
) + { + ICAddressBreakpoint abrkpt =
(ICAddressBreakpoint)breakpoint; + String address = "Not
available"; + try + { + address
= CDebugUtils.toHexAddressString( Long.parseLong( abrkpt.getAddress() )
); + } + catch( CoreException e
) + { + } + catch(
NumberFormatException e
) + { + } + if (
address != null ) + { + addField(
createLabelEditor( getFieldEditorParent(), "Address: ", address )
); + } + setTitle( "C/C++ Address
Breakpoint Properties" ); + } + else if ( breakpoint
instanceof ILineBreakpoint
) { String fileName =
breakpoint.getMarker().getResource().getLocation().toOSString(); if
( fileName != null ) Index:
org/eclipse/cdt/debug/internal/ui/actions/ManageBreakpointActionDelegate.java =================================================================== RCS
file:
/home/tools/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/ManageBreakpointActionDelegate.java,v retrieving
revision 1.3 diff -u -r1.3 ManageBreakpointActionDelegate.java ---
org/eclipse/cdt/debug/internal/ui/actions/ManageBreakpointActionDelegate.java 2
Dec 2002 23:22:19 -0000 1.3 +++
org/eclipse/cdt/debug/internal/ui/actions/ManageBreakpointActionDelegate.java 10
Jan 2003 19:33:58 -0000 @@ -195,7 +195,7
@@ return; IDocument
document = getTextEditor().getDocumentProvider().getDocument( editorInput
); BreakpointLocationVerifier bv = new
BreakpointLocationVerifier(); - int lineNumber =
bv.getValidBreakpointLocation( document,
((ITextSelection)selection).getStartLine()); + int
lineNumber = bv.getValidLineBreakpointLocation( document,
((ITextSelection)selection).getStartLine()); if (
lineNumber > -1
) { try Index:
org/eclipse/cdt/debug/internal/ui/actions/ManageBreakpointRulerAction.java =================================================================== RCS
file:
/home/tools/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/ManageBreakpointRulerAction.java,v retrieving
revision 1.3 diff -u -r1.3 ManageBreakpointRulerAction.java ---
org/eclipse/cdt/debug/internal/ui/actions/ManageBreakpointRulerAction.java 2
Oct 2002 19:37:11 -0000 1.3 +++
org/eclipse/cdt/debug/internal/ui/actions/ManageBreakpointRulerAction.java 10
Jan 2003 19:33:58 -0000 @@ -10,6 +10,8 @@ import
java.util.List; import
org.eclipse.cdt.debug.core.CDebugModel; +import
org.eclipse.cdt.debug.core.sourcelookup.IDisassemblyStorage; +import
org.eclipse.cdt.debug.internal.ui.editors.DisassemblyEditorInput; import
org.eclipse.cdt.debug.ui.CDebugUIPlugin; import
org.eclipse.core.resources.IFile; import
org.eclipse.core.resources.IMarker; @@ -102,7 +104,7
@@ try { IMarker[]
markers = null; - if ( resource instanceof IFile
) + if ( resource instanceof IFile &&
!(getTextEditor().getEditorInput() instanceof DisassemblyEditorInput)
) { markers
= resource.findMarkers(
IBreakpoint.BREAKPOINT_MARKER, true, @@
-229,31 +231,16 @@ protected void
addMarker() { IEditorInput editorInput =
getTextEditor().getEditorInput(); - IDocument document =
getDocument(); int rulerLine =
getVerticalRulerInfo().getLineOfLastMouseButtonActivity(); try { - BreakpointLocationVerifier
bv = new BreakpointLocationVerifier(); - int lineNumber =
bv.getValidBreakpointLocation( document, rulerLine ); - if (
lineNumber > 0 ) + if ( editorInput instanceof
IFileEditorInput
) { - String fileName =
null; - if ( editorInput instanceof IFileEditorInput
) - { - fileName =
((IFileEditorInput)editorInput).getFile().getLocation().toString(); - } - if
( fileName != null
) - { - if (
CDebugModel.lineBreakpointExists( fileName, lineNumber ) == null
) - { - CDebugModel.createLineBreakpoint(
((IFileEditorInput)editorInput).getFile(), -
lineNumber, -
true, -
0, -
"", -
true
); - } - } + createLineBreakpoint(
(IFileEditorInput)editorInput, rulerLine
); + } + else if (
editorInput.getAdapter( DisassemblyEditorInput.class ) != null
) + { + createAddressBreakpoint(
(DisassemblyEditorInput)editorInput.getAdapter( DisassemblyEditorInput.class ),
rulerLine
); } } catch(
DebugException e ) @@ -263,6 +250,46 @@ catch(
CoreException e
) { CDebugUIPlugin.errorDialog(
"Cannot add breakpoint", e
); + } + } + + private void
createLineBreakpoint( IFileEditorInput editorInput, int rulerLine ) throws
CoreException + { + IDocument document =
getDocument(); + BreakpointLocationVerifier bv = new
BreakpointLocationVerifier(); + int lineNumber =
bv.getValidLineBreakpointLocation( document, rulerLine ); + if (
lineNumber > -1 ) + { + String fileName =
editorInput.getFile().getLocation().toString(); + if (
fileName != null ) + { + if (
CDebugModel.lineBreakpointExists( fileName, lineNumber ) == null
) + { + CDebugModel.createLineBreakpoint(
editorInput.getFile(), lineNumber, true, 0, "", true
); + } + } + } + } + + private
void createAddressBreakpoint( DisassemblyEditorInput editorInput, int rulerLine
) throws CoreException + { + IDocument document =
getDocument(); + BreakpointLocationVerifier bv = new
BreakpointLocationVerifier(); + int lineNumber =
bv.getValidAddressBreakpointLocation( document, rulerLine ); + if
( lineNumber > -1 ) + { + IResource
resource = (IResource)editorInput.getAdapter( IResource.class
); + if ( resource != null
) + { + if (
editorInput.getStorage() != null
) + { + long address =
((IDisassemblyStorage)editorInput.getStorage()).getAddress( lineNumber
); + if ( address != 0 &&
CDebugModel.addressBreakpointExists( resource, address ) == null
) + { + CDebugModel.createAddressBreakpoint(
resource, lineNumber, address, true, 0, "", true
); + } + } + } } } Index:
org/eclipse/cdt/debug/internal/ui/actions/ManageBreakpointRulerActionDelegate.java =================================================================== RCS
file:
/home/tools/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/ManageBreakpointRulerActionDelegate.java,v retrieving
revision 1.4 diff -u -r1.4 ManageBreakpointRulerActionDelegate.java ---
org/eclipse/cdt/debug/internal/ui/actions/ManageBreakpointRulerActionDelegate.java 2
Dec 2002 02:44:21 -0000 1.4 +++
org/eclipse/cdt/debug/internal/ui/actions/ManageBreakpointRulerActionDelegate.java 10
Jan 2003 19:33:58 -0000 @@ -22,6 +22,7 @@ { static
final private String C_EDITOR_ID = "org.eclipse.cdt.ui.editor.CEditor";
//$NON-NLS-1$ static final private String ASM_EDITOR_ID =
"org.eclipse.cdt.ui.editor.asm.AsmEditor"; //$NON-NLS-1$ + static final
private String DISASSEMBLY_EDITOR_ID =
"org.eclipse.cdt.debug.ui.DisassemblyEditor";
//$NON-NLS-1$ /** * @see
IEditorActionDelegate#setActiveEditor(IAction, IEditorPart) @@ -31,7 +32,7
@@ if ( targetEditor != null
) { String id =
targetEditor.getSite().getId(); - if ( !id.equals(
C_EDITOR_ID ) && !id.equals( ASM_EDITOR_ID ) ) + if
( !id.equals( C_EDITOR_ID ) && !id.equals( ASM_EDITOR_ID ) &&
!id.equals( DISASSEMBLY_EDITOR_ID )
) targetEditor =
null; } super.setActiveEditor(
callerAction, targetEditor ); Index:
org/eclipse/cdt/debug/internal/ui/editors/DisassemblyDocumentProvider.java =================================================================== RCS
file:
org/eclipse/cdt/debug/internal/ui/editors/DisassemblyDocumentProvider.java diff
-N
org/eclipse/cdt/debug/internal/ui/editors/DisassemblyDocumentProvider.java ---
/dev/null 1 Jan 1970 00:00:00 -0000 +++
org/eclipse/cdt/debug/internal/ui/editors/DisassemblyDocumentProvider.java 10
Jan 2003 19:33:58 -0000 @@ -0,0 +1,44 @@ +/* + *(c) Copyright QNX
Software Systems Ltd. 2002. + * All Rights Reserved. + * +
*/ +package org.eclipse.cdt.debug.internal.ui.editors; + +import
org.eclipse.cdt.debug.core.sourcelookup.IDisassemblyStorage; +import
org.eclipse.core.resources.IResource; +import
org.eclipse.core.resources.IStorage; +import
org.eclipse.core.runtime.CoreException; +import
org.eclipse.jface.text.source.IAnnotationModel; +import
org.eclipse.ui.editors.text.StorageDocumentProvider; + +/** + * Enter
type comment. + * + * @since: Jan 6, 2003 + */ +public class
DisassemblyDocumentProvider extends
StorageDocumentProvider +{ + /** + * Constructor for
DisassemblyDocumentProvider. + */ + public
DisassemblyDocumentProvider() + { + super(); + } + + /*
(non-Javadoc) + * @see
org.eclipse.ui.texteditor.AbstractDocumentProvider#createAnnotationModel(Object) +
*/ + protected IAnnotationModel createAnnotationModel( Object element )
throws CoreException + { + if ( element != null &&
element instanceof DisassemblyEditorInput )
+ { + IResource resource =
(IResource)((DisassemblyEditorInput)element).getAdapter( IResource.class
); + IStorage storage =
((DisassemblyEditorInput)element).getStorage(); + if (
resource != null && storage != null && storage instanceof
IDisassemblyStorage ) + return new
DisassemblyMarkerAnnotationModel( (IDisassemblyStorage)storage, resource
); + } + return super.createAnnotationModel( element
); + } +} Index:
org/eclipse/cdt/debug/internal/ui/editors/DisassemblyEditor.java =================================================================== RCS
file: org/eclipse/cdt/debug/internal/ui/editors/DisassemblyEditor.java diff
-N org/eclipse/cdt/debug/internal/ui/editors/DisassemblyEditor.java ---
/dev/null 1 Jan 1970 00:00:00 -0000 +++
org/eclipse/cdt/debug/internal/ui/editors/DisassemblyEditor.java 10 Jan
2003 19:33:58 -0000 @@ -0,0 +1,26 @@ +/* + *(c) Copyright QNX Software
Systems Ltd. 2002. + * All Rights Reserved. + * + */ +package
org.eclipse.cdt.debug.internal.ui.editors; + +import
org.eclipse.cdt.debug.ui.CDebugUIPlugin; +import
org.eclipse.cdt.internal.ui.editor.asm.AsmTextEditor; + +/** + * Enter
type comment. + * + * @since: Jan 6, 2003 + */ +public class
DisassemblyEditor extends AsmTextEditor +{ + /** + *
Constructor for DisassemblyEditor. + */ + public
DisassemblyEditor() + { + super(); + setDocumentProvider(
CDebugUIPlugin.getDefault().getDisassemblyDocumentProvider()
); + } +} Index:
org/eclipse/cdt/debug/internal/ui/editors/DisassemblyEditorInput.java =================================================================== RCS
file:
/home/tools/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/editors/DisassemblyEditorInput.java,v retrieving
revision 1.3 diff -u -r1.3 DisassemblyEditorInput.java ---
org/eclipse/cdt/debug/internal/ui/editors/DisassemblyEditorInput.java 2 Jan
2003 21:01:09 -0000 1.3 +++
org/eclipse/cdt/debug/internal/ui/editors/DisassemblyEditorInput.java 10
Jan 2003 19:33:58 -0000 @@ -21,7 +21,7 @@ */ public class
DisassemblyEditorInput implements
IStorageEditorInput { - private final static String
FILE_NAME_EXTENSION = ".s"; + private final static String
FILE_NAME_EXTENSION = ".dasm"; protected IStorage
fStorage; /** @@ -110,6 +110,10
@@ { //
ignore } + } + if (
adapter.equals( DisassemblyEditorInput.class )
) + { + return
this; } return
null; } Index:
org/eclipse/cdt/debug/internal/ui/editors/DisassemblyMarkerAnnotation.java =================================================================== RCS
file:
org/eclipse/cdt/debug/internal/ui/editors/DisassemblyMarkerAnnotation.java diff
-N
org/eclipse/cdt/debug/internal/ui/editors/DisassemblyMarkerAnnotation.java ---
/dev/null 1 Jan 1970 00:00:00 -0000 +++
org/eclipse/cdt/debug/internal/ui/editors/DisassemblyMarkerAnnotation.java 10
Jan 2003 19:33:58 -0000 @@ -0,0 +1,53 @@ +/* + *(c) Copyright QNX
Software Systems Ltd. 2002. + * All Rights Reserved. + * +
*/ +package org.eclipse.cdt.debug.internal.ui.editors; + +import
org.eclipse.cdt.debug.internal.core.breakpoints.CAddressBreakpoint; +import
org.eclipse.cdt.debug.internal.core.breakpoints.CLineBreakpoint; +import
org.eclipse.core.resources.IMarker; +import
org.eclipse.debug.ui.DebugUITools; +import
org.eclipse.debug.ui.IDebugModelPresentation; +import
org.eclipse.ui.texteditor.MarkerAnnotation; +import
org.eclipse.ui.texteditor.MarkerUtilities; + +/** + * Enter type
comment. + * + * @since: Jan 6, 2003 + */ +public class
DisassemblyMarkerAnnotation extends MarkerAnnotation +{ + private
IDebugModelPresentation fPresentation; + + /** + *
Constructor for DisassemblyMarkerAnnotation. + * @param
marker + */ + public DisassemblyMarkerAnnotation( IMarker
marker ) + { + super( marker
); + } + + /* (non-Javadoc) + * @see
org.eclipse.ui.texteditor.MarkerAnnotation#initialize() +
*/ + protected void initialize() + { + IMarker
marker = getMarker(); + + if ( MarkerUtilities.isMarkerType(
marker, CLineBreakpoint.getMarkerType() ) || +
MarkerUtilities.isMarkerType( marker, CAddressBreakpoint.getMarkerType() )
) + { + if ( fPresentation == null
) + fPresentation =
DebugUITools.newDebugModelPresentation(); + + setLayer( 4
); + setImage( fPresentation.getImage( marker )
); + return; + } + super.initialize(); + } +} Index:
org/eclipse/cdt/debug/internal/ui/editors/DisassemblyMarkerAnnotationModel.java =================================================================== RCS
file:
org/eclipse/cdt/debug/internal/ui/editors/DisassemblyMarkerAnnotationModel.java diff
-N
org/eclipse/cdt/debug/internal/ui/editors/DisassemblyMarkerAnnotationModel.java ---
/dev/null 1 Jan 1970 00:00:00 -0000 +++
org/eclipse/cdt/debug/internal/ui/editors/DisassemblyMarkerAnnotationModel.java 10
Jan 2003 19:33:58 -0000 @@ -0,0 +1,310 @@ +/* + *(c) Copyright QNX
Software Systems Ltd. 2002. + * All Rights Reserved. + * +
*/ +package org.eclipse.cdt.debug.internal.ui.editors; + +import
java.util.ArrayList; + +import
org.eclipse.cdt.debug.core.ICBreakpointManager; +import
org.eclipse.cdt.debug.core.model.ICAddressBreakpoint; +import
org.eclipse.cdt.debug.core.sourcelookup.IDisassemblyStorage; +import
org.eclipse.cdt.debug.internal.core.breakpoints.CAddressBreakpoint; +import
org.eclipse.cdt.debug.internal.core.breakpoints.CLineBreakpoint; +import
org.eclipse.core.resources.IFile; +import
org.eclipse.core.resources.IMarker; +import
org.eclipse.core.resources.IMarkerDelta; +import
org.eclipse.core.resources.IResource; +import
org.eclipse.core.resources.IResourceChangeEvent; +import
org.eclipse.core.resources.IResourceChangeListener; +import
org.eclipse.core.resources.IResourceDelta; +import
org.eclipse.core.resources.IResourceDeltaVisitor; +import
org.eclipse.core.resources.IWorkspace; +import
org.eclipse.core.resources.IWorkspaceRunnable; +import
org.eclipse.core.runtime.CoreException; +import
org.eclipse.core.runtime.IProgressMonitor; +import
org.eclipse.debug.core.DebugPlugin; +import
org.eclipse.debug.core.IBreakpointManager; +import
org.eclipse.debug.core.model.IBreakpoint; +import
org.eclipse.debug.core.model.IDebugTarget; +import
org.eclipse.jface.text.BadLocationException; +import
org.eclipse.jface.text.Position; +import
org.eclipse.ui.texteditor.AbstractMarkerAnnotationModel; +import
org.eclipse.ui.texteditor.MarkerAnnotation; + +/** + * Enter type
comment. + * + * @since: Jan 9, 2003 + */ +public class
DisassemblyMarkerAnnotationModel extends
AbstractMarkerAnnotationModel +{ + /** + * Internal resource
change listener. + */ + class ResourceChangeListener implements
IResourceChangeListener + { + /* + * @see
IResourceChangeListener#resourceChanged +
*/ + public void resourceChanged( IResourceChangeEvent e
) + { + IResourceDelta delta =
e.getDelta(); + try + { + if
( delta != null ) + delta.accept(
getResourceDeltaVisitor()
); + } + catch( CoreException x
) + { + doHandleCoreException( x,
"Resource Changed"
); + } + } + }; + + /** +
* Internal resource delta visitor. + */ + class
ResourceDeltaVisitor implements
IResourceDeltaVisitor + { + /* + * @see
IResourceDeltaVisitor#visit + */ + public boolean
visit( IResourceDelta delta ) throws
CoreException + { + if ( delta != null
&& /*getResource().equals( delta.getResource() )*/delta.getResource()
instanceof IFile ) + { + update(
delta.getMarkerDeltas() ); + return
false; + } + return
true; + } + }; + + /** The workspace
*/ + private IWorkspace fWorkspace; + + /** The resource
*/ + private IResource fResource; + + /** The resource change
listener */ + private IResourceChangeListener fResourceChangeListener =
new ResourceChangeListener(); + + /** The resource delta visitor
*/ + private IResourceDeltaVisitor fResourceDeltaVisitor = new
ResourceDeltaVisitor(); + + private IDisassemblyStorage fStorage =
null; + + /** + * Constructor for
DisassemblyMarkerAnnotationModel. + */ + public
DisassemblyMarkerAnnotationModel( IDisassemblyStorage storage, IResource
resource ) + { + fResource =
resource; + fWorkspace =
resource.getWorkspace(); + fStorage =
storage; + } + + /* (non-Javadoc) + * @see
org.eclipse.ui.texteditor.AbstractMarkerAnnotationModel#retrieveMarkers() +
*/ + protected IMarker[] retrieveMarkers() throws
CoreException + { + if ( fStorage == null
) + return null; + IDebugTarget target =
fStorage.getDebugTarget(); + if ( target != null
) + { + IBreakpointManager bm =
DebugPlugin.getDefault().getBreakpointManager(); + IBreakpoint[]
brkpts = bm.getBreakpoints(); + ArrayList list = new
ArrayList( brkpts.length ); + for ( int i = 0; i <
brkpts.length; ++i ) + { + if (
target.supportsBreakpoint( brkpts[i] ) && isAcceptable(
brkpts[i].getMarker() )
) + { + list.add(
brkpts[i].getMarker()
); + } + } + return
(IMarker[])list.toArray( new IMarker[list.size()]
); + } + return null; + } + + /*
(non-Javadoc) + * @see
org.eclipse.ui.texteditor.AbstractMarkerAnnotationModel#deleteMarkers(IMarker[]) +
*/ + protected void deleteMarkers( final IMarker[] markers ) throws
CoreException + { + fWorkspace.run( new
IWorkspaceRunnable() + { + public
void run( IProgressMonitor monitor ) throws
CoreException + { + for
( int i = 0; i < markers.length; ++i
) + { + markers[i].delete(); + } + } + },
null ); + } + + /* (non-Javadoc) + * @see
org.eclipse.ui.texteditor.AbstractMarkerAnnotationModel#listenToMarkerChanges(boolean) +
*/ + protected void listenToMarkerChanges( boolean listen
) + { + if ( listen
) + fWorkspace.addResourceChangeListener(
fResourceChangeListener
); + else + fWorkspace.removeResourceChangeListener(
fResourceChangeListener ); + } + + /*
(non-Javadoc) + * @see
org.eclipse.ui.texteditor.AbstractMarkerAnnotationModel#isAcceptable(IMarker) +
*/ + protected boolean isAcceptable( IMarker marker
) + { + try + { + return
( marker.getType().equals( CLineBreakpoint.getMarkerType() )
|| + marker.getType().equals(
CAddressBreakpoint.getMarkerType() ) ); + } + catch(
CoreException e ) + { + } + return
false; + } + + protected IResourceDeltaVisitor
getResourceDeltaVisitor() + { + return
fResourceDeltaVisitor; + } + + /** + * Updates this
model to the given marker deltas. + * + * @param markerDeltas
the list of marker deltas + */ + protected void update(
IMarkerDelta[] markerDeltas ) + { + if (
markerDeltas.length == 0
) + return; + + for( int i = 0; i <
markerDeltas.length; i++ ) + { + IMarkerDelta
delta = markerDeltas[i]; + switch( delta.getKind()
) + { + case IResourceDelta.ADDED
: + addMarkerAnnotation( delta.getMarker()
); + break; + case
IResourceDelta.REMOVED
: + removeMarkerAnnotation( delta.getMarker()
); + break; + case
IResourceDelta.CHANGED
: + modifyMarkerAnnotation( delta.getMarker()
); + break; + } + } + + fireModelChanged(); + } + + /*
(non-Javadoc) + * @see
org.eclipse.ui.texteditor.AbstractMarkerAnnotationModel#createPositionFromMarker(IMarker) +
*/ + protected Position createPositionFromMarker( IMarker marker
) + { + try + { + if (
marker.getType().equals( CLineBreakpoint.getMarkerType() )
) + { + return
createPositionFromLineBreakpoint( marker
); + } + if ( marker.getType().equals(
CAddressBreakpoint.getMarkerType() )
) + { + return
createPositionFromAddressBreakpoint( marker
); + } + } + catch(
CoreException e ) + { + } + return
null; + } + + private Position
createPositionFromLineBreakpoint( IMarker marker
) + { + if ( fStorage == null
) + return null; + IDebugTarget target =
fStorage.getDebugTarget(); + if ( target != null &&
target.getAdapter( ICBreakpointManager.class ) != null
) + { + ICBreakpointManager bm =
(ICBreakpointManager)target.getAdapter( ICBreakpointManager.class
); + long address = bm.getBreakpointAddress(
DebugPlugin.getDefault().getBreakpointManager().getBreakpoint( marker )
); + if ( address != 0
) + { + return
createPositionFromAddress( address
); + } + } + return
null; + } + + private Position
createPositionFromAddressBreakpoint( IMarker marker ) throws
CoreException + { + try + { + return
createPositionFromAddress( Long.parseLong( marker.getAttribute(
ICAddressBreakpoint.ADDRESS, "0" ) ) ); + } + catch(
NumberFormatException e
) + { + } + return
null; + } + + private Position createPositionFromAddress(
long address
) + { + try + { + int
start = -1; + int line = fStorage.getLineNumber( address
); + if ( line > 0 && fDocument != null )
+ { + start =
fDocument.getLineOffset( line - 1 ); + if ( start >
-1 ) + { + return new
Position( start, fDocument.getLineLength( line - 1 )
); + } + } + } + catch
( BadLocationException x )
+ { + } + return
null; + } + + /* (non-Javadoc) + * @see
org.eclipse.ui.texteditor.AbstractMarkerAnnotationModel#createMarkerAnnotation(IMarker) +
*/ + protected MarkerAnnotation createMarkerAnnotation( IMarker marker
) + { + return new DisassemblyMarkerAnnotation( marker
); + } + + /* (non-Javadoc) + * @see
org.eclipse.ui.texteditor.AbstractMarkerAnnotationModel#getMarkerPosition(IMarker) +
*/ + public Position getMarkerPosition( IMarker marker
) + { + return createPositionFromMarker( marker
); + } + + protected void doHandleCoreException(
CoreException e, String message
) + { + handleCoreException( e, message
); + } + + protected IResource
getResource() + { + return
fResource; + } +} Index:
org/eclipse/cdt/debug/ui/CDebugUIPlugin.java =================================================================== RCS
file:
/home/tools/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/CDebugUIPlugin.java,v retrieving
revision 1.15 diff -u -r1.15 CDebugUIPlugin.java ---
org/eclipse/cdt/debug/ui/CDebugUIPlugin.java 2 Dec 2002 23:22:19
-0000 1.15 +++ org/eclipse/cdt/debug/ui/CDebugUIPlugin.java 10 Jan
2003 19:33:59 -0000 @@ -11,6 +11,7 @@ import
org.eclipse.cdt.debug.internal.ui.CDTDebugModelPresentation; import
org.eclipse.cdt.debug.internal.ui.CDebugImageDescriptorRegistry; import
org.eclipse.cdt.debug.internal.ui.ColorManager; +import
org.eclipse.cdt.debug.internal.ui.editors.DisassemblyDocumentProvider; import
org.eclipse.cdt.debug.internal.ui.editors.DisassemblyEditorInput; import
org.eclipse.cdt.debug.internal.ui.preferences.CDebugPreferencePage; import
org.eclipse.cdt.debug.internal.ui.preferences.MemoryViewPreferencePage; @@
-65,6 +66,9 @@ private CDebugImageDescriptorRegistry
fImageDescriptorRegistry; + // Document provider for
disassembly editor + private DisassemblyDocumentProvider
fDisassemblyDocumentProvider = null; + /** *
The constructor. */ @@ -461,5 +465,15
@@ } } return
false; + } + + /** + * Returns the document provider
used for the disassembly editor + */ + public
DisassemblyDocumentProvider getDisassemblyDocumentProvider()
+ { + if ( fDisassemblyDocumentProvider == null
) + fDisassemblyDocumentProvider = new
DisassemblyDocumentProvider(); + return
fDisassemblyDocumentProvider; } } Index:
full/obj16/addrbrkp_obj.gif =================================================================== RCS
file: full/obj16/addrbrkp_obj.gif diff -N
full/obj16/addrbrkp_obj.gif Binary files /dev/null and addrbrkp_obj.gif
differ Index:
full/obj16/addrbrkpd_obj.gif =================================================================== RCS
file: full/obj16/addrbrkpd_obj.gif diff -N
full/obj16/addrbrkpd_obj.gif Binary files /dev/null and addrbrkpd_obj.gif
differ
|