Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[cdt-patch] CDT Debug

Index: ChangeLog
===================================================================
RCS file: /home/tools/org.eclipse.cdt.debug.core/ChangeLog,v
retrieving revision 1.148
diff -u -r1.148 ChangeLog
--- ChangeLog	18 Mar 2003 21:06:23 -0000	1.148
+++ ChangeLog	27 Mar 2003 16:24:48 -0000
@@ -1,3 +1,8 @@
+2003-03027 Alain Magloire
+
+	Adjust the code refactor in the CoreModel for IBinary
+	* CDebugTarget.java
+
 2003-03-18 Mikhail Khodjaiants
 	Removed the gdb-specific variable parsing.
 	* ICValue.java
Index: src/org/eclipse/cdt/debug/internal/core/model/CDebugTarget.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CDebugTarget.java,v
retrieving revision 1.87
diff -u -r1.87 CDebugTarget.java
--- src/org/eclipse/cdt/debug/internal/core/model/CDebugTarget.java	7 Mar 2003 19:39:47 -0000	1.87
+++ src/org/eclipse/cdt/debug/internal/core/model/CDebugTarget.java	27 Mar 2003 16:24:54 -0000
@@ -13,10 +13,11 @@
 import java.util.StringTokenizer;
 
 import org.eclipse.cdt.core.CCorePlugin;
+import org.eclipse.cdt.core.model.CModelException;
 import org.eclipse.cdt.core.model.CoreModel;
 import org.eclipse.cdt.core.model.IBinary;
 import org.eclipse.cdt.core.model.ICElement;
-import org.eclipse.cdt.core.model.ICFile;
+import org.eclipse.cdt.core.model.IParent;
 import org.eclipse.cdt.debug.core.CDebugCorePlugin;
 import org.eclipse.cdt.debug.core.CDebugModel;
 import org.eclipse.cdt.debug.core.ICBreakpointManager;
@@ -89,6 +90,7 @@
 import org.eclipse.core.runtime.IPath;
 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.DebugEvent;
 import org.eclipse.debug.core.DebugException;
@@ -2252,7 +2254,7 @@
 	{
 		if ( getExecFile() != null && CoreModel.getDefault().isBinary( getExecFile() ) )
 		{
-			ICFile cFile = CCorePlugin.getDefault().getCoreModel().create( getExecFile() );
+			ICElement cFile = CCorePlugin.getDefault().getCoreModel().create( getExecFile() );
 			if ( cFile instanceof IBinary )
 			{
 				((IBinary)cFile).isLittleEndian();
@@ -2279,16 +2281,16 @@
 		ArrayList list = new ArrayList();
 		if ( getExecFile() != null && CoreModel.getDefault().isBinary( getExecFile() ) )
 		{
-			ICFile cFile = CCorePlugin.getDefault().getCoreModel().create( getExecFile() );
-			if ( cFile instanceof IBinary )
+			ICElement cFile = CCorePlugin.getDefault().getCoreModel().create( getExecFile() );
+			if ( cFile instanceof IParent )
 			{
-				list.addAll( getCFileGlobals( cFile ) );
+				list.addAll( getCFileGlobals( (IParent)cFile ) );
 			}
 		}
 		return (IGlobalVariable[])list.toArray( new IGlobalVariable[list.size()] );
 	}
 
-	private List getCFileGlobals( ICFile file )
+	private List getCFileGlobals( IParent file )
 	{
 		ArrayList list = new ArrayList();
 		ICElement[] elements = file.getChildren();
@@ -2298,9 +2300,9 @@
 			{
 				list.add( createGlobalVariable( (org.eclipse.cdt.core.model.IVariable)elements[i] ) );
 			}
-			else if ( elements[i] instanceof org.eclipse.cdt.core.model.ICFile )
+			else if ( elements[i] instanceof org.eclipse.cdt.core.model.IParent )
 			{
-				list.addAll( getCFileGlobals( (org.eclipse.cdt.core.model.ICFile)elements[i] ) );
+				list.addAll( getCFileGlobals( (org.eclipse.cdt.core.model.IParent)elements[i] ) );
 			}
 		}
 		return list;
@@ -2317,14 +2319,18 @@
 				  	  
 				  	  public IPath getPath()
 				  	  {
-						  IPath path = null;
-						  if ( var.getParent() != null && var.getParent() instanceof ICFile )
-						  {
-						  	  if ( !(var.getParent() instanceof IBinary) && ((ICFile)var.getParent()).getFile() != null )
-						  	  {
-							  	  path = ((ICFile)var.getParent()).getFile().getLocation();
-						  	  }
-						  }
+							IPath path = new Path("");
+							try
+							{
+								IResource res = var.getUnderlyingResource();
+								if ( res != null )
+								{
+									path = res.getLocation();
+								}
+							}
+							catch (CModelException e)
+							{
+							}
 						  return path;
 				  	  }
 				  };



Back to the top