Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[cdt-patch] Replaced the 'IProject' argument by 'IFile' in the debug target factory methods

Replaced the 'IProject' argument by 'IFile' in the debug target factory methods.

Index: ChangeLog
===================================================================
RCS file: /home/tools/org.eclipse.cdt.debug.core/ChangeLog,v
retrieving revision 1.41
diff -u -r1.41 ChangeLog
--- ChangeLog 31 Oct 2002 22:34:55 -0000 1.41
+++ ChangeLog 1 Nov 2002 17:14:56 -0000
@@ -1,4 +1,9 @@
 2002-10-31 Mikhail Khodjaiants
+ Replaced the 'IProject' argument by 'IFile' in the debug target factory methods.
+ * CDebugModel.java
+ * CDebugTarget.java
+
+2002-10-31 Mikhail Khodjaiants
  Fixed the synchronization bug.
  * CFormattedMemoryBlock.java
 
Index: src/org/eclipse/cdt/debug/core/CDebugModel.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/CDebugModel.java,v
retrieving revision 1.34
diff -u -r1.34 CDebugModel.java
--- src/org/eclipse/cdt/debug/core/CDebugModel.java 23 Oct 2002 17:20:29 -0000 1.34
+++ src/org/eclipse/cdt/debug/core/CDebugModel.java 1 Nov 2002 17:14:56 -0000
@@ -25,6 +25,7 @@
 import org.eclipse.cdt.debug.internal.core.model.CDebugTarget;
 import org.eclipse.cdt.debug.internal.core.model.CExpression;
 import org.eclipse.cdt.debug.internal.core.model.CFormattedMemoryBlock;
+import org.eclipse.core.resources.IFile;
 import org.eclipse.core.resources.IMarker;
 import org.eclipse.core.resources.IProject;
 import org.eclipse.core.resources.IResource;
@@ -91,6 +92,7 @@
   * @param stopInMain whether to set a temporary breakpoint in main.
   * @return a debug target
   */
+/*
  public static IDebugTarget newDebugTarget( final ILaunch launch,
               final ICDITarget cdiTarget,
               final String name,
@@ -141,7 +143,7 @@
 
   return target[0];
  }
-
+*/
  public static IDebugTarget newDebugTarget( final ILaunch launch,
               final ICDITarget cdiTarget,
               final String name,
@@ -194,6 +196,58 @@
   return target[0];
  }
 
+ public static IDebugTarget newDebugTarget( final ILaunch launch,
+              final ICDITarget cdiTarget,
+              final String name,
+              final IProcess debuggeeProcess,
+              final IProcess debuggerProcess,
+              final IFile file,
+              final boolean allowTerminate,
+              final boolean allowDisconnect,
+              final boolean stopInMain ) throws DebugException
+ {
+  final IDebugTarget[] target = new IDebugTarget[1];
+
+  IWorkspaceRunnable r = new IWorkspaceRunnable()
+  {
+   public void run( IProgressMonitor m )
+   {
+    target[0] = new CDebugTarget( launch,
+             ICDebugTargetType.TARGET_TYPE_LOCAL_RUN,
+             cdiTarget,
+             name,
+             debuggeeProcess,
+             debuggerProcess,
+             file,
+             allowTerminate,
+             allowDisconnect );
+   }
+  };
+  try
+  {
+   ResourcesPlugin.getWorkspace().run( r, null );
+  }
+  catch( CoreException e )
+  {
+   CDebugCorePlugin.log( e );
+   throw new DebugException( e.getStatus() );
+  }
+
+  ICDIConfiguration config = cdiTarget.getSession().getConfiguration();
+
+  if ( config.supportsBreakpoints() && stopInMain )
+  {
+   stopInMain( (CDebugTarget)target[0] );
+  }
+
+  if ( config.supportsResume() )
+  {
+   target[0].resume();
+  }
+
+  return target[0];
+ }
+/*
  public static IDebugTarget newAttachDebugTarget( final ILaunch launch,
               final ICDITarget cdiTarget,
               final String name,
@@ -242,7 +296,7 @@
 
   return target[0];
  }
-
+*/
  public static IDebugTarget newAttachDebugTarget( final ILaunch launch,
               final ICDITarget cdiTarget,
               final String name,
@@ -293,6 +347,56 @@
   return target[0];
  }
 
+ public static IDebugTarget newAttachDebugTarget( final ILaunch launch,
+              final ICDITarget cdiTarget,
+              final String name,
+              final IProcess debuggerProcess,
+              final IFile file ) throws DebugException
+ {
+  final IDebugTarget[] target = new IDebugTarget[1];
+
+  IWorkspaceRunnable r = new IWorkspaceRunnable()
+  {
+   public void run( IProgressMonitor m )
+   {
+    target[0] = new CDebugTarget( launch,
+             ICDebugTargetType.TARGET_TYPE_LOCAL_ATTACH,
+             cdiTarget,
+             name,
+             null,
+             debuggerProcess,
+             file,
+             false,
+             true );
+   }
+  };
+  try
+  {
+   ResourcesPlugin.getWorkspace().run( r, null );
+  }
+  catch( CoreException e )
+  {
+   CDebugCorePlugin.log( e );
+   throw new DebugException( e.getStatus() );
+  }
+
+  ((CDebugTarget)target[0]).handleDebugEvent( new ICDISuspendedEvent()
+              {
+               public ICDISessionObject getReason()
+               {
+                return null;
+               }

+               public ICDIObject getSource()
+               {
+                return cdiTarget;
+               }
+
+              } );
+
+  return target[0];
+ }
+/*
  public static IDebugTarget newCoreFileDebugTarget( final ILaunch launch,
                 final ICDITarget cdiTarget,
                 final String name,
@@ -341,7 +445,7 @@
 
   return target[0];
  }
-
+*/
  public static IDebugTarget newCoreFileDebugTarget( final ILaunch launch,
                 final ICDITarget cdiTarget,
                 final String name,
@@ -361,6 +465,56 @@
              null,
              debuggerProcess,
              project,
+             true,
+             false );
+   }
+  };
+  try
+  {
+   ResourcesPlugin.getWorkspace().run( r, null );
+  }
+  catch( CoreException e )
+  {
+   CDebugCorePlugin.log( e );
+   throw new DebugException( e.getStatus() );
+  }
+
+  ((CDebugTarget)target[0]).handleDebugEvent( new ICDISuspendedEvent()
+              {
+               public ICDISessionObject getReason()
+               {
+                return null;
+               }

+               public ICDIObject getSource()
+               {
+                return cdiTarget;
+               }
+
+              } );
+
+  return target[0];
+ }
+
+ public static IDebugTarget newCoreFileDebugTarget( final ILaunch launch,
+                final ICDITarget cdiTarget,
+                final String name,
+                final IProcess debuggerProcess,
+                final IFile file ) throws DebugException
+ {
+  final IDebugTarget[] target = new IDebugTarget[1];
+
+  IWorkspaceRunnable r = new IWorkspaceRunnable()
+  {
+   public void run( IProgressMonitor m )
+   {
+    target[0] = new CDebugTarget( launch,
+             ICDebugTargetType.TARGET_TYPE_LOCAL_CORE_DUMP,
+             cdiTarget,
+             name,
+             null,
+             debuggerProcess,
+             file,
              true,
              false );
    }
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.49
diff -u -r1.49 CDebugTarget.java
--- src/org/eclipse/cdt/debug/internal/core/model/CDebugTarget.java 30 Oct 2002 16:31:07 -0000 1.49
+++ src/org/eclipse/cdt/debug/internal/core/model/CDebugTarget.java 1 Nov 2002 17:14:57 -0000
@@ -63,6 +63,7 @@
 import org.eclipse.cdt.debug.internal.core.sourcelookup.CSourceLocator;
 import org.eclipse.cdt.debug.internal.core.sourcelookup.CSourceManager;
 import org.eclipse.cdt.debug.internal.core.sourcelookup.DisassemblyManager;
+import org.eclipse.core.resources.IFile;
 import org.eclipse.core.resources.IMarkerDelta;
 import org.eclipse.core.resources.IProject;
 import org.eclipse.core.resources.IResource;
@@ -241,6 +242,43 @@
   setBreakpoints( new HashMap( 5 ) );
   setTemporaryBreakpoints( new ArrayList() );
   getLaunch().setSourceLocator( createSourceLocator( project ) );
+  setConfiguration( cdiTarget.getSession().getConfiguration() );
+  fSupportsTerminate = allowsTerminate & getConfiguration().supportsTerminate();
+  fSupportsDisconnect = allowsDisconnect & getConfiguration().supportsDisconnect();
+  setThreadList( new ArrayList( 5 ) );
+  initialize();
+  DebugPlugin.getDefault().getLaunchManager().addLaunchListener( this );
+  DebugPlugin.getDefault().getExpressionManager().addExpressionListener( this );
+  getCDISession().getEventManager().addEventListener( this );
+ }
+
+ /**
+  * Constructor for CDebugTarget.
+  * @param target
+  */
+ public CDebugTarget( ILaunch launch,
+       int targetType,
+       ICDITarget cdiTarget,
+       String name,
+       IProcess debuggeeProcess,
+       IProcess debuggerProcess,
+       IFile file,
+       boolean allowsTerminate,
+       boolean allowsDisconnect )
+ {
+  super( null );
+  setLaunch( launch );
+  setTargetType( targetType );
+  setDebugTarget( this );
+  setName( name );
+  setProcesses( debuggeeProcess, debuggerProcess );
+  setCDITarget( cdiTarget );
+  setBreakpoints( new HashMap( 5 ) );
+  setTemporaryBreakpoints( new ArrayList() );
+  if ( file != null )
+  {
+   getLaunch().setSourceLocator( createSourceLocator( file.getProject() ) );
+  }
   setConfiguration( cdiTarget.getSession().getConfiguration() );
   fSupportsTerminate = allowsTerminate & getConfiguration().supportsTerminate();
   fSupportsDisconnect = allowsDisconnect & getConfiguration().supportsDisconnect();


Back to the top