diff options
author | eutarass | 2011-09-09 17:47:59 +0000 |
---|---|---|
committer | eutarass | 2011-09-09 17:47:59 +0000 |
commit | 6af4a881a8545dd9099765efa6a87999f85e8c66 (patch) | |
tree | f2eb76cb744662c7ac1f7dce2d4e93e1f9580a5f /plugins | |
parent | da88b9a9263f5a97b98112dd7a600ffaf331a181 (diff) | |
download | org.eclipse.tcf-6af4a881a8545dd9099765efa6a87999f85e8c66.tar.gz org.eclipse.tcf-6af4a881a8545dd9099765efa6a87999f85e8c66.tar.xz org.eclipse.tcf-6af4a881a8545dd9099765efa6a87999f85e8c66.zip |
TCF Debugger: fixed: the debugger should never try to lookup source files using partial file names.
Diffstat (limited to 'plugins')
9 files changed, 38 insertions, 59 deletions
diff --git a/plugins/org.eclipse.tm.tcf.cdt.ui/src/org/eclipse/tm/internal/tcf/cdt/ui/TCFBreakpointStatusListener.java b/plugins/org.eclipse.tm.tcf.cdt.ui/src/org/eclipse/tm/internal/tcf/cdt/ui/TCFBreakpointStatusListener.java index ecd17f329..56df3d78c 100644 --- a/plugins/org.eclipse.tm.tcf.cdt.ui/src/org/eclipse/tm/internal/tcf/cdt/ui/TCFBreakpointStatusListener.java +++ b/plugins/org.eclipse.tm.tcf.cdt.ui/src/org/eclipse/tm/internal/tcf/cdt/ui/TCFBreakpointStatusListener.java @@ -356,7 +356,7 @@ class TCFBreakpointStatusListener { for (ILaunch launch : DebugPlugin.getDefault().getLaunchManager().getLaunches()) {
if (launch instanceof TCFLaunch) {
TCFLaunch tcfLaunch = (TCFLaunch) launch;
- if (!tcfLaunch.isDisconnected() && !tcfLaunch.isConnecting() && tcfLaunch.getBreakpointsStatus() != null) {
+ if (!tcfLaunch.isDisconnected() && !tcfLaunch.isConnecting()) {
launch_listener.onConnected(tcfLaunch, model_manager.getModel(tcfLaunch));
}
}
diff --git a/plugins/org.eclipse.tm.tcf.cdt.ui/src/org/eclipse/tm/internal/tcf/cdt/ui/TCFSuspendResumeAdapter.java b/plugins/org.eclipse.tm.tcf.cdt.ui/src/org/eclipse/tm/internal/tcf/cdt/ui/TCFSuspendResumeAdapter.java index 481dda179..1917c94a2 100644 --- a/plugins/org.eclipse.tm.tcf.cdt.ui/src/org/eclipse/tm/internal/tcf/cdt/ui/TCFSuspendResumeAdapter.java +++ b/plugins/org.eclipse.tm.tcf.cdt.ui/src/org/eclipse/tm/internal/tcf/cdt/ui/TCFSuspendResumeAdapter.java @@ -10,7 +10,6 @@ *******************************************************************************/
package org.eclipse.tm.internal.tcf.cdt.ui;
-import java.math.BigInteger;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.Map;
diff --git a/plugins/org.eclipse.tm.tcf.cdt.ui/src/org/eclipse/tm/internal/tcf/cdt/ui/disassembly/TCFDisassemblyBackend.java b/plugins/org.eclipse.tm.tcf.cdt.ui/src/org/eclipse/tm/internal/tcf/cdt/ui/disassembly/TCFDisassemblyBackend.java index 0b4141783..775914e2c 100644 --- a/plugins/org.eclipse.tm.tcf.cdt.ui/src/org/eclipse/tm/internal/tcf/cdt/ui/disassembly/TCFDisassemblyBackend.java +++ b/plugins/org.eclipse.tm.tcf.cdt.ui/src/org/eclipse/tm/internal/tcf/cdt/ui/disassembly/TCFDisassemblyBackend.java @@ -30,13 +30,12 @@ import org.eclipse.core.runtime.Status; import org.eclipse.debug.core.DebugPlugin;
import org.eclipse.debug.core.ILaunch;
import org.eclipse.debug.core.ILaunchesListener;
-import org.eclipse.debug.core.model.ISourceLocator;
-import org.eclipse.debug.core.sourcelookup.ISourceLookupDirector;
import org.eclipse.jface.dialogs.ErrorDialog;
import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.IDocumentExtension4;
import org.eclipse.jface.text.Position;
import org.eclipse.tm.internal.tcf.cdt.ui.Activator;
+import org.eclipse.tm.internal.tcf.debug.launch.TCFSourceLookupDirector;
import org.eclipse.tm.internal.tcf.debug.model.TCFContextState;
import org.eclipse.tm.internal.tcf.debug.model.TCFSourceRef;
import org.eclipse.tm.internal.tcf.debug.ui.model.TCFChildrenStackTrace;
@@ -939,13 +938,8 @@ public class TCFDisassemblyBackend implements IDisassemblyBackend { public Object insertSource(Position pos, BigInteger address, String file, int lineNumber) {
TCFNodeExecContext execContext = fExecContext;
- if (execContext != null) {
- ISourceLocator locator = fExecContext.getModel().getLaunch().getSourceLocator();
- if (locator instanceof ISourceLookupDirector) {
- return ((ISourceLookupDirector)locator).getSourceElement(file);
- }
- }
- return null;
+ if (execContext == null) return null;
+ return TCFSourceLookupDirector.lookup(execContext.getModel().getLaunch().getSourceLocator(), file);
}
private static BigInteger toBigInteger(byte[] data, boolean big_endian, boolean sign_extension) {
diff --git a/plugins/org.eclipse.tm.tcf.cdt.ui/src/org/eclipse/tm/internal/tcf/cdt/ui/sourcelookup/TCFCSourceNotFoundEditor.java b/plugins/org.eclipse.tm.tcf.cdt.ui/src/org/eclipse/tm/internal/tcf/cdt/ui/sourcelookup/TCFCSourceNotFoundEditor.java index 607f7bb52..58eaec3a1 100644 --- a/plugins/org.eclipse.tm.tcf.cdt.ui/src/org/eclipse/tm/internal/tcf/cdt/ui/sourcelookup/TCFCSourceNotFoundEditor.java +++ b/plugins/org.eclipse.tm.tcf.cdt.ui/src/org/eclipse/tm/internal/tcf/cdt/ui/sourcelookup/TCFCSourceNotFoundEditor.java @@ -90,5 +90,4 @@ public class TCFCSourceNotFoundEditor extends CSourceNotFoundEditor { }
});
}
-
}
diff --git a/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/launch/TCFPathMapTab.java b/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/launch/TCFPathMapTab.java index a44c736be..b4f54d074 100644 --- a/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/launch/TCFPathMapTab.java +++ b/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/launch/TCFPathMapTab.java @@ -59,9 +59,16 @@ public class TCFPathMapTab extends AbstractLaunchConfigurationTab { private static final String[] column_ids = { IPathMap.PROP_SOURCE, + IPathMap.PROP_DESTINATION, IPathMap.PROP_HOST, IPathMap.PROP_PROTOCOL, - IPathMap.PROP_DESTINATION, + }; + + private static final int[] column_size = { + 300, + 300, + 50, + 50, }; private static final String TAB_ID = "org.eclipse.tm.tcf.launch.pathMapTab"; @@ -157,7 +164,7 @@ public class TCFPathMapTab extends AbstractLaunchConfigurationTab { GridLayout layout = new GridLayout(2, false); composite.setFont(font); composite.setLayout(layout); - composite.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, true, 2, 1)); + composite.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, true, 1, 1)); viewer = new TableViewer(composite, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL | SWT.MULTI | SWT.FULL_SELECTION); Table table = viewer.getTable(); @@ -173,7 +180,7 @@ public class TCFPathMapTab extends AbstractLaunchConfigurationTab { for (int i = 0; i < column_ids.length; i++) { TableColumn c = new TableColumn(table, SWT.NONE, i); c.setText(column_ids[i]); - c.setWidth(600 / column_ids.length); + c.setWidth(column_size[i]); editors[i] = new TextCellEditor(table); } viewer.setCellEditors(editors); diff --git a/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/model/TCFAnnotationManager.java b/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/model/TCFAnnotationManager.java index 8b8c4b1d7..cbafcd680 100644 --- a/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/model/TCFAnnotationManager.java +++ b/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/model/TCFAnnotationManager.java @@ -28,7 +28,6 @@ import org.eclipse.debug.core.ILaunchConfiguration; import org.eclipse.debug.core.ILaunchConfigurationListener; import org.eclipse.debug.core.ILaunchManager; import org.eclipse.debug.core.model.ISourceLocator; -import org.eclipse.debug.core.sourcelookup.ISourceLookupDirector; import org.eclipse.debug.ui.DebugUITools; import org.eclipse.debug.ui.IDebugUIConstants; import org.eclipse.debug.ui.ISourcePresentation; @@ -44,7 +43,6 @@ import org.eclipse.swt.graphics.Device; import org.eclipse.swt.graphics.Image; import org.eclipse.swt.widgets.Display; import org.eclipse.tm.internal.tcf.debug.launch.TCFSourceLookupDirector; -import org.eclipse.tm.internal.tcf.debug.launch.TCFSourceLookupParticipant; import org.eclipse.tm.internal.tcf.debug.model.ITCFBreakpointListener; import org.eclipse.tm.internal.tcf.debug.model.TCFBreakpoint; import org.eclipse.tm.internal.tcf.debug.model.TCFBreakpointsStatus; @@ -546,21 +544,7 @@ public class TCFAnnotationManager { ISourceLocator locator = node.launch.getSourceLocator(); ISourcePresentation presentation = TCFModelPresentation.getDefault(); for (TCFAnnotation a : set) { - Object source_element = null; - if (locator instanceof TCFSourceLookupDirector) { - source_element = ((TCFSourceLookupDirector)locator).getSourceElement(a.area); - } - else if (locator instanceof ISourceLookupDirector) { - // support for foreign (CDT) source locator - String filename = TCFSourceLookupParticipant.toFileName(a.area); - if (filename != null) { - source_element = ((ISourceLookupDirector)locator).getSourceElement(filename); - if (source_element == null && !filename.equals(a.area.file)) { - // retry with relative path - source_element = ((ISourceLookupDirector)locator).getSourceElement(a.area.file); - } - } - } + Object source_element = TCFSourceLookupDirector.lookup(locator, a.area); if (source_element == null) continue; IEditorInput editor_input = presentation.getEditorInput(source_element); ITextEditor editor = editors.get(editor_input); diff --git a/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/model/TCFModel.java b/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/model/TCFModel.java index 6be8b25e1..491ba1fc7 100644 --- a/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/model/TCFModel.java +++ b/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/model/TCFModel.java @@ -38,7 +38,6 @@ import org.eclipse.debug.core.model.IExpression; import org.eclipse.debug.core.model.IMemoryBlockRetrieval; import org.eclipse.debug.core.model.IMemoryBlockRetrievalExtension; import org.eclipse.debug.core.model.ISourceLocator; -import org.eclipse.debug.core.sourcelookup.ISourceLookupDirector; import org.eclipse.debug.internal.ui.viewers.model.provisional.IChildrenCountUpdate; import org.eclipse.debug.internal.ui.viewers.model.provisional.IChildrenUpdate; import org.eclipse.debug.internal.ui.viewers.model.provisional.IColumnPresentation; @@ -1306,21 +1305,7 @@ public class TCFModel implements IElementContentProvider, IElementLabelProvider, int line = 0; if (area != null) { ISourceLocator locator = getLaunch().getSourceLocator(); - Object source_element = null; - if (locator instanceof TCFSourceLookupDirector) { - source_element = ((TCFSourceLookupDirector)locator).getSourceElement(area); - } - else if (locator instanceof ISourceLookupDirector) { - // support for foreign (CDT) source locator - String filename = TCFSourceLookupParticipant.toFileName(area); - if (filename != null) { - source_element = ((ISourceLookupDirector)locator).getSourceElement(filename); - if (source_element == null && !filename.equals(area.file)) { - // retry with relative path - source_element = ((ISourceLookupDirector)locator).getSourceElement(area.file); - } - } - } + Object source_element = TCFSourceLookupDirector.lookup(locator, area); if (source_element != null) { ISourcePresentation presentation = TCFModelPresentation.getDefault(); editor_input = presentation.getEditorInput(source_element); diff --git a/plugins/org.eclipse.tm.tcf.debug/src/org/eclipse/tm/internal/tcf/debug/launch/TCFSourceLookupDirector.java b/plugins/org.eclipse.tm.tcf.debug/src/org/eclipse/tm/internal/tcf/debug/launch/TCFSourceLookupDirector.java index 7224bb0c9..48cc08230 100644 --- a/plugins/org.eclipse.tm.tcf.debug/src/org/eclipse/tm/internal/tcf/debug/launch/TCFSourceLookupDirector.java +++ b/plugins/org.eclipse.tm.tcf.debug/src/org/eclipse/tm/internal/tcf/debug/launch/TCFSourceLookupDirector.java @@ -10,8 +10,12 @@ *******************************************************************************/ package org.eclipse.tm.internal.tcf.debug.launch; +import org.eclipse.debug.core.model.ISourceLocator; +import org.eclipse.debug.core.model.IStackFrame; import org.eclipse.debug.core.sourcelookup.AbstractSourceLookupDirector; +import org.eclipse.debug.core.sourcelookup.ISourceLookupDirector; import org.eclipse.debug.core.sourcelookup.ISourceLookupParticipant; +import org.eclipse.tm.tcf.services.ILineNumbers; /** * TCF source lookup director. @@ -19,6 +23,23 @@ import org.eclipse.debug.core.sourcelookup.ISourceLookupParticipant; */ public class TCFSourceLookupDirector extends AbstractSourceLookupDirector { + public static Object lookup(ISourceLocator locator, Object element) { + Object source_element = null; + if (locator instanceof ISourceLookupDirector) { + if (element instanceof ILineNumbers.CodeArea) { + String file_name = TCFSourceLookupParticipant.toFileName((ILineNumbers.CodeArea)element); + if (file_name != null) source_element = ((ISourceLookupDirector)locator).getSourceElement(file_name); + } + else { + source_element = ((ISourceLookupDirector)locator).getSourceElement(element); + } + } + else if (element instanceof IStackFrame) { + source_element = locator.getSourceElement((IStackFrame)element); + } + return source_element; + } + public void initializeParticipants() { addParticipants(new ISourceLookupParticipant[] { new TCFSourceLookupParticipant() }); } diff --git a/plugins/org.eclipse.tm.tcf.debug/src/org/eclipse/tm/internal/tcf/debug/launch/TCFSourceLookupParticipant.java b/plugins/org.eclipse.tm.tcf.debug/src/org/eclipse/tm/internal/tcf/debug/launch/TCFSourceLookupParticipant.java index 3e3d289c1..350f72a48 100644 --- a/plugins/org.eclipse.tm.tcf.debug/src/org/eclipse/tm/internal/tcf/debug/launch/TCFSourceLookupParticipant.java +++ b/plugins/org.eclipse.tm.tcf.debug/src/org/eclipse/tm/internal/tcf/debug/launch/TCFSourceLookupParticipant.java @@ -110,23 +110,13 @@ public class TCFSourceLookupParticipant extends AbstractSourceLookupParticipant } private Object[] findSource(String name) throws CoreException { - name = applyPathMap(name); - File file = new File(name); Object[] res; + File file = new File(applyPathMap(name)); if (file.isAbsolute() && file.exists() && file.isFile()) { res = new Object[]{ new LocalFileStorage(file) }; } else { res = super.findSourceElements(name); - if (res == null || res.length == 0) { - // Remove file path and search by file base name - String base = name; - int i = name.lastIndexOf('/'); - int j = name.lastIndexOf('\\'); - if (i > j) base = name.substring(i + 1); - if (j > i) base = name.substring(j + 1); - if (!base.equals(name)) res = super.findSourceElements(base); - } } ArrayList<Object> list = new ArrayList<Object>(); for (Object o : res) { |