1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-06-07 17:56:01 +02:00

Bug 314865 - When "Skip All Breakpoints" is ticked breakpoints at launch can be hit

This commit is contained in:
James Blackburn 2010-06-25 08:35:26 +00:00
parent 5a7c2c617e
commit 566aba5c1d

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2004, 2009, 2008 QNX Software Systems and others. * Copyright (c) 2004, 2010 QNX Software Systems and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -12,6 +12,7 @@
* Ling Wang (Nokia) - bug 176081 * Ling Wang (Nokia) - bug 176081
* Freescale Semiconductor - Address watchpoints, https://bugs.eclipse.org/bugs/show_bug.cgi?id=118299 * Freescale Semiconductor - Address watchpoints, https://bugs.eclipse.org/bugs/show_bug.cgi?id=118299
* QNX Software Systems - catchpoints - bug 226689 * QNX Software Systems - catchpoints - bug 226689
* James Blackburn (Broadcom) - bug 314865
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.debug.internal.core; package org.eclipse.cdt.debug.internal.core;
@ -480,8 +481,11 @@ public class CBreakpointManager implements IBreakpointsListener, IBreakpointMana
doHandleEventBreakpointCreatedEvent( (ICDIEventBreakpoint)cdiBreakpoint ); doHandleEventBreakpointCreatedEvent( (ICDIEventBreakpoint)cdiBreakpoint );
else if ( cdiBreakpoint instanceof ICDILocationBreakpoint ) else if ( cdiBreakpoint instanceof ICDILocationBreakpoint )
doHandleLocationBreakpointCreatedEvent( (ICDILocationBreakpoint)cdiBreakpoint ); doHandleLocationBreakpointCreatedEvent( (ICDILocationBreakpoint)cdiBreakpoint );
if ( !isTemporary(cdiBreakpoint) && !DebugPlugin.getDefault().getBreakpointManager().isEnabled() ) { try {
changeBreakpointPropertiesOnTarget(cdiBreakpoint, new Boolean(false), null); if ( !isTemporary(cdiBreakpoint) && !DebugPlugin.getDefault().getBreakpointManager().isEnabled() && cdiBreakpoint.isEnabled() ) {
changeBreakpointPropertiesOnTarget(cdiBreakpoint, false, null);
}
} catch (CDIException e){
} }
} }
@ -858,6 +862,8 @@ public class CBreakpointManager implements IBreakpointsListener, IBreakpointMana
ICDIBreakpoint b = null; ICDIBreakpoint b = null;
int breakpointType = ICBreakpointType.REGULAR; int breakpointType = ICBreakpointType.REGULAR;
ICBreakpoint icbreakpoint = breakpoints[i]; ICBreakpoint icbreakpoint = breakpoints[i];
// Bug 314865: CDI breakpoint is only created enabled if the global breakpoint disable toggle isn't set
boolean enabled = icbreakpoint.isEnabled() && DebugPlugin.getDefault().getBreakpointManager().isEnabled();
if (icbreakpoint instanceof ICBreakpointType) { if (icbreakpoint instanceof ICBreakpointType) {
breakpointType = ((ICBreakpointType) icbreakpoint).getType(); breakpointType = ((ICBreakpointType) icbreakpoint).getType();
} }
@ -877,7 +883,7 @@ public class CBreakpointManager implements IBreakpointsListener, IBreakpointMana
if (marker != null) if (marker != null)
fBreakpointProblems.add(marker); fBreakpointProblems.add(marker);
if (bpManager2 != null) if (bpManager2 != null)
b = bpManager2.setFunctionBreakpoint( breakpointType, location, condition, true, icbreakpoint.isEnabled() ); b = bpManager2.setFunctionBreakpoint( breakpointType, location, condition, true, enabled );
else else
b = cdiTarget.setFunctionBreakpoint( breakpointType, location, condition, true ); b = cdiTarget.setFunctionBreakpoint( breakpointType, location, condition, true );
} else if ( icbreakpoint instanceof ICAddressBreakpoint ) { } else if ( icbreakpoint instanceof ICAddressBreakpoint ) {
@ -886,7 +892,7 @@ public class CBreakpointManager implements IBreakpointsListener, IBreakpointMana
ICDIAddressLocation location = cdiTarget.createAddressLocation( new BigInteger ( ( address.startsWith( "0x" ) ) ? address.substring( 2 ) : address, 16 ) ); //$NON-NLS-1$ ICDIAddressLocation location = cdiTarget.createAddressLocation( new BigInteger ( ( address.startsWith( "0x" ) ) ? address.substring( 2 ) : address, 16 ) ); //$NON-NLS-1$
ICDICondition condition = createCondition( breakpoint ); ICDICondition condition = createCondition( breakpoint );
if (bpManager2 != null) if (bpManager2 != null)
b = bpManager2.setAddressBreakpoint( breakpointType, location, condition, true, icbreakpoint.isEnabled() ); b = bpManager2.setAddressBreakpoint( breakpointType, location, condition, true, enabled );
else else
b = cdiTarget.setAddressBreakpoint( breakpointType, location, condition, true ); b = cdiTarget.setAddressBreakpoint( breakpointType, location, condition, true );
} else if ( icbreakpoint instanceof ICLineBreakpoint ) { } else if ( icbreakpoint instanceof ICLineBreakpoint ) {
@ -899,7 +905,7 @@ public class CBreakpointManager implements IBreakpointsListener, IBreakpointMana
if (marker != null) if (marker != null)
fBreakpointProblems.add(marker); fBreakpointProblems.add(marker);
if (bpManager2 != null) if (bpManager2 != null)
b = bpManager2.setLineBreakpoint( breakpointType, location, condition, true, icbreakpoint.isEnabled() ); b = bpManager2.setLineBreakpoint( breakpointType, location, condition, true, enabled );
else else
b = cdiTarget.setLineBreakpoint( breakpointType, location, condition, true ); b = cdiTarget.setLineBreakpoint( breakpointType, location, condition, true );
} else if ( icbreakpoint instanceof ICWatchpoint ) { } else if ( icbreakpoint instanceof ICWatchpoint ) {
@ -913,9 +919,9 @@ public class CBreakpointManager implements IBreakpointsListener, IBreakpointMana
if ( icbreakpoint instanceof ICWatchpoint2 ) { if ( icbreakpoint instanceof ICWatchpoint2 ) {
ICWatchpoint2 wp2 = (ICWatchpoint2)watchpoint; ICWatchpoint2 wp2 = (ICWatchpoint2)watchpoint;
b = bpManager2.setWatchpoint( breakpointType, accessType, expression, wp2.getMemorySpace(), b = bpManager2.setWatchpoint( breakpointType, accessType, expression, wp2.getMemorySpace(),
wp2.getRange(), condition, icbreakpoint.isEnabled() ); wp2.getRange(), condition, enabled );
} else { } else {
b = bpManager2.setWatchpoint( breakpointType, accessType, expression, condition, icbreakpoint.isEnabled() ); b = bpManager2.setWatchpoint( breakpointType, accessType, expression, condition, enabled );
} }
} else { } else {
b = cdiTarget.setWatchpoint(breakpointType, accessType, expression, condition ); b = cdiTarget.setWatchpoint(breakpointType, accessType, expression, condition );
@ -926,7 +932,7 @@ public class CBreakpointManager implements IBreakpointsListener, IBreakpointMana
if (cdiTarget instanceof ICDIBreakpointManagement3) { if (cdiTarget instanceof ICDIBreakpointManagement3) {
ICDIBreakpointManagement3 bpManager3 = (ICDIBreakpointManagement3) cdiTarget; ICDIBreakpointManagement3 bpManager3 = (ICDIBreakpointManagement3) cdiTarget;
b = bpManager3.setEventBreakpoint(eventbkpt.getEventType(), eventbkpt b = bpManager3.setEventBreakpoint(eventbkpt.getEventType(), eventbkpt
.getEventArgument(), breakpointType, condition, true, icbreakpoint.isEnabled()); .getEventArgument(), breakpointType, condition, true, enabled);
} else { } else {
throw new UnsupportedOperationException("BreakpointManager does not support this type of breapoints"); throw new UnsupportedOperationException("BreakpointManager does not support this type of breapoints");
} }
@ -939,8 +945,8 @@ public class CBreakpointManager implements IBreakpointsListener, IBreakpointMana
} }
} }
// Hack: see bug 105196: [CDI]: Add "enabled" flag to the "set...Breakpoint" methods // Hack: see bug 105196: [CDI]: Add "enabled" flag to the "set...Breakpoint" methods
if (bpManager2 == null && b != null && b.isEnabled() != icbreakpoint.isEnabled() ) { if (bpManager2 == null && b != null && b.isEnabled() != enabled ) {
b.setEnabled( icbreakpoint.isEnabled() ); b.setEnabled( enabled );
} }
} }
catch( CoreException e ) { catch( CoreException e ) {
@ -1156,7 +1162,7 @@ public class CBreakpointManager implements IBreakpointsListener, IBreakpointMana
return; return;
ICDITarget cdiTarget = getCDITarget(); ICDITarget cdiTarget = getCDITarget();
try { try {
boolean enabled = breakpoint.isEnabled(); boolean enabled = breakpoint.isEnabled() && DebugPlugin.getDefault().getBreakpointManager().isEnabled();
boolean oldEnabled = ( delta != null ) ? delta.getAttribute( IBreakpoint.ENABLED, true ) : enabled; boolean oldEnabled = ( delta != null ) ? delta.getAttribute( IBreakpoint.ENABLED, true ) : enabled;
int ignoreCount = breakpoint.getIgnoreCount(); int ignoreCount = breakpoint.getIgnoreCount();
int oldIgnoreCount = ( delta != null ) ? delta.getAttribute( ICBreakpoint.IGNORE_COUNT, 0 ) : ignoreCount; int oldIgnoreCount = ( delta != null ) ? delta.getAttribute( ICBreakpoint.IGNORE_COUNT, 0 ) : ignoreCount;
@ -1200,8 +1206,9 @@ public class CBreakpointManager implements IBreakpointsListener, IBreakpointMana
private void changeBreakpointProperties( ICBreakpoint breakpoint, ICDIBreakpoint cdiBreakpoint ) { private void changeBreakpointProperties( ICBreakpoint breakpoint, ICDIBreakpoint cdiBreakpoint ) {
Boolean enabled = null; Boolean enabled = null;
try { try {
if ( cdiBreakpoint.isEnabled() != breakpoint.isEnabled() ) boolean shouldBeEnabled = breakpoint.isEnabled() && DebugPlugin.getDefault().getBreakpointManager().isEnabled();
enabled = Boolean.valueOf( breakpoint.isEnabled() ); if ( cdiBreakpoint.isEnabled() != shouldBeEnabled )
enabled = shouldBeEnabled;
} }
catch( CDIException e ) { catch( CDIException e ) {
} }