Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThierry BLIND2019-03-01 13:44:17 -0500
committerThierry BLIND2019-03-01 14:35:07 -0500
commit28c3a178e1b900c6b9f68826205ab5033e2bac38 (patch)
treeaf47dfdd87530ca538738cce269b087d4d08b037
parent4be04ead8844b72a28d0ab3a29c351b4ae7dd56d (diff)
downloadorg.eclipse.pdt-28c3a178e1b900c6b9f68826205ab5033e2bac38.tar.gz
org.eclipse.pdt-28c3a178e1b900c6b9f68826205ab5033e2bac38.tar.xz
org.eclipse.pdt-28c3a178e1b900c6b9f68826205ab5033e2bac38.zip
Bug 538315 - Xdebug breaks at deleted breakpoints
do not send unnecessary breakpoint changes Signed-off-by: Thierry BLIND <thierryblind@msn.com>
-rw-r--r--plugins/org.eclipse.php.debug.core/src/org/eclipse/php/internal/debug/core/xdebug/dbgp/model/DBGpTarget.java54
-rw-r--r--plugins/org.eclipse.php.debug.core/src/org/eclipse/php/internal/debug/core/zend/model/PHPDebugTarget.java31
2 files changed, 51 insertions, 34 deletions
diff --git a/plugins/org.eclipse.php.debug.core/src/org/eclipse/php/internal/debug/core/xdebug/dbgp/model/DBGpTarget.java b/plugins/org.eclipse.php.debug.core/src/org/eclipse/php/internal/debug/core/xdebug/dbgp/model/DBGpTarget.java
index 30f3d6f9e..f62d1b8af 100644
--- a/plugins/org.eclipse.php.debug.core/src/org/eclipse/php/internal/debug/core/xdebug/dbgp/model/DBGpTarget.java
+++ b/plugins/org.eclipse.php.debug.core/src/org/eclipse/php/internal/debug/core/xdebug/dbgp/model/DBGpTarget.java
@@ -20,10 +20,7 @@ import static org.eclipse.php.internal.debug.core.model.IVariableFacet.Facet.VIR
import java.io.UnsupportedEncodingException;
import java.text.MessageFormat;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.StringTokenizer;
-import java.util.Vector;
+import java.util.*;
import org.eclipse.core.resources.*;
import org.eclipse.core.runtime.*;
@@ -52,7 +49,11 @@ import org.eclipse.php.internal.debug.core.xdebug.dbgp.DBGpBreakpoint;
import org.eclipse.php.internal.debug.core.xdebug.dbgp.DBGpBreakpointFacade;
import org.eclipse.php.internal.debug.core.xdebug.dbgp.DBGpLogger;
import org.eclipse.php.internal.debug.core.xdebug.dbgp.DBGpPreferences;
-import org.eclipse.php.internal.debug.core.xdebug.dbgp.protocol.*;
+import org.eclipse.php.internal.debug.core.xdebug.dbgp.protocol.Base64;
+import org.eclipse.php.internal.debug.core.xdebug.dbgp.protocol.DBGpCommand;
+import org.eclipse.php.internal.debug.core.xdebug.dbgp.protocol.DBGpResponse;
+import org.eclipse.php.internal.debug.core.xdebug.dbgp.protocol.DBGpUtils;
+import org.eclipse.php.internal.debug.core.xdebug.dbgp.protocol.EngineTypes;
import org.eclipse.php.internal.debug.core.xdebug.dbgp.session.DBGpSession;
import org.eclipse.php.internal.debug.core.xdebug.dbgp.session.DBGpSessionHandler;
import org.eclipse.php.internal.debug.core.xdebug.dbgp.session.IDBGpSessionListener;
@@ -2056,10 +2057,8 @@ public class DBGpTarget extends DBGpElement
}
if (supportsBreakpoint(breakpoint)) {
try {
- int deltaLNumber = delta.getAttribute(IMarker.LINE_NUMBER, 0);
boolean deltaEnabled = delta.getAttribute(IBreakpoint.ENABLED, breakpoint.isEnabled());
IMarker marker = breakpoint.getMarker();
- int lineNumber = marker.getAttribute(IMarker.LINE_NUMBER, 0);
// did the condition change ?
DBGpBreakpoint bp = bpFacade.createDBGpBreakpoint(breakpoint);
@@ -2075,26 +2074,13 @@ public class DBGpTarget extends DBGpElement
return;
}
- // did the line number change ?
- if (lineNumber != deltaLNumber) {
- if (DBGpLogger.debugBP()) {
- DBGpLogger.debug("line number changed for breakpoint with ID: " + bp.getID()); //$NON-NLS-1$
- }
-
- if (breakpoint.isEnabled()) {
- breakpointRemoved(breakpoint, null);
- breakpointAdded(breakpoint);
- }
- return;
- }
-
// did the line enable state change ?
if (breakpoint.isEnabled() != deltaEnabled) {
if (DBGpLogger.debugBP()) {
DBGpLogger.debug("enable state changed for breakpoint with ID: " + bp.getID()); //$NON-NLS-1$
}
-
- // enable or disable a breakpoint from the "Breakpoints" view
+ // enable or disable a breakpoint from the "Breakpoints"
+ // view
if (breakpoint.isEnabled()) {
breakpointAdded(breakpoint);
} else {
@@ -2104,9 +2090,29 @@ public class DBGpTarget extends DBGpElement
return;
}
- // add or remove the break point depending on whether it was
- // enabled or not
+ // Did any other marker attribute change?
+ // For example: the line number could have changed.
+ Map<String, Object> map = marker.getAttributes();
+ Map<String, Object> deltaMap = delta.getAttributes();
+ if (map == null) {
+ map = new HashMap<>();
+ }
+ if (deltaMap == null) {
+ deltaMap = new HashMap<>();
+ }
+ if (map.equals(deltaMap)) {
+ // no changes were found, this
+ // happens when another breakpoint
+ // (than current one) was deleted
+ // and breakpointChanged() was
+ // unnecessarily called for current
+ // breakpoint
+ return;
+ }
if (breakpoint.isEnabled()) {
+ if (DBGpLogger.debugBP()) {
+ DBGpLogger.debug("at least one attribute changed for breakpoint with ID: " + bp.getID()); //$NON-NLS-1$
+ }
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=538315
breakpointRemoved(breakpoint, null);
breakpointAdded(breakpoint);
diff --git a/plugins/org.eclipse.php.debug.core/src/org/eclipse/php/internal/debug/core/zend/model/PHPDebugTarget.java b/plugins/org.eclipse.php.debug.core/src/org/eclipse/php/internal/debug/core/zend/model/PHPDebugTarget.java
index 34f5ffef8..e3e52f863 100644
--- a/plugins/org.eclipse.php.debug.core/src/org/eclipse/php/internal/debug/core/zend/model/PHPDebugTarget.java
+++ b/plugins/org.eclipse.php.debug.core/src/org/eclipse/php/internal/debug/core/zend/model/PHPDebugTarget.java
@@ -654,10 +654,8 @@ public class PHPDebugTarget extends PHPDebugElement
}
if (supportsBreakpoint(breakpoint)) {
try {
- int deltaLNumber = delta.getAttribute(IMarker.LINE_NUMBER, 0);
boolean deltaEnabled = delta.getAttribute(IBreakpoint.ENABLED, breakpoint.isEnabled());
IMarker marker = breakpoint.getMarker();
- int lineNumber = marker.getAttribute(IMarker.LINE_NUMBER, 0);
if (((PHPLineBreakpoint) breakpoint).isConditionChanged()) {
((PHPLineBreakpoint) breakpoint).setConditionChanged(false);
if (breakpoint.isEnabled()) {
@@ -666,15 +664,9 @@ public class PHPDebugTarget extends PHPDebugElement
}
return;
}
- if (lineNumber != deltaLNumber) {
- if (breakpoint.isEnabled()) {
- breakpointRemoved(breakpoint, null);
- breakpointAdded(breakpoint);
- }
- return;
- }
if (breakpoint.isEnabled() != deltaEnabled) {
- // enable or disable a breakpoint from the "Breakpoints" view
+ // enable or disable a breakpoint from the "Breakpoints"
+ // view
if (breakpoint.isEnabled()) {
breakpointAdded(breakpoint);
} else {
@@ -683,6 +675,25 @@ public class PHPDebugTarget extends PHPDebugElement
}
return;
}
+ // Did any other marker attribute change?
+ // For example: the line number could have changed.
+ Map<String, Object> map = marker.getAttributes();
+ Map<String, Object> deltaMap = delta.getAttributes();
+ if (map == null) {
+ map = new HashMap<>();
+ }
+ if (deltaMap == null) {
+ deltaMap = new HashMap<>();
+ }
+ if (map.equals(deltaMap)) {
+ // no changes were found, this
+ // happens when another breakpoint
+ // (than current one) was deleted
+ // and breakpointChanged() was
+ // unnecessarily called for current
+ // breakpoint
+ return;
+ }
if (breakpoint.isEnabled()) {
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=538315
breakpointRemoved(breakpoint, null);

Back to the top