Bug 77436 - If no source file can be found, attempt to open file w/absolute path
Summary: If no source file can be found, attempt to open file w/absolute path
Status: VERIFIED FIXED
Alias: None
Product: CDT
Classification: Tools
Component: cdt-debug (show other bugs)
Version: 2.0.2   Edit
Hardware: All All
: P3 enhancement (vote)
Target Milestone: 3.0 M7   Edit
Assignee: Nobody - feel free to take it CLA
QA Contact:
URL:
Whiteboard:
Keywords: contributed
Depends on:
Blocks:
 
Reported: 2004-11-01 18:22 EST by Oyvind Harboe CLA
Modified: 2008-06-18 19:20 EDT (History)
0 users

See Also:


Attachments
Ouch. Pasted patches get word-wrapped. Trying again. (1.89 KB, patch)
2004-11-01 18:24 EST, Oyvind Harboe CLA
bjorn.freeman-benson: iplog+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Oyvind Harboe CLA 2004-11-01 18:22:36 EST
I made the following changes to open up the file if it is an absolute path 
reference:

Index: CSourceLocator.java
===================================================================
RCS 
file: /home/tools/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal
/core/sourcelookup/CSourceLocator.java,v
retrieving revision 1.27
diff -u -r1.27 CSourceLocator.java
--- CSourceLocator.java	18 Jun 2004 22:17:10 -0000	1.27
+++ CSourceLocator.java	1 Nov 2004 23:07:46 -0000
@@ -10,6 +10,7 @@
  ***********************************************************************/
 package org.eclipse.cdt.debug.internal.core.sourcelookup;
 
+import java.io.File;
 import java.io.IOException;
 import java.io.StringReader;
 import java.text.MessageFormat;
@@ -23,6 +24,8 @@
 import javax.xml.parsers.DocumentBuilderFactory;
 import javax.xml.parsers.ParserConfigurationException;
 import javax.xml.transform.TransformerException;
+
+import org.eclipse.cdt.core.resources.FileStorage;
 import org.eclipse.cdt.debug.core.CDebugCorePlugin;
 import org.eclipse.cdt.debug.core.CDebugUtils;
 import org.eclipse.cdt.debug.core.model.ICStackFrame;
@@ -40,6 +43,7 @@
 import org.eclipse.core.runtime.CoreException;
 import org.eclipse.core.runtime.IStatus;
 import org.eclipse.core.runtime.MultiStatus;
+import org.eclipse.core.runtime.Path;
 import org.eclipse.core.runtime.Status;
 import org.eclipse.debug.core.ILaunchConfiguration;
 import org.eclipse.debug.core.model.IPersistableSourceLocator;
@@ -143,6 +147,19 @@
 								list.add( 
result );
 							if ( !
searchForDuplicateFiles() )
 								break;
+						}
+					}
+					
+					/* if we didn't find any source files, 
we'll just try to open the	
+						file as an absolute path 
external file*/
+					if (list.isEmpty())
+					{
+						File file;
+						file=new File(fileName);
+						if (file.isAbsolute()
&&file.exists())
+						{
+							FileStorage t=new 
FileStorage( new Path(fileName) );
+							list.add(t);
 						}
 					}
 				}
Comment 1 Oyvind Harboe CLA 2004-11-01 18:24:40 EST
Created attachment 15536 [details]
Ouch. Pasted patches get word-wrapped. Trying again.
Comment 2 Alain Magloire CLA 2004-11-22 16:19:00 EST
we will consider for cdt-3.0
Comment 3 Oyvind Harboe CLA 2004-12-29 14:20:06 EST
I'm trying to make my patches to CDT a bit more managable.

This change is currently my only modification to org.eclipse.cdt.debug.core. 

If CVS HEAD is now CDT 3.0, could it be applied in some form or another?

Is there anything I can do at this point?

Thanks.

Øyvind
Comment 4 Nobody - feel free to take it CLA 2005-06-10 11:44:46 EDT
Fixed.
Comment 5 Oyvind Harboe CLA 2005-06-13 06:11:13 EDT
Seems to work fine without  my patch. Thanks!