Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarc Khouzam2013-01-03 16:52:19 +0000
committerMarc Khouzam2013-01-07 19:29:41 +0000
commit42e77063f63e40f082aec6af30630c200566e68c (patch)
tree800c41cc3bcdc87fe59648435ed06f3fe1230ee4
parent0698f1aae5c91294017750b92f69580ff34c03f0 (diff)
downloadorg.eclipse.cdt-42e77063f63e40f082aec6af30630c200566e68c.tar.gz
org.eclipse.cdt-42e77063f63e40f082aec6af30630c200566e68c.tar.xz
org.eclipse.cdt-42e77063f63e40f082aec6af30630c200566e68c.zip
Bug 380344 - RunToLine or MoveToLine doesn't use sourcelookup to set its
temporary breakpoint Change-Id: Ibde43ce9c3c8edba581db0a7caac204657e8c7b0 Reviewed-on: https://git.eclipse.org/r/9433 Reviewed-by: Mikhail Khodjaiants <mikhailkhod@googlemail.com> IP-Clean: Mikhail Khodjaiants <mikhailkhod@googlemail.com> Tested-by: Mikhail Khodjaiants <mikhailkhod@googlemail.com> Reviewed-by: Sergey Prigogin <eclipse.sprigogin@gmail.com> IP-Clean: Sergey Prigogin <eclipse.sprigogin@gmail.com> Tested-by: Sergey Prigogin <eclipse.sprigogin@gmail.com>
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBRunControl_7_0_NS.java90
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIRunControl.java91
2 files changed, 127 insertions, 54 deletions
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 d8eb3adaac6..a3d72580739 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
@@ -51,6 +51,8 @@ import org.eclipse.cdt.dsf.debug.service.IProcesses.IProcessDMContext;
import org.eclipse.cdt.dsf.debug.service.IProcesses.IThreadDMContext;
import org.eclipse.cdt.dsf.debug.service.IRunControl;
import org.eclipse.cdt.dsf.debug.service.IRunControl2;
+import org.eclipse.cdt.dsf.debug.service.ISourceLookup;
+import org.eclipse.cdt.dsf.debug.service.ISourceLookup.ISourceLookupDMContext;
import org.eclipse.cdt.dsf.debug.service.IStack.IFrameDMContext;
import org.eclipse.cdt.dsf.debug.service.command.ICommand;
import org.eclipse.cdt.dsf.debug.service.command.ICommandControlService;
@@ -1727,13 +1729,15 @@ public class GDBRunControl_7_0_NS extends AbstractDsfService implements IMIRunCo
* @since 3.0
*/
@Override
- public void runToLine(IExecutionDMContext context, String sourceFile,
- int lineNumber, boolean skipBreakpoints, RequestMonitor rm) {
+ public void runToLine(final IExecutionDMContext context, String sourceFile,
+ final int lineNumber, final boolean skipBreakpoints, final RequestMonitor rm) {
- // Hack around a MinGW bug; see 196154
- sourceFile = adjustDebuggerPath(sourceFile);
-
- runToLocation(context, sourceFile + ":" + Integer.toString(lineNumber), skipBreakpoints, rm); //$NON-NLS-1$
+ determineDebuggerPath(context, sourceFile, new ImmediateDataRequestMonitor<String>(rm) {
+ @Override
+ protected void handleSuccess() {
+ runToLocation(context, getData() + ":" + Integer.toString(lineNumber), skipBreakpoints, rm); //$NON-NLS-1$
+ }
+ });
}
/* (non-Javadoc)
@@ -1778,33 +1782,37 @@ public class GDBRunControl_7_0_NS extends AbstractDsfService implements IMIRunCo
* @since 3.0
*/
@Override
- public void moveToLine(IExecutionDMContext context, String sourceFile,
- int lineNumber, boolean resume, RequestMonitor rm) {
- IMIExecutionDMContext threadExecDmc = DMContexts.getAncestorOfType(context, IMIExecutionDMContext.class);
+ public void moveToLine(final IExecutionDMContext context, String sourceFile,
+ final int lineNumber, final boolean resume, final RequestMonitor rm) {
+ final IMIExecutionDMContext threadExecDmc = DMContexts.getAncestorOfType(context, IMIExecutionDMContext.class);
if (threadExecDmc == null) {
rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, DebugException.REQUEST_FAILED, "Invalid thread context", null)); //$NON-NLS-1$
rm.done();
}
else
{
- // Hack around a MinGW bug; see 369622 (and also 196154 and 232415)
- sourceFile = adjustDebuggerPath(sourceFile);
-
- String location = sourceFile + ":" + lineNumber; //$NON-NLS-1$
- if (resume)
- resumeAtLocation(context, location, rm);
- else
- {
- // Create the breakpoint attributes
- Map<String,Object> attr = new HashMap<String,Object>();
- attr.put(MIBreakpoints.BREAKPOINT_TYPE, MIBreakpoints.BREAKPOINT);
- attr.put(MIBreakpoints.FILE_NAME, sourceFile);
- attr.put(MIBreakpoints.LINE_NUMBER, lineNumber);
- attr.put(MIBreakpointDMData.IS_TEMPORARY, true);
- attr.put(MIBreakpointDMData.THREAD_ID, Integer.toString(threadExecDmc.getThreadId()));
- // Now do the operation
- moveToLocation(context, location, attr, rm);
- }
+ determineDebuggerPath(context, sourceFile, new ImmediateDataRequestMonitor<String>(rm) {
+ @Override
+ protected void handleSuccess() {
+ String debuggerPath = getData();
+
+ String location = debuggerPath + ":" + lineNumber; //$NON-NLS-1$
+ if (resume) {
+ resumeAtLocation(context, location, rm);
+ } else {
+ // Create the breakpoint attributes
+ Map<String,Object> attr = new HashMap<String,Object>();
+ attr.put(MIBreakpoints.BREAKPOINT_TYPE, MIBreakpoints.BREAKPOINT);
+ attr.put(MIBreakpoints.FILE_NAME, debuggerPath);
+ attr.put(MIBreakpoints.LINE_NUMBER, lineNumber);
+ attr.put(MIBreakpointDMData.IS_TEMPORARY, true);
+ attr.put(MIBreakpointDMData.THREAD_ID, Integer.toString(threadExecDmc.getThreadId()));
+
+ // Now do the operation
+ moveToLocation(context, location, attr, rm);
+ }
+ }
+ });
}
}
@@ -1866,6 +1874,34 @@ public class GDBRunControl_7_0_NS extends AbstractDsfService implements IMIRunCo
}
/**
+ * Determine the path that should be sent to the debugger as per the source lookup service.
+ *
+ * @param dmc A context that can be used to obtain the sourcelookup context.
+ * @param hostPath The path of the file on the host, which must be converted.
+ * @param rm The result of the conversion.
+ */
+ private void determineDebuggerPath(IDMContext dmc, String hostPath, final DataRequestMonitor<String> rm)
+ {
+ 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(adjustDebuggerPath(hostPath));
+ return;
+ }
+
+ sourceLookup.getDebuggerPath(srcDmc, hostPath, new DataRequestMonitor<String>(getExecutor(), rm) {
+ @Override
+ protected void handleSuccess() {
+ // Hack around a MinGW bug; see 369622 (and also 196154 and 232415)
+ rm.done(adjustDebuggerPath(getData()));
+ }
+ });
+ }
+
+ /**
* See bug 196154
*
* @param path
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 b15021870f3..de72f05ae9b 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
@@ -21,6 +21,7 @@ import java.util.Map;
import org.eclipse.cdt.core.IAddress;
import org.eclipse.cdt.dsf.concurrent.DataRequestMonitor;
import org.eclipse.cdt.dsf.concurrent.IDsfStatusConstants;
+import org.eclipse.cdt.dsf.concurrent.ImmediateDataRequestMonitor;
import org.eclipse.cdt.dsf.concurrent.ImmediateExecutor;
import org.eclipse.cdt.dsf.concurrent.ImmediateRequestMonitor;
import org.eclipse.cdt.dsf.concurrent.Immutable;
@@ -40,6 +41,8 @@ import org.eclipse.cdt.dsf.debug.service.IBreakpointsExtension.IBreakpointHitDME
import org.eclipse.cdt.dsf.debug.service.ICachingService;
import org.eclipse.cdt.dsf.debug.service.IDisassembly.IDisassemblyDMContext;
import org.eclipse.cdt.dsf.debug.service.IProcesses;
+import org.eclipse.cdt.dsf.debug.service.ISourceLookup;
+import org.eclipse.cdt.dsf.debug.service.ISourceLookup.ISourceLookupDMContext;
import org.eclipse.cdt.dsf.debug.service.IStack.IFrameDMContext;
import org.eclipse.cdt.dsf.debug.service.command.BufferedCommandControl;
import org.eclipse.cdt.dsf.debug.service.command.CommandCache;
@@ -1435,13 +1438,15 @@ public class MIRunControl extends AbstractDsfService implements IMIRunControl, I
* @since 3.0
*/
@Override
- public void runToLine(IExecutionDMContext context, String sourceFile,
- int lineNumber, boolean skipBreakpoints, RequestMonitor rm) {
+ public void runToLine(final IExecutionDMContext context, String sourceFile,
+ final int lineNumber, final boolean skipBreakpoints, final RequestMonitor rm) {
- // Hack around a MinGW bug; see 196154
- sourceFile = MIBreakpointsManager.adjustDebuggerPath(sourceFile);
-
- runToLocation(context, sourceFile + ":" + Integer.toString(lineNumber), skipBreakpoints, rm); //$NON-NLS-1$
+ determineDebuggerPath(context, sourceFile, new ImmediateDataRequestMonitor<String>(rm) {
+ @Override
+ protected void handleSuccess() {
+ runToLocation(context, getData() + ":" + Integer.toString(lineNumber), skipBreakpoints, rm); //$NON-NLS-1$
+ }
+ });
}
/* (non-Javadoc)
@@ -1487,33 +1492,37 @@ public class MIRunControl extends AbstractDsfService implements IMIRunControl, I
* @since 3.0
*/
@Override
- public void moveToLine(IExecutionDMContext context, String sourceFile,
- int lineNumber, boolean resume, RequestMonitor rm) {
- IMIExecutionDMContext threadExecDmc = DMContexts.getAncestorOfType(context, IMIExecutionDMContext.class);
+ public void moveToLine(final IExecutionDMContext context, String sourceFile,
+ final int lineNumber, final boolean resume, final RequestMonitor rm) {
+ final IMIExecutionDMContext threadExecDmc = DMContexts.getAncestorOfType(context, IMIExecutionDMContext.class);
if (threadExecDmc == null) {
rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, DebugException.REQUEST_FAILED, "Invalid thread context", null)); //$NON-NLS-1$
rm.done();
}
else
{
- // Hack around a MinGW bug; see 369622 (and also 196154 and 232415)
- sourceFile = MIBreakpointsManager.adjustDebuggerPath(sourceFile);
-
- String location = sourceFile + ":" + lineNumber; //$NON-NLS-1$
- if (resume)
- resumeAtLocation(context, location, rm);
- else {
- // Create the breakpoint attributes
- Map<String,Object> attr = new HashMap<String,Object>();
- attr.put(MIBreakpoints.BREAKPOINT_TYPE, MIBreakpoints.BREAKPOINT);
- attr.put(MIBreakpoints.FILE_NAME, sourceFile);
- attr.put(MIBreakpoints.LINE_NUMBER, lineNumber);
- attr.put(MIBreakpointDMData.IS_TEMPORARY, true);
- attr.put(MIBreakpointDMData.THREAD_ID, Integer.toString(threadExecDmc.getThreadId()));
-
- // Now do the operation
- moveToLocation(context, location, attr, rm);
- }
+ determineDebuggerPath(context, sourceFile, new ImmediateDataRequestMonitor<String>(rm) {
+ @Override
+ protected void handleSuccess() {
+ String debuggerPath = getData();
+
+ String location = debuggerPath + ":" + lineNumber; //$NON-NLS-1$
+ if (resume) {
+ resumeAtLocation(context, location, rm);
+ } else {
+ // Create the breakpoint attributes
+ Map<String,Object> attr = new HashMap<String,Object>();
+ attr.put(MIBreakpoints.BREAKPOINT_TYPE, MIBreakpoints.BREAKPOINT);
+ attr.put(MIBreakpoints.FILE_NAME, debuggerPath);
+ attr.put(MIBreakpoints.LINE_NUMBER, lineNumber);
+ attr.put(MIBreakpointDMData.IS_TEMPORARY, true);
+ attr.put(MIBreakpointDMData.THREAD_ID, Integer.toString(threadExecDmc.getThreadId()));
+
+ // Now do the operation
+ moveToLocation(context, location, attr, rm);
+ }
+ }
+ });
}
}
@@ -1578,4 +1587,32 @@ public class MIRunControl extends AbstractDsfService implements IMIRunControl, I
// we know GDB is accepting commands
return !fTerminated && fSuspended && !fResumePending;
}
+
+ /**
+ * Determine the path that should be sent to the debugger as per the source lookup service.
+ *
+ * @param dmc A context that can be used to obtain the sourcelookup context.
+ * @param hostPath The path of the file on the host, which must be converted.
+ * @param rm The result of the conversion.
+ */
+ private void determineDebuggerPath(IDMContext dmc, String hostPath, final DataRequestMonitor<String> rm)
+ {
+ 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));
+ return;
+ }
+
+ sourceLookup.getDebuggerPath(srcDmc, hostPath, new DataRequestMonitor<String>(getExecutor(), rm) {
+ @Override
+ protected void handleSuccess() {
+ // Hack around a MinGW bug; see 369622 (and also 196154 and 232415)
+ rm.done(MIBreakpointsManager.adjustDebuggerPath(getData()));
+ }
+ });
+ }
}

Back to the top