diff options
| author | Stefan Sprenger | 2016-04-27 09:18:55 +0000 |
|---|---|---|
| committer | Jonah Graham | 2016-04-27 12:20:42 +0000 |
| commit | 2469e0e11731fa2ab4a6ecc4e0e897626b5ae514 (patch) | |
| tree | d8e234aec95e0356046e62e743ddcd4633c6ace1 | |
| parent | 0265ee09a7fe1417acfb043d844bdbbbe71c834d (diff) | |
| download | org.eclipse.cdt-2469e0e11731fa2ab4a6ecc4e0e897626b5ae514.tar.gz org.eclipse.cdt-2469e0e11731fa2ab4a6ecc4e0e897626b5ae514.tar.xz org.eclipse.cdt-2469e0e11731fa2ab4a6ecc4e0e897626b5ae514.zip | |
Bug 487998: [breakpoints] Editing code while debug is active
Change-Id: I68361b490a1ba84f0530db37a2da7558c1b762c7
Also-by: Jonah Graham <jonah@kichwacoders.com>
Signed-off-by: Stefan Sprenger <stefan@sprenger.software>
Signed-off-by: Jonah Graham <jonah@kichwacoders.com>
4 files changed, 40 insertions, 7 deletions
diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/model/ICLineBreakpoint2.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/model/ICLineBreakpoint2.java index b2f67e2350c..3eacf0c91b2 100644 --- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/model/ICLineBreakpoint2.java +++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/model/ICLineBreakpoint2.java @@ -58,6 +58,18 @@ public interface ICLineBreakpoint2 extends ICLineBreakpoint, ICBreakpoint2 { public static final String REQUESTED_SOURCE_HANDLE = "requestedSourceHandle"; //$NON-NLS-1$ /** + * Breakpoint attribute which is set if the installed line number of a + * breakpoint is changed. + * + * Triggers an update of the installed location, if set. + * + * This attribute is a <code>Boolean</code>. + * + * @since 8.0 + */ + public static final String RESET_INSTALLED_LOCATION = "resetInstalledLocation"; //$NON-NLS-1$ + + /** * Returns the line number where the breakpoint was set before it was relocated to a * valid source line. * diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/breakpoints/AbstractLineBreakpoint.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/breakpoints/AbstractLineBreakpoint.java index a27942b8712..bf20ec1018e 100644 --- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/breakpoints/AbstractLineBreakpoint.java +++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/breakpoints/AbstractLineBreakpoint.java @@ -150,22 +150,29 @@ public abstract class AbstractLineBreakpoint extends CBreakpoint implements ICLi @Override public void setRequestedSourceHandle(String fileName) throws CoreException { setAttribute( ICLineBreakpoint2.REQUESTED_SOURCE_HANDLE, fileName ); + setAttribute(RESET_INSTALLED_LOCATION, Boolean.TRUE); } @Override public synchronized int decrementInstallCount() throws CoreException { int count = super.decrementInstallCount(); + if (count == 0) { - resetInstalledLocation(); + if (Boolean.TRUE.equals(this.getMarker().getAttribute(RESET_INSTALLED_LOCATION))) { + resetInstalledLocation(); + setAttribute(RESET_INSTALLED_LOCATION, Boolean.FALSE); + } } + return count; } - + @Override public void setInstalledLineNumber(int line) throws CoreException { int existingValue = ensureMarker().getAttribute(IMarker.LINE_NUMBER, -1); if (line != existingValue) { setAttribute(IMarker.LINE_NUMBER, line); + setAttribute(RESET_INSTALLED_LOCATION, Boolean.TRUE); setAttribute( IMarker.MESSAGE, getMarkerMessage() ); } } @@ -175,6 +182,7 @@ public abstract class AbstractLineBreakpoint extends CBreakpoint implements ICLi int existingValue = ensureMarker().getAttribute(IMarker.CHAR_START, -1); if (charStart != existingValue) { setAttribute(IMarker.CHAR_START, charStart); + setAttribute(RESET_INSTALLED_LOCATION, Boolean.TRUE); setAttribute( IMarker.MESSAGE, getMarkerMessage() ); } } @@ -184,6 +192,7 @@ public abstract class AbstractLineBreakpoint extends CBreakpoint implements ICLi int existingValue = ensureMarker().getAttribute(IMarker.CHAR_END, -1); if (charEnd != existingValue) { setAttribute(IMarker.CHAR_END, charEnd); + setAttribute(RESET_INSTALLED_LOCATION, Boolean.TRUE); setAttribute( IMarker.MESSAGE, getMarkerMessage() ); } } diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/breakpoints/CLineTracepoint.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/breakpoints/CLineTracepoint.java index b60c37141e1..4d2f4c48005 100644 --- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/breakpoints/CLineTracepoint.java +++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/breakpoints/CLineTracepoint.java @@ -50,9 +50,14 @@ public class CLineTracepoint extends AbstractTracepoint implements ICTracepoint, @Override public synchronized int decrementInstallCount() throws CoreException { int count = super.decrementInstallCount(); - if (count == 0) { - resetInstalledLocation(); + + if (Boolean.TRUE.equals(this.getMarker().getAttribute(RESET_INSTALLED_LOCATION))) { + if (count == 0) { + resetInstalledLocation(); + setAttribute(RESET_INSTALLED_LOCATION, Boolean.FALSE); + } } + return count; } @@ -102,6 +107,7 @@ public class CLineTracepoint extends AbstractTracepoint implements ICTracepoint, @Override public void setRequestedSourceHandle(String fileName) throws CoreException { setAttribute( ICLineBreakpoint2.REQUESTED_SOURCE_HANDLE, fileName ); + setAttribute(RESET_INSTALLED_LOCATION, Boolean.FALSE); } @Override @@ -109,6 +115,7 @@ public class CLineTracepoint extends AbstractTracepoint implements ICTracepoint, int existingValue = ensureMarker().getAttribute(IMarker.LINE_NUMBER, -1); if (line != existingValue) { setAttribute(IMarker.LINE_NUMBER, line); + setAttribute(RESET_INSTALLED_LOCATION, Boolean.TRUE); setAttribute( IMarker.MESSAGE, getMarkerMessage() ); } } @@ -118,6 +125,7 @@ public class CLineTracepoint extends AbstractTracepoint implements ICTracepoint, int existingValue = ensureMarker().getAttribute(IMarker.CHAR_START, -1); if (charStart != existingValue) { setAttribute(IMarker.CHAR_START, charStart); + setAttribute(RESET_INSTALLED_LOCATION, Boolean.TRUE); setAttribute( IMarker.MESSAGE, getMarkerMessage() ); } } @@ -127,6 +135,7 @@ public class CLineTracepoint extends AbstractTracepoint implements ICTracepoint, int existingValue = ensureMarker().getAttribute(IMarker.CHAR_END, -1); if (charEnd != existingValue) { setAttribute(IMarker.CHAR_END, charEnd); + setAttribute(RESET_INSTALLED_LOCATION, Boolean.TRUE); setAttribute( IMarker.MESSAGE, getMarkerMessage() ); } } diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/breakpoints/CBreakpointPreferenceStore.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/breakpoints/CBreakpointPreferenceStore.java index 20cf915c50a..2477958b704 100644 --- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/breakpoints/CBreakpointPreferenceStore.java +++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/breakpoints/CBreakpointPreferenceStore.java @@ -200,10 +200,13 @@ public class CBreakpointPreferenceStore implements IPersistentPreferenceStore { } else if ( property.equals( IMarker.LINE_NUMBER ) ) { if (breakpoint instanceof ICLineBreakpoint2) { - // Must set the REQUESTED_LINE attribute first, or else the breakpoint - // message will be refreshed improperly + // refresh message and line number + // Note there are no API methods to set the line number of a Line Breakpoint, so we + // replicate what is done in CDIDebugModel.setLineBreakpointAttributes() + // to set the line number fields properly and then refresh the message if possible ((ICLineBreakpoint2)breakpoint).setRequestedLine(getInt(IMarker.LINE_NUMBER)); - ((ICLineBreakpoint2)breakpoint).setInstalledLineNumber(getInt(IMarker.LINE_NUMBER)); + breakpoint.getMarker().setAttribute(IMarker.LINE_NUMBER, getInt(IMarker.LINE_NUMBER)); + ((ICBreakpoint2)breakpoint).refreshMessage(); } else { // already workspace runnable, setting markers are safe breakpoint.getMarker().setAttribute(IMarker.LINE_NUMBER, getInt(IMarker.LINE_NUMBER)); |
