1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-24 01:15:29 +02:00

Partial fix for bug 41725: I can't set a breakpoint in a function where I used attach source.

This commit is contained in:
Mikhail Khodjaiants 2004-11-09 22:28:09 +00:00
parent d14425742c
commit 216cc40051
6 changed files with 51 additions and 20 deletions

View file

@ -1,3 +1,7 @@
2004-11-09 Mikhail Khodjaiants
Partial fix for bug 41725: I can't set a breakpoint in a function where I used attach source.
* CBreakpointManager.java
2004-11-09 Alain Magloire
Put possiblity to set Exception breakpoint
* cdi/org/eclipse/cdt/debug/core/cdi/ICDIBreakpointManagement.java

View file

@ -53,6 +53,7 @@ import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Status;
import org.eclipse.debug.core.DebugException;
import org.eclipse.debug.core.DebugPlugin;
@ -217,9 +218,15 @@ public class CBreakpointManager implements IBreakpointManagerListener, ICDIEvent
if ( breakpoint instanceof ICAddressBreakpoint )
return supportsAddressBreakpoint( (ICAddressBreakpoint)breakpoint );
if ( breakpoint instanceof ICLineBreakpoint ) {
ICSourceLocator sl = getSourceLocator();
if ( sl != null )
return sl.contains( resource );
try {
String handle = breakpoint.getSourceHandle();
ICSourceLocator sl = getSourceLocator();
if ( sl != null )
return ( sl.findSourceElement( handle ) != null );
}
catch( CoreException e ) {
return false;
}
}
else {
IProject project = resource.getProject();
@ -522,14 +529,19 @@ public class CBreakpointManager implements IBreakpointManagerListener, ICDIEvent
private ICDIBreakpoint setLineBreakpoint( ICLineBreakpoint breakpoint ) throws CDIException, CoreException {
ICDITarget cdiTarget = getCDITarget();
ICDILocation location = cdiTarget.createLocation( breakpoint.getMarker().getResource().getLocation().lastSegment(), null, breakpoint.getLineNumber() );
ICDICondition condition = createCondition( breakpoint );
ICDIBreakpoint cdiBreakpoint = null;
synchronized ( getBreakpointMap() ) {
cdiBreakpoint = cdiTarget.setLocationBreakpoint( ICDIBreakpoint.REGULAR, location, condition, true );
getBreakpointMap().put( breakpoint, cdiBreakpoint );
String handle = breakpoint.getSourceHandle();
IPath path = new Path( handle );
if ( path.isValidPath( handle ) ) {
ICDILocation location = cdiTarget.createLocation( path.lastSegment(), null, breakpoint.getLineNumber() );
ICDICondition condition = createCondition( breakpoint );
ICDIBreakpoint cdiBreakpoint = null;
synchronized ( getBreakpointMap() ) {
cdiBreakpoint = cdiTarget.setLocationBreakpoint( ICDIBreakpoint.REGULAR, location, condition, true );
getBreakpointMap().put( breakpoint, cdiBreakpoint );
}
return cdiBreakpoint;
}
return cdiBreakpoint;
return null;
}
private ICDIBreakpoint setWatchpoint( ICWatchpoint watchpoint ) throws CDIException, CoreException {

View file

@ -1,3 +1,9 @@
2004-11-09 Mikhail Khodjaiants
Partial fix for bug 41725: I can't set a breakpoint in a function where I used attach source.
* CDTDebugModelPresentation.java
* ToggleBreakpointAdapter.java
* CBreakpointPropertyPage.java
2004-11-09 Mikhail Khodjaiants
Fix for bug 77251: Need protected access to DisassemblyView's createVerticalRuler() method.
* DisassemblyView.java

View file

@ -695,7 +695,7 @@ public class CDTDebugModelPresentation extends LabelProvider implements IDebugMo
protected String getLineBreakpointText( ICLineBreakpoint breakpoint, boolean qualified ) throws CoreException {
StringBuffer label = new StringBuffer();
appendResourceName( breakpoint, label, qualified );
appendSourceName( breakpoint, label, qualified );
appendLineNumber( breakpoint, label );
appendIgnoreCount( breakpoint, label );
appendCondition( breakpoint, label );
@ -704,7 +704,7 @@ public class CDTDebugModelPresentation extends LabelProvider implements IDebugMo
protected String getWatchpointText( ICWatchpoint watchpoint, boolean qualified ) throws CoreException {
StringBuffer label = new StringBuffer();
appendResourceName( watchpoint, label, qualified );
appendSourceName( watchpoint, label, qualified );
appendWatchExpression( watchpoint, label );
appendIgnoreCount( watchpoint, label );
appendCondition( watchpoint, label );
@ -713,7 +713,7 @@ public class CDTDebugModelPresentation extends LabelProvider implements IDebugMo
protected String getAddressBreakpointText( ICAddressBreakpoint breakpoint, boolean qualified ) throws CoreException {
StringBuffer label = new StringBuffer();
appendResourceName( breakpoint, label, qualified );
appendSourceName( breakpoint, label, qualified );
appendAddress( breakpoint, label );
appendIgnoreCount( breakpoint, label );
appendCondition( breakpoint, label );
@ -722,17 +722,21 @@ public class CDTDebugModelPresentation extends LabelProvider implements IDebugMo
protected String getFunctionBreakpointText( ICFunctionBreakpoint breakpoint, boolean qualified ) throws CoreException {
StringBuffer label = new StringBuffer();
appendResourceName( breakpoint, label, qualified );
appendSourceName( breakpoint, label, qualified );
appendFunction( breakpoint, label );
appendIgnoreCount( breakpoint, label );
appendCondition( breakpoint, label );
return label.toString();
}
protected StringBuffer appendResourceName( ICBreakpoint breakpoint, StringBuffer label, boolean qualified ) {
IPath path = breakpoint.getMarker().getResource().getLocation();
if ( !path.isEmpty() )
label.append( qualified ? path.toOSString() : path.lastSegment() );
protected StringBuffer appendSourceName( ICBreakpoint breakpoint, StringBuffer label, boolean qualified ) throws CoreException {
String handle = breakpoint.getSourceHandle();
if ( !isEmpty( handle ) ) {
IPath path = new Path( handle );
if ( path.isValidPath( handle ) ) {
label.append( qualified ? path.toOSString() : path.lastSegment() );
}
}
return label;
}

View file

@ -326,7 +326,7 @@ public class ToggleBreakpointAdapter implements IToggleBreakpointsTarget {
return ((IFileEditorInput)input).getFile().getLocation().toOSString();
}
if ( input instanceof IStorageEditorInput ) {
return ((IStorageEditorInput)input).getStorage().getName();
return ((IStorageEditorInput)input).getStorage().getFullPath().toOSString();
}
if ( input instanceof DisassemblyEditorInput ) {
return ((DisassemblyEditorInput)input).getModuleFile();

View file

@ -303,7 +303,12 @@ public class CBreakpointPropertyPage extends FieldEditorPreferencePage implement
}
else if ( breakpoint instanceof ILineBreakpoint ) {
addField( createLabelEditor( getFieldEditorParent(), PropertyPageMessages.getString( "CBreakpointPropertyPage.18" ), PropertyPageMessages.getString( "CBreakpointPropertyPage.8" ) ) ); //$NON-NLS-1$//$NON-NLS-2$
String fileName = breakpoint.getMarker().getResource().getLocation().toOSString();
String fileName = null;
try {
fileName = breakpoint.getSourceHandle();
}
catch( CoreException e ) {
}
if ( fileName != null ) {
addField( createLabelEditor( getFieldEditorParent(), PropertyPageMessages.getString( "CBreakpointPropertyPage.7" ), fileName ) ); //$NON-NLS-1$
}