Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMikhail Khodjaiants2013-05-16 20:18:50 +0000
committerMikhail Khodjaiants2013-05-28 18:05:35 +0000
commit8e799abc43c3595e30277d95b76439867e919c95 (patch)
treeb0b8c5613bee6cc1f2088c5ddb1e62039704f6e7 /dsf-gdb
parent67425186a2c74e1215670c6a1edd2162b474819d (diff)
downloadorg.eclipse.cdt-8e799abc43c3595e30277d95b76439867e919c95.tar.gz
org.eclipse.cdt-8e799abc43c3595e30277d95b76439867e919c95.tar.xz
org.eclipse.cdt-8e799abc43c3595e30277d95b76439867e919c95.zip
Bug 407647 - Duplicate target line breakpoints created when setting a
GDB console line breakpoint Change-Id: I4281cc2a7d623801490339b17b3c1a31c39042aa Reviewed-on: https://git.eclipse.org/r/13039 Reviewed-by: Marc Khouzam <marc.khouzam@ericsson.com> Reviewed-by: Mikhail Khodjaiants <mikhailkhod@googlemail.com> IP-Clean: Mikhail Khodjaiants <mikhailkhod@googlemail.com> Tested-by: Mikhail Khodjaiants <mikhailkhod@googlemail.com>
Diffstat (limited to 'dsf-gdb')
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBBreakpoints_7_4.java6
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBRunControl_7_0_NS.java19
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/IMIBreakpointPathAdjuster.java23
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIBreakpoints.java22
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIBreakpointsManager.java21
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIBreakpointsSynchronizer.java5
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIRunControl.java9
7 files changed, 73 insertions, 32 deletions
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBBreakpoints_7_4.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBBreakpoints_7_4.java
index 4b871a9a251..f6e42a76abd 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBBreakpoints_7_4.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBBreakpoints_7_4.java
@@ -295,4 +295,10 @@ public class GDBBreakpoints_7_4 extends GDBBreakpoints_7_2 implements IEventList
}
super.deleteBreakpointFromTarget(context, reference, finalRm);
}
+
+ @Override
+ public String adjustDebuggerPath(String originalPath) {
+ // No adjustment is required
+ return originalPath;
+ }
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBRunControl_7_0_NS.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBRunControl_7_0_NS.java
index b4361367d53..b23e19ae9c2 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBRunControl_7_0_NS.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBRunControl_7_0_NS.java
@@ -65,6 +65,7 @@ import org.eclipse.cdt.dsf.gdb.internal.service.command.events.MITracepointSelec
import org.eclipse.cdt.dsf.gdb.internal.service.control.StepIntoSelectionActiveOperation;
import org.eclipse.cdt.dsf.gdb.internal.service.control.StepIntoSelectionUtils;
import org.eclipse.cdt.dsf.gdb.service.IGDBTraceControl.ITraceRecordSelectedChangedDMEvent;
+import org.eclipse.cdt.dsf.mi.service.IMIBreakpointPathAdjuster;
import org.eclipse.cdt.dsf.mi.service.IMICommandControl;
import org.eclipse.cdt.dsf.mi.service.IMIContainerDMContext;
import org.eclipse.cdt.dsf.mi.service.IMIExecutionDMContext;
@@ -101,7 +102,6 @@ import org.eclipse.cdt.dsf.service.AbstractDsfService;
import org.eclipse.cdt.dsf.service.DsfServiceEventHandler;
import org.eclipse.cdt.dsf.service.DsfSession;
import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.Status;
import org.eclipse.debug.core.DebugException;
import org.osgi.framework.BundleContext;
@@ -2141,19 +2141,12 @@ public class GDBRunControl_7_0_NS extends AbstractDsfService implements IMIRunCo
*
* @param path
* the absolute path to the source file
- * @return the simple filename if running on Windows and [path] is not an
- * absolute UNIX one. Otherwise, [path] is returned
+ * @return the adjusted path provided by the breakpoints service
*/
- private static String adjustDebuggerPath(String path) {
- String result = path;
- // Make it MinGW-specific
- if (Platform.getOS().startsWith("win")) { //$NON-NLS-1$
- if (!path.startsWith("/")) { //$NON-NLS-1$
- path = path.replace('\\', '/');
- result = path.substring(path.lastIndexOf('/') + 1);
- }
- }
- return result;
+ private String adjustDebuggerPath(String path) {
+ IBreakpoints breakpoints = getServicesTracker().getService(IBreakpoints.class);
+ return (breakpoints instanceof IMIBreakpointPathAdjuster) ?
+ ((IMIBreakpointPathAdjuster)breakpoints).adjustDebuggerPath(path) : path;
}
///////////////////////////////////////////////////////////////////////////
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/IMIBreakpointPathAdjuster.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/IMIBreakpointPathAdjuster.java
new file mode 100644
index 00000000000..529033f528b
--- /dev/null
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/IMIBreakpointPathAdjuster.java
@@ -0,0 +1,23 @@
+/*******************************************************************************
+ * Copyright (c) 2013 Mentor Graphics and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Mentor Graphics - Initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.cdt.dsf.mi.service;
+
+/**
+ * Adjustment of the debugger path is required for earlier versions of GDB to
+ * provide a workaround for https://bugs.eclipse.org/bugs/show_bug.cgi?id=232415.
+ *
+ * @since 4.2
+ */
+public interface IMIBreakpointPathAdjuster {
+
+ public String adjustDebuggerPath(String originalPath);
+}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIBreakpoints.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIBreakpoints.java
index 55caaebfa8d..277e2bda924 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIBreakpoints.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIBreakpoints.java
@@ -51,6 +51,7 @@ import org.eclipse.cdt.dsf.service.AbstractDsfService;
import org.eclipse.cdt.dsf.service.DsfServiceEventHandler;
import org.eclipse.cdt.dsf.service.DsfSession;
import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.Status;
import org.osgi.framework.BundleContext;
@@ -58,7 +59,7 @@ import org.osgi.framework.BundleContext;
* Initial breakpoint service implementation.
* Implements the IBreakpoints interface.
*/
-public class MIBreakpoints extends AbstractDsfService implements IBreakpoints, IBreakpointsExtension
+public class MIBreakpoints extends AbstractDsfService implements IBreakpoints, IBreakpointsExtension, IMIBreakpointPathAdjuster
{
/**
* Breakpoint attributes markers used in the map parameters of insert/updateBreakpoint().
@@ -1357,4 +1358,23 @@ public class MIBreakpoints extends AbstractDsfService implements IBreakpoints, I
}
return null;
}
+
+ /**
+ * See https://bugs.eclipse.org/bugs/show_bug.cgi?id=232415
+ * Returns the simple filename if running on Windows and [originalPath] is not an
+ * absolute UNIX one. Otherwise, [originalPath] is returned
+ * @since 4.2
+ */
+ @Override
+ public String adjustDebuggerPath(String originalPath) {
+ String result = originalPath;
+ // Make it MinGW-specific
+ if (Platform.getOS().startsWith("win")) { //$NON-NLS-1$
+ if (!originalPath.startsWith("/")) { //$NON-NLS-1$
+ originalPath = originalPath.replace('\\', '/');
+ result = originalPath.substring(originalPath.lastIndexOf('/') + 1);
+ }
+ }
+ return result;
+ }
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIBreakpointsManager.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIBreakpointsManager.java
index e371a7eedbc..fee8c06c74b 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIBreakpointsManager.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIBreakpointsManager.java
@@ -85,7 +85,6 @@ import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.ListenerList;
-import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.jobs.ISchedulingRule;
import org.eclipse.core.runtime.jobs.Job;
@@ -1623,23 +1622,17 @@ public class MIBreakpointsManager extends AbstractDsfService implements IBreakpo
}
/**
- * See bug 232415
+ * For some platforms (MinGW) the debugger path needs to be adjusted to work
+ * with earlier GDB versions.
+ * See https://bugs.eclipse.org/bugs/show_bug.cgi?id=232415
*
* @param path
* the absolute path to the source file
- * @return the simple filename if running on Windows and [path] is not an
- * absolute UNIX one. Otherwise, [path] is returned
+ * @return the adjusted path provided by the breakpoints service.
*/
- static String adjustDebuggerPath(String path) {
- String result = path;
- // Make it MinGW-specific
- if (Platform.getOS().startsWith("win")) { //$NON-NLS-1$
- if (!path.startsWith("/")) { //$NON-NLS-1$
- path = path.replace('\\', '/');
- result = path.substring(path.lastIndexOf('/') + 1);
- }
- }
- return result;
+ String adjustDebuggerPath(String path) {
+ return (fBreakpoints instanceof IMIBreakpointPathAdjuster) ?
+ ((IMIBreakpointPathAdjuster)fBreakpoints).adjustDebuggerPath(path) : path;
}
/**
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIBreakpointsSynchronizer.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIBreakpointsSynchronizer.java
index 731d8c3ed2d..0651a072d03 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIBreakpointsSynchronizer.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIBreakpointsSynchronizer.java
@@ -961,7 +961,7 @@ public class MIBreakpointsSynchronizer extends AbstractDsfService implements IMI
&& (address == null || !address.equals(getPlatformAddress(miBpt.getAddress()).toHexAddressString())))
return false;
if (isLineBreakpoint(miBpt)) {
- if (fileName == null || !fileName.equals(miBptFileName))
+ if (fileName == null || miBptFileName == null || !new File(fileName).equals(new File(miBptFileName)))
return false;
if (lineNumber == null || lineNumber.intValue() != getLineNumber(miBpt))
return false;
@@ -996,7 +996,8 @@ public class MIBreakpointsSynchronizer extends AbstractDsfService implements IMI
isPlatformFunctionBreakpoint((ICFunctionBreakpoint)plBpt, miBpt) : false;
}
try {
- if (fileName == null || !fileName.equals(plBpt.getSourceHandle()))
+ if (fileName == null || plBpt.getSourceHandle() == null
+ || !new File(fileName).equals(new File(plBpt.getSourceHandle())))
return false;
if (plBpt.getLineNumber() != getLineNumber(miBpt))
return false;
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIRunControl.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIRunControl.java
index e5cc1412f58..52d5fe64f9f 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIRunControl.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIRunControl.java
@@ -1615,13 +1615,18 @@ public class MIRunControl extends AbstractDsfService implements IMIRunControl, I
*/
protected void determineDebuggerPath(IDMContext dmc, String hostPath, final DataRequestMonitor<String> rm)
{
+ final IBreakpoints breakpoints = getServicesTracker().getService(IBreakpoints.class);
+ if (!(breakpoints instanceof IMIBreakpointPathAdjuster)) {
+ rm.done(hostPath);
+ return;
+ }
ISourceLookup sourceLookup = getServicesTracker().getService(ISourceLookup.class);
ISourceLookupDMContext srcDmc = DMContexts.getAncestorOfType(dmc, ISourceLookupDMContext.class);
if (sourceLookup == null || srcDmc == null) {
// Source lookup not available for given context, use the host
// path for the debugger path.
// Hack around a MinGW bug; see 369622 (and also 196154 and 232415)
- rm.done(MIBreakpointsManager.adjustDebuggerPath(hostPath));
+ rm.done(((IMIBreakpointPathAdjuster)breakpoints).adjustDebuggerPath(hostPath));
return;
}
@@ -1629,7 +1634,7 @@ public class MIRunControl extends AbstractDsfService implements IMIRunControl, I
@Override
protected void handleSuccess() {
// Hack around a MinGW bug; see 369622 (and also 196154 and 232415)
- rm.done(MIBreakpointsManager.adjustDebuggerPath(getData()));
+ rm.done(((IMIBreakpointPathAdjuster)breakpoints).adjustDebuggerPath(getData()));
}
});
}

Back to the top