mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-01 05:15:43 +02:00
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>
This commit is contained in:
parent
67425186a2
commit
8e799abc43
7 changed files with 73 additions and 32 deletions
|
@ -295,4 +295,10 @@ public class GDBBreakpoints_7_4 extends GDBBreakpoints_7_2 implements IEventList
|
||||||
}
|
}
|
||||||
super.deleteBreakpointFromTarget(context, reference, finalRm);
|
super.deleteBreakpointFromTarget(context, reference, finalRm);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String adjustDebuggerPath(String originalPath) {
|
||||||
|
// No adjustment is required
|
||||||
|
return originalPath;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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.StepIntoSelectionActiveOperation;
|
||||||
import org.eclipse.cdt.dsf.gdb.internal.service.control.StepIntoSelectionUtils;
|
import org.eclipse.cdt.dsf.gdb.internal.service.control.StepIntoSelectionUtils;
|
||||||
import org.eclipse.cdt.dsf.gdb.service.IGDBTraceControl.ITraceRecordSelectedChangedDMEvent;
|
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.IMICommandControl;
|
||||||
import org.eclipse.cdt.dsf.mi.service.IMIContainerDMContext;
|
import org.eclipse.cdt.dsf.mi.service.IMIContainerDMContext;
|
||||||
import org.eclipse.cdt.dsf.mi.service.IMIExecutionDMContext;
|
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.DsfServiceEventHandler;
|
||||||
import org.eclipse.cdt.dsf.service.DsfSession;
|
import org.eclipse.cdt.dsf.service.DsfSession;
|
||||||
import org.eclipse.core.runtime.IStatus;
|
import org.eclipse.core.runtime.IStatus;
|
||||||
import org.eclipse.core.runtime.Platform;
|
|
||||||
import org.eclipse.core.runtime.Status;
|
import org.eclipse.core.runtime.Status;
|
||||||
import org.eclipse.debug.core.DebugException;
|
import org.eclipse.debug.core.DebugException;
|
||||||
import org.osgi.framework.BundleContext;
|
import org.osgi.framework.BundleContext;
|
||||||
|
@ -2141,19 +2141,12 @@ public class GDBRunControl_7_0_NS extends AbstractDsfService implements IMIRunCo
|
||||||
*
|
*
|
||||||
* @param path
|
* @param path
|
||||||
* the absolute path to the source file
|
* the absolute path to the source file
|
||||||
* @return the simple filename if running on Windows and [path] is not an
|
* @return the adjusted path provided by the breakpoints service
|
||||||
* absolute UNIX one. Otherwise, [path] is returned
|
|
||||||
*/
|
*/
|
||||||
private static String adjustDebuggerPath(String path) {
|
private String adjustDebuggerPath(String path) {
|
||||||
String result = path;
|
IBreakpoints breakpoints = getServicesTracker().getService(IBreakpoints.class);
|
||||||
// Make it MinGW-specific
|
return (breakpoints instanceof IMIBreakpointPathAdjuster) ?
|
||||||
if (Platform.getOS().startsWith("win")) { //$NON-NLS-1$
|
((IMIBreakpointPathAdjuster)breakpoints).adjustDebuggerPath(path) : path;
|
||||||
if (!path.startsWith("/")) { //$NON-NLS-1$
|
|
||||||
path = path.replace('\\', '/');
|
|
||||||
result = path.substring(path.lastIndexOf('/') + 1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
|
|
@ -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);
|
||||||
|
}
|
|
@ -51,6 +51,7 @@ import org.eclipse.cdt.dsf.service.AbstractDsfService;
|
||||||
import org.eclipse.cdt.dsf.service.DsfServiceEventHandler;
|
import org.eclipse.cdt.dsf.service.DsfServiceEventHandler;
|
||||||
import org.eclipse.cdt.dsf.service.DsfSession;
|
import org.eclipse.cdt.dsf.service.DsfSession;
|
||||||
import org.eclipse.core.runtime.IStatus;
|
import org.eclipse.core.runtime.IStatus;
|
||||||
|
import org.eclipse.core.runtime.Platform;
|
||||||
import org.eclipse.core.runtime.Status;
|
import org.eclipse.core.runtime.Status;
|
||||||
import org.osgi.framework.BundleContext;
|
import org.osgi.framework.BundleContext;
|
||||||
|
|
||||||
|
@ -58,7 +59,7 @@ import org.osgi.framework.BundleContext;
|
||||||
* Initial breakpoint service implementation.
|
* Initial breakpoint service implementation.
|
||||||
* Implements the IBreakpoints interface.
|
* 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().
|
* 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;
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -85,7 +85,6 @@ import org.eclipse.core.runtime.CoreException;
|
||||||
import org.eclipse.core.runtime.IProgressMonitor;
|
import org.eclipse.core.runtime.IProgressMonitor;
|
||||||
import org.eclipse.core.runtime.IStatus;
|
import org.eclipse.core.runtime.IStatus;
|
||||||
import org.eclipse.core.runtime.ListenerList;
|
import org.eclipse.core.runtime.ListenerList;
|
||||||
import org.eclipse.core.runtime.Platform;
|
|
||||||
import org.eclipse.core.runtime.Status;
|
import org.eclipse.core.runtime.Status;
|
||||||
import org.eclipse.core.runtime.jobs.ISchedulingRule;
|
import org.eclipse.core.runtime.jobs.ISchedulingRule;
|
||||||
import org.eclipse.core.runtime.jobs.Job;
|
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
|
* @param path
|
||||||
* the absolute path to the source file
|
* the absolute path to the source file
|
||||||
* @return the simple filename if running on Windows and [path] is not an
|
* @return the adjusted path provided by the breakpoints service.
|
||||||
* absolute UNIX one. Otherwise, [path] is returned
|
|
||||||
*/
|
*/
|
||||||
static String adjustDebuggerPath(String path) {
|
String adjustDebuggerPath(String path) {
|
||||||
String result = path;
|
return (fBreakpoints instanceof IMIBreakpointPathAdjuster) ?
|
||||||
// Make it MinGW-specific
|
((IMIBreakpointPathAdjuster)fBreakpoints).adjustDebuggerPath(path) : path;
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -961,7 +961,7 @@ public class MIBreakpointsSynchronizer extends AbstractDsfService implements IMI
|
||||||
&& (address == null || !address.equals(getPlatformAddress(miBpt.getAddress()).toHexAddressString())))
|
&& (address == null || !address.equals(getPlatformAddress(miBpt.getAddress()).toHexAddressString())))
|
||||||
return false;
|
return false;
|
||||||
if (isLineBreakpoint(miBpt)) {
|
if (isLineBreakpoint(miBpt)) {
|
||||||
if (fileName == null || !fileName.equals(miBptFileName))
|
if (fileName == null || miBptFileName == null || !new File(fileName).equals(new File(miBptFileName)))
|
||||||
return false;
|
return false;
|
||||||
if (lineNumber == null || lineNumber.intValue() != getLineNumber(miBpt))
|
if (lineNumber == null || lineNumber.intValue() != getLineNumber(miBpt))
|
||||||
return false;
|
return false;
|
||||||
|
@ -996,7 +996,8 @@ public class MIBreakpointsSynchronizer extends AbstractDsfService implements IMI
|
||||||
isPlatformFunctionBreakpoint((ICFunctionBreakpoint)plBpt, miBpt) : false;
|
isPlatformFunctionBreakpoint((ICFunctionBreakpoint)plBpt, miBpt) : false;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
if (fileName == null || !fileName.equals(plBpt.getSourceHandle()))
|
if (fileName == null || plBpt.getSourceHandle() == null
|
||||||
|
|| !new File(fileName).equals(new File(plBpt.getSourceHandle())))
|
||||||
return false;
|
return false;
|
||||||
if (plBpt.getLineNumber() != getLineNumber(miBpt))
|
if (plBpt.getLineNumber() != getLineNumber(miBpt))
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -1615,13 +1615,18 @@ public class MIRunControl extends AbstractDsfService implements IMIRunControl, I
|
||||||
*/
|
*/
|
||||||
protected void determineDebuggerPath(IDMContext dmc, String hostPath, final DataRequestMonitor<String> rm)
|
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);
|
ISourceLookup sourceLookup = getServicesTracker().getService(ISourceLookup.class);
|
||||||
ISourceLookupDMContext srcDmc = DMContexts.getAncestorOfType(dmc, ISourceLookupDMContext.class);
|
ISourceLookupDMContext srcDmc = DMContexts.getAncestorOfType(dmc, ISourceLookupDMContext.class);
|
||||||
if (sourceLookup == null || srcDmc == null) {
|
if (sourceLookup == null || srcDmc == null) {
|
||||||
// Source lookup not available for given context, use the host
|
// Source lookup not available for given context, use the host
|
||||||
// path for the debugger path.
|
// path for the debugger path.
|
||||||
// Hack around a MinGW bug; see 369622 (and also 196154 and 232415)
|
// Hack around a MinGW bug; see 369622 (and also 196154 and 232415)
|
||||||
rm.done(MIBreakpointsManager.adjustDebuggerPath(hostPath));
|
rm.done(((IMIBreakpointPathAdjuster)breakpoints).adjustDebuggerPath(hostPath));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1629,7 +1634,7 @@ public class MIRunControl extends AbstractDsfService implements IMIRunControl, I
|
||||||
@Override
|
@Override
|
||||||
protected void handleSuccess() {
|
protected void handleSuccess() {
|
||||||
// Hack around a MinGW bug; see 369622 (and also 196154 and 232415)
|
// Hack around a MinGW bug; see 369622 (and also 196154 and 232415)
|
||||||
rm.done(MIBreakpointsManager.adjustDebuggerPath(getData()));
|
rm.done(((IMIBreakpointPathAdjuster)breakpoints).adjustDebuggerPath(getData()));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue