diff --git a/debug/org.eclipse.cdt.debug.core/ChangeLog b/debug/org.eclipse.cdt.debug.core/ChangeLog index f923c97f656..4c26875664f 100644 --- a/debug/org.eclipse.cdt.debug.core/ChangeLog +++ b/debug/org.eclipse.cdt.debug.core/ChangeLog @@ -1,3 +1,15 @@ +2005-06-29 Mikhail Khodjaiants + Bug 41725: I can't set a breakpoint in a function where I used attach source. + Bug 45514: Breakpoints made is assembly view do not show in C view. + * CDIDebugModel.java + * IAsmSourceLine.java + * ICBreakpoint.java + * IDisassemblyBlock.java + * CBreakpointManager.java + * CBreakpoint.java + * AsmSourceLine.java + * DisassemblyBlock.java + 2005-06-28 Mikhail Khodjaiants Bug 101188: Breakpoints don't work with MingW gdb. Use "toPortableString" instead of "toOsString" when setting the source search paths. diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/CDIDebugModel.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/CDIDebugModel.java index 637e5ceb3cb..f7be4e426ff 100644 --- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/CDIDebugModel.java +++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/CDIDebugModel.java @@ -174,6 +174,7 @@ public class CDIDebugModel { * given source handle, at the given address. The marker associated with the * breakpoint will be created on the specified resource. * + * @param module the module name the breakpoint is set in * @param sourceHandle the handle to the breakpoint source * @param resource the resource on which to create the associated breakpoint marker * @param address the address on which the breakpoint is set @@ -189,17 +190,44 @@ public class CDIDebugModel { * failure. * */ - public static ICAddressBreakpoint createAddressBreakpoint( String sourceHandle, IResource resource, IAddress address, boolean enabled, int ignoreCount, String condition, boolean register ) throws CoreException { + public static ICAddressBreakpoint createAddressBreakpoint( String module, String sourceHandle, IResource resource, IAddress address, boolean enabled, int ignoreCount, String condition, boolean register ) throws CoreException { + return createAddressBreakpoint( module, sourceHandle, resource, -1, address, enabled, ignoreCount, condition, register ); + } + + /** + * Creates and returns an address breakpoint for the source defined by the + * given source handle, at the given address. The marker associated with the + * breakpoint will be created on the specified resource. + * + * @param module the module name the breakpoint is set in + * @param sourceHandle the handle to the breakpoint source + * @param resource the resource on which to create the associated breakpoint marker + * @param lineNumber the line number in the source file + * @param address the address on which the breakpoint is set + * @param enabled whether to enable or disable this breakpoint + * @param ignoreCount the number of times this breakpoint will be ignored + * @param condition the breakpoint condition + * @param register whether to add this breakpoint to the breakpoint manager + * @return an address breakpoint + * @throws CoreException if this method fails. Reasons include: + *
"org.eclipse.cdt.debug.core.sourceHandle"
).
* This attribute is a String
.
*/
public static final String SOURCE_HANDLE = "org.eclipse.cdt.debug.core.sourceHandle"; //$NON-NLS-1$
+ /**
+ * Breakpoint attribute storing the module name this breakpoint
+ * is set in (value "org.eclipse.cdt.debug.core.module"
).
+ * This attribute is a String
.
+ *
+ * @since 3.0
+ */
+ public static final String MODULE = "org.eclipse.cdt.debug.core.module"; //$NON-NLS-1$
+
/**
* Returns whether this breakpoint is installed in at least one debug
* target.
@@ -134,6 +143,24 @@ public interface ICBreakpoint extends IBreakpoint {
*/
public void setThreadId( String threadId ) throws CoreException;
+ /**
+ * Returns the module name this breakpoint is set in.
+ *
+ * @return the module name
+ * @exception CoreException if unable to access the property on this breakpoint's
+ * underlying marker
+ */
+ public String getModule() throws CoreException;
+
+ /**
+ * Sets the module name of this breakpoint.
+ *
+ * @param module the module name
+ * @exception CoreException if unable to access the property on this breakpoint's
+ * underlying marker
+ */
+ public void setModule( String module ) throws CoreException;
+
/**
* Returns the source handle this breakpoint is set in.
*
diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/model/IDisassemblyBlock.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/model/IDisassemblyBlock.java
index 3ff3f1acaeb..17502e1a0e8 100644
--- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/model/IDisassemblyBlock.java
+++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/model/IDisassemblyBlock.java
@@ -30,6 +30,15 @@ public interface IDisassemblyBlock {
*/
String getModuleFile();
+
+ /**
+ * Returns the source element (IFile
or File>
)
+ * of the source file associated with this segment or null if no source file is associated.
+ *
+ * @return the source element
+ */
+ Object getSourceElement();
+
/**
* Returns whether this block contains given stack frame.
*
diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/CBreakpointManager.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/CBreakpointManager.java
index 77ec7465e90..2ede7139414 100644
--- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/CBreakpointManager.java
+++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/CBreakpointManager.java
@@ -253,8 +253,17 @@ public class CBreakpointManager implements IBreakpointManagerListener, ICDIEvent
}
public boolean supportsAddressBreakpoint( ICAddressBreakpoint breakpoint ) {
+ String module = null;
try {
- return ( getExecFilePath().toOSString().equals( breakpoint.getSourceHandle() ) );
+ module = breakpoint.getModule();
+ }
+ catch( CoreException e ) {
+ }
+ if ( module != null )
+ return getExecFilePath().toOSString().equals( module );
+ // supporting old breakpoints (> 3.0)
+ try {
+ return getExecFilePath().toOSString().equals( breakpoint.getSourceHandle() );
}
catch( CoreException e ) {
}
@@ -435,9 +444,9 @@ public class CBreakpointManager implements IBreakpointManagerListener, ICDIEvent
if ( breakpoint instanceof ICLineBreakpoint ) {
ICDILocator locator = cdiBreakpoint.getLocator();
if ( locator != null ) {
- BigInteger address = locator.getAddress();
+ IAddress address = getDebugTarget().getAddressFactory().createAddress( locator.getAddress() );
if ( address != null ) {
- ((ICLineBreakpoint)breakpoint).setAddress( address.toString() );
+ ((ICLineBreakpoint)breakpoint).setAddress( address.toHexAddressString() );
}
}
}
@@ -578,11 +587,9 @@ public class CBreakpointManager implements IBreakpointManagerListener, ICDIEvent
final boolean enabled = breakpoint.isEnabled();
final ICDITarget cdiTarget = getCDITarget();
String address = breakpoint.getAddress();
- if ( address.startsWith( "0x" ) ) { //$NON-NLS-1$
- final ICDIAddressLocation location = cdiTarget.createAddressLocation( new BigInteger ( breakpoint.getAddress().substring( 2 ), 16 ) );
- final ICDICondition condition = createCondition( breakpoint );
- setLocationBreakpointOnTarget( breakpoint, cdiTarget, location, condition, enabled );
- }
+ final ICDIAddressLocation location = cdiTarget.createAddressLocation( new BigInteger ( ( address.startsWith( "0x" ) ) ? address.substring( 2 ) : address, 16 ) ); //$NON-NLS-1$
+ final ICDICondition condition = createCondition( breakpoint );
+ setLocationBreakpointOnTarget( breakpoint, cdiTarget, location, condition, enabled );
}
private void setLineBreakpoint( ICLineBreakpoint breakpoint ) throws CDIException, CoreException {
@@ -648,28 +655,22 @@ public class CBreakpointManager implements IBreakpointManagerListener, ICDIEvent
ICLineBreakpoint breakpoint = null;
try {
ICDILocator location = cdiBreakpoint.getLocator();
- if ( !isEmpty( location.getFile() ) ) {
- ISourceLocator locator = getSourceLocator();
- if ( locator instanceof ICSourceLocator || locator instanceof CSourceLookupDirector ) {
- String sourceHandle = location.getFile();
- IResource resource = getProject();
- Object sourceElement = null;
- if ( locator instanceof ICSourceLocator )
- sourceElement = ((ICSourceLocator)locator).findSourceElement( location.getFile() );
- else
- sourceElement = ((CSourceLookupDirector)locator).getSourceElement( location.getFile() );
- if ( sourceElement instanceof IFile || sourceElement instanceof IStorage ) {
- sourceHandle = ( sourceElement instanceof IFile ) ? ((IFile)sourceElement).getLocation().toOSString() : ((IStorage)sourceElement).getFullPath().toOSString();
- resource = ( sourceElement instanceof IFile ) ? (IResource)sourceElement : ResourcesPlugin.getWorkspace().getRoot();
- }
- breakpoint = createLineBreakpoint( sourceHandle, resource, cdiBreakpoint );
-// else if ( !isEmpty( cdiBreakpoint.getLocation().getFunction() ) ) {
-// breakpoint = createFunctionBreakpoint( cdiBreakpoint );
-// }
-// else if ( ! cdiBreakpoint.getLocation().getAddress().equals( BigInteger.ZERO ) ) {
-// breakpoint = createAddressBreakpoint( cdiBreakpoint );
-// }
+ String file = location.getFile();
+ if ( !isEmpty( file ) ) {
+ Object sourceElement = getSourceElement( file );
+ String sourceHandle = file;
+ IResource resource = getProject();
+ if ( sourceElement instanceof IFile || sourceElement instanceof IStorage ) {
+ sourceHandle = ( sourceElement instanceof IFile ) ? ((IFile)sourceElement).getLocation().toOSString() : ((IStorage)sourceElement).getFullPath().toOSString();
+ resource = ( sourceElement instanceof IFile ) ? (IResource)sourceElement : ResourcesPlugin.getWorkspace().getRoot();
}
+ breakpoint = createLineBreakpoint( sourceHandle, resource, cdiBreakpoint );
+// else if ( !isEmpty( cdiBreakpoint.getLocation().getFunction() ) ) {
+// breakpoint = createFunctionBreakpoint( cdiBreakpoint );
+// }
+// else if ( ! cdiBreakpoint.getLocation().getAddress().equals( BigInteger.ZERO ) ) {
+// breakpoint = createAddressBreakpoint( cdiBreakpoint );
+// }
}
else if ( !isEmpty( location.getFunction() ) ) {
breakpoint = createFunctionBreakpoint( cdiBreakpoint );
@@ -727,8 +728,9 @@ public class CBreakpointManager implements IBreakpointManagerListener, ICDIEvent
IPath execFile = getExecFilePath();
String sourceHandle = execFile.toOSString();
IAddress address = getDebugTarget().getAddressFactory().createAddress( cdiBreakpoint.getLocator().getAddress() );
- ICAddressBreakpoint breakpoint = CDIDebugModel.createAddressBreakpoint( sourceHandle,
- getProject(),
+ ICAddressBreakpoint breakpoint = CDIDebugModel.createAddressBreakpoint( sourceHandle,
+ sourceHandle,
+ ResourcesPlugin.getWorkspace().getRoot(),
address,
cdiBreakpoint.isEnabled(),
cdiBreakpoint.getCondition().getIgnoreCount(),
@@ -874,4 +876,16 @@ public class CBreakpointManager implements IBreakpointManagerListener, ICDIEvent
}
return path;
}
+
+ private Object getSourceElement( String file ) {
+ Object sourceElement = null;
+ ISourceLocator locator = getSourceLocator();
+ if ( locator instanceof ICSourceLocator || locator instanceof CSourceLookupDirector ) {
+ if ( locator instanceof ICSourceLocator )
+ sourceElement = ((ICSourceLocator)locator).findSourceElement( file );
+ else
+ sourceElement = ((CSourceLookupDirector)locator).getSourceElement( file );
+ }
+ return sourceElement;
+ }
}
diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/breakpoints/CBreakpoint.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/breakpoints/CBreakpoint.java
index 6bdc635cc88..07816bd1bcc 100644
--- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/breakpoints/CBreakpoint.java
+++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/breakpoints/CBreakpoint.java
@@ -351,4 +351,18 @@ public abstract class CBreakpoint extends Breakpoint implements ICBreakpoint, ID
DebugPlugin.getDefault().getBreakpointManager().fireBreakpointChanged( this );
}
}
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.debug.core.model.ICBreakpoint#getModule()
+ */
+ public String getModule() throws CoreException {
+ return ensureMarker().getAttribute( MODULE, null );
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.debug.core.model.ICBreakpoint#setModule(java.lang.String)
+ */
+ public void setModule( String module ) throws CoreException {
+ setAttribute( MODULE, module );
+ }
}
diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/AsmSourceLine.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/AsmSourceLine.java
index f78cf7390cd..6ee24803a0a 100644
--- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/AsmSourceLine.java
+++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/AsmSourceLine.java
@@ -24,17 +24,34 @@ public class AsmSourceLine implements IAsmSourceLine {
private IAsmInstruction[] fInstructions = null;
+ private int fLineNumber;
+
/**
* Constructor for AsmSourceLine.
*/
public AsmSourceLine( IAddressFactory factory, String text, ICDIInstruction[] cdiInstructions ) {
+ this( factory, text, -1, cdiInstructions );
+ }
+
+ /**
+ * Constructor for AsmSourceLine.
+ */
+ public AsmSourceLine( IAddressFactory factory, String text, int lineNumber, ICDIInstruction[] cdiInstructions ) {
fText = text;
+ fLineNumber = lineNumber;
fInstructions = new IAsmInstruction[cdiInstructions.length];
for ( int i = 0; i < fInstructions.length; ++i ) {
fInstructions[i] = new AsmInstruction( factory, cdiInstructions[i] );
}
}
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.debug.core.model.IAsmSourceLine#getLineNumber()
+ */
+ public int getLineNumber() {
+ return fLineNumber;
+ }
+
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.core.model.IAsmSourceLine#getInstructions()
*/
diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/DisassemblyBlock.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/DisassemblyBlock.java
index 1dc1a832091..40ef60bc861 100644
--- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/DisassemblyBlock.java
+++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/DisassemblyBlock.java
@@ -39,7 +39,9 @@ import org.eclipse.debug.core.sourcelookup.ISourceLookupDirector;
public class DisassemblyBlock implements IDisassemblyBlock, IAdaptable {
private IDisassembly fDisassembly;
-
+
+ private Object fSourceElement;
+
private IAsmSourceLine[] fSourceLines;
private IAddress fStartAddress = null;
@@ -57,23 +59,31 @@ public class DisassemblyBlock implements IDisassemblyBlock, IAdaptable {
public static DisassemblyBlock create( IDisassembly disassembly, ICDIMixedInstruction[] instructions ) {
DisassemblyBlock block = new DisassemblyBlock( disassembly );
- block.setMixedMode( true );
ISourceLocator locator = disassembly.getDebugTarget().getLaunch().getSourceLocator();
IAddressFactory factory = ((CDebugTarget)disassembly.getDebugTarget()).getAddressFactory();
- block.setSourceLines( createSourceLines( factory, locator, instructions ) );
- block.initializeAddresses();
+ block.initialize( factory, locator, instructions );
return block;
}
public static DisassemblyBlock create( IDisassembly disassembly, ICDIInstruction[] instructions ) {
DisassemblyBlock block = new DisassemblyBlock( disassembly );
IAddressFactory factory = ((CDebugTarget)disassembly.getDebugTarget()).getAddressFactory();
- block.setMixedMode( false );
- block.setSourceLines( createSourceLines( factory, instructions ) );
- block.initializeAddresses();
+ block.initialize( factory, instructions );
return block;
}
+ private void initialize( IAddressFactory factory, ICDIInstruction[] instructions ) {
+ setMixedMode( false );
+ createSourceLines( factory, instructions );
+ initializeAddresses();
+ }
+
+ private void initialize( IAddressFactory factory, ISourceLocator locator, ICDIMixedInstruction[] mi ) {
+ setMixedMode( true );
+ createSourceLines( factory, locator, mi );
+ initializeAddresses();
+ }
+
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.core.model.IDisassemblyBlock#getDisassembly()
*/
@@ -95,6 +105,13 @@ public class DisassemblyBlock implements IDisassemblyBlock, IAdaptable {
return ""; //$NON-NLS-1$
}
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.debug.core.model.IDisassemblyBlock#getSourceElement()
+ */
+ public Object getSourceElement() {
+ return fSourceElement;
+ }
+
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.core.model.IDisassemblyBlock#contains(org.eclipse.cdt.debug.core.model.ICStackFrame)
*/
@@ -133,7 +150,7 @@ public class DisassemblyBlock implements IDisassemblyBlock, IAdaptable {
public void dispose() {
}
- private static IAsmSourceLine[] createSourceLines( IAddressFactory factory, ISourceLocator locator, ICDIMixedInstruction[] mi ) {
+ private void createSourceLines( IAddressFactory factory, ISourceLocator locator, ICDIMixedInstruction[] mi ) {
IAsmSourceLine[] result = new IAsmSourceLine[mi.length];
LineNumberReader reader = null;
if ( result.length > 0 && locator != null ) {
@@ -145,6 +162,7 @@ public class DisassemblyBlock implements IDisassemblyBlock, IAdaptable {
if ( locator instanceof ICSourceLocator ) {
element = ((ICSourceLocator)locator).findSourceElement( fileName );
}
+ fSourceElement = element;
File file= null;
if ( element instanceof IFile ) {
file = ((IFile)element).getLocation().toFile();
@@ -162,8 +180,8 @@ public class DisassemblyBlock implements IDisassemblyBlock, IAdaptable {
}
for ( int i = 0; i < result.length; ++i ) {
String text = null;
+ int lineNumber = mi[i].getLineNumber();
if ( reader != null ) {
- int lineNumber = mi[i].getLineNumber();
while( reader.getLineNumber() + 1 < lineNumber ) {
try {
reader.readLine();
@@ -179,13 +197,13 @@ public class DisassemblyBlock implements IDisassemblyBlock, IAdaptable {
}
}
}
- result[i] = new AsmSourceLine( factory, text, mi[i].getInstructions() );
+ result[i] = new AsmSourceLine( factory, text, lineNumber, mi[i].getInstructions() );
}
- return result;
+ fSourceLines = result;
}
- private static IAsmSourceLine[] createSourceLines( IAddressFactory factory, ICDIInstruction[] instructions ) {
- return new IAsmSourceLine[] { new AsmSourceLine( factory, "", instructions ) }; //$NON-NLS-1$
+ private void createSourceLines( IAddressFactory factory, ICDIInstruction[] instructions ) {
+ fSourceLines = new IAsmSourceLine[] { new AsmSourceLine( factory, "", instructions ) }; //$NON-NLS-1$
}
private void initializeAddresses() {
@@ -202,8 +220,4 @@ public class DisassemblyBlock implements IDisassemblyBlock, IAdaptable {
private void setMixedMode( boolean mixedMode ) {
this.fMixedMode = mixedMode;
}
-
- private void setSourceLines( IAsmSourceLine[] sourceLines ) {
- this.fSourceLines = sourceLines;
- }
}
diff --git a/debug/org.eclipse.cdt.debug.ui/ChangeLog b/debug/org.eclipse.cdt.debug.ui/ChangeLog
index b0c20c82720..e6fb2939f07 100644
--- a/debug/org.eclipse.cdt.debug.ui/ChangeLog
+++ b/debug/org.eclipse.cdt.debug.ui/ChangeLog
@@ -1,3 +1,12 @@
+2005-06-29 Mikhail Khodjaiants
+ Bug 41725: I can't set a breakpoint in a function where I used attach source.
+ Bug 45514: Breakpoints made is assembly view do not show in C view.
+ + DebugMarkerAnnotationModel.java
+ + DebugMarkerAnnotationModelFactory.java
+ * ToggleBreakpointAdapter.java
+ * DisassemblyEditorInput.java
+ * plugin.xml
+
2005-06-29 Mikhail Khodjaiants
Removed unused imports.
* CBreapointWorkbencAdapterFactory.java
diff --git a/debug/org.eclipse.cdt.debug.ui/plugin.xml b/debug/org.eclipse.cdt.debug.ui/plugin.xml
index 96be8272d88..0fb0291b6da 100644
--- a/debug/org.eclipse.cdt.debug.ui/plugin.xml
+++ b/debug/org.eclipse.cdt.debug.ui/plugin.xml
@@ -1240,5 +1240,11 @@
icon="icons/obj16/folder_obj.gif"
id="org.eclipse.cdt.debug.ui.containerPresentation.directory"/>
+