Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Cortell2008-01-04 21:16:32 +0000
committerJohn Cortell2008-01-04 21:16:32 +0000
commit048b012111ce4fdaebf4a9ef94d1c44ad20e8fcb (patch)
treec1c3c8e88c7a5bb52f713c3cc6485ef1eea50386 /debug/org.eclipse.cdt.debug.core
parente1478e3c728c3c37d05f72e3c2908b82acf3987f (diff)
downloadorg.eclipse.cdt-048b012111ce4fdaebf4a9ef94d1c44ad20e8fcb.tar.gz
org.eclipse.cdt-048b012111ce4fdaebf4a9ef94d1c44ad20e8fcb.tar.xz
org.eclipse.cdt-048b012111ce4fdaebf4a9ef94d1c44ad20e8fcb.zip
Applied patch to 204028. Setting an address breakpoint in a session with no symbolics (executable) would NPE.
Diffstat (limited to 'debug/org.eclipse.cdt.debug.core')
-rw-r--r--debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/CBreakpointManager.java61
1 files changed, 40 insertions, 21 deletions
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 4b5728d0f85..b6502936416 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
@@ -26,6 +26,7 @@ import java.util.Map;
import java.util.Set;
import org.eclipse.cdt.core.IAddress;
import org.eclipse.cdt.core.IAddressFactory;
+import org.eclipse.cdt.core.IBinaryParser.IBinaryObject;
import org.eclipse.cdt.debug.core.CDIDebugModel;
import org.eclipse.cdt.debug.core.CDebugUtils;
import org.eclipse.cdt.debug.core.cdi.CDIException;
@@ -847,9 +848,7 @@ public class CBreakpointManager implements IBreakpointsListener, IBreakpointMana
}
private ICFunctionBreakpoint createFunctionBreakpoint( ICDILocationBreakpoint cdiBreakpoint ) throws CDIException, CoreException {
- IPath execFile = getExecFilePath();
- String sourceHandle = execFile.toOSString();
- ICFunctionBreakpoint breakpoint = CDIDebugModel.createFunctionBreakpoint( sourceHandle,
+ ICFunctionBreakpoint breakpoint = CDIDebugModel.createFunctionBreakpoint( getExecFileHandle(),
getProject(),
cdiBreakpoint.getLocator().getFunction(),
-1,
@@ -863,8 +862,7 @@ public class CBreakpointManager implements IBreakpointsListener, IBreakpointMana
}
private ICAddressBreakpoint createAddressBreakpoint( ICDILocationBreakpoint cdiBreakpoint ) throws CDIException, CoreException {
- IPath execFile = getExecFilePath();
- String sourceHandle = execFile.toOSString();
+ String sourceHandle = getExecFileHandle();
IAddress address = getDebugTarget().getAddressFactory().createAddress( cdiBreakpoint.getLocator().getAddress() );
ICAddressBreakpoint breakpoint = CDIDebugModel.createAddressBreakpoint( sourceHandle,
sourceHandle,
@@ -878,8 +876,7 @@ public class CBreakpointManager implements IBreakpointsListener, IBreakpointMana
}
private ICWatchpoint createWatchpoint( ICDIWatchpoint cdiWatchpoint ) throws CDIException, CoreException {
- IPath execFile = getExecFilePath();
- String sourceHandle = execFile.toOSString();
+ String sourceHandle = getExecFileHandle();
ICWatchpoint watchpoint = null;
if ( cdiWatchpoint instanceof ICDIWatchpoint2 ){
watchpoint = CDIDebugModel.createWatchpoint( sourceHandle,
@@ -1058,28 +1055,42 @@ public class CBreakpointManager implements IBreakpointsListener, IBreakpointMana
return s;
}
+ /**
+ * Checks for a match between the symbolics referenced by the breakpoint
+ * and the symbolics of the contained CDebugTarget.
+ * @param breakpoint
+ * @return true if the symbolics match or if the breakpoint has no symbolics
+ */
public boolean supportsAddressBreakpoint( ICAddressBreakpoint breakpoint ) {
- String module = null;
+ boolean sessionHasSymbols = getExecFileHandle() != null && getExecFileHandle().length() > 0;
+ boolean bpHasSymbols = false;
try {
- module = breakpoint.getModule();
+ String module = breakpoint.getModule();
+ if ( module != null && module.length() > 0 ) {
+ bpHasSymbols = true;
+ if ( sessionHasSymbols ) {
+ return getExecFileHandle().equals( module );
+ }
+ }
}
catch( CoreException e ) {
}
- if ( module != null && getExecFilePath() != null )
- return getExecFilePath().toOSString().equals( module );
// supporting old breakpoints (> 3.0)
- String sourceHandle = null;
try {
- sourceHandle = breakpoint.getSourceHandle();
+ String sourceHandle = breakpoint.getSourceHandle();
+ if ( sourceHandle != null && sourceHandle.length() > 0 ) {
+ bpHasSymbols = true;
+ if ( sessionHasSymbols ) {
+ return getExecFileHandle().equals( sourceHandle );
+ }
+ }
}
catch( CoreException e ) {
}
- if ( sourceHandle != null && getExecFilePath() != null )
- return getExecFilePath().toOSString().equals( sourceHandle );
- return module != null && module.length() == 0 &&
- sourceHandle != null && sourceHandle.length() == 0;
+ // an address breakpoint can also be set in the absence of any symbols
+ return !bpHasSymbols;
}
public void skipBreakpoints( boolean enabled ) {
@@ -1131,10 +1142,18 @@ public class CBreakpointManager implements IBreakpointsListener, IBreakpointMana
return getDebugTarget().getProject();
}
- private IPath getExecFilePath() {
- if (getDebugTarget() == null || getDebugTarget().getExecFile() == null)
- return null;
- return getDebugTarget().getExecFile().getPath();
+ private String getExecFileHandle() {
+ CDebugTarget target = getDebugTarget();
+ if ( target != null ) {
+ IBinaryObject binary = target.getExecFile();
+ if ( binary != null ) {
+ IPath path = binary.getPath();
+ if ( path != null ) {
+ return path.toOSString();
+ }
+ }
+ }
+ return null;
}
private ISourceLocator getSourceLocator() {

Back to the top