Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[cdt-patch] Support for debugger console

Support for debugger console.

Index: ChangeLog
===================================================================
RCS file: /home/tools/org.eclipse.cdt.debug.core/ChangeLog,v
retrieving revision 1.25
diff -u -r1.25 ChangeLog
--- ChangeLog 22 Oct 2002 20:31:41 -0000 1.25
+++ ChangeLog 23 Oct 2002 17:19:30 -0000
@@ -1,3 +1,10 @@
+2002-10-23 Mikhail Khodjaiants
+ Support for debugger console.
+ * CDebugModel.java: new factory methods for CDebugTarget
+ * IDebuggerProcessSupport: new interface that defines the debugger
+ process support functionality.
+ * CDebugTarget.java: implementation of IDebuggerProcessSupport interface.
+
 2002-10-22 Alain Magloire
 
  * src/.../cdi/ICDISession.java (getSessionProcess):
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.33
diff -u -r1.33 CDebugModel.java
--- src/org/eclipse/cdt/debug/core/CDebugModel.java 17 Oct 2002 23:17:01 -0000 1.33
+++ src/org/eclipse/cdt/debug/core/CDebugModel.java 23 Oct 2002 17:19:30 -0000
@@ -73,8 +73,8 @@
  /**
   * Creates and returns a debug target for the given CDI target, with
   * the specified name, and associates the debug target with the
-  * given process for console I/O. The allow terminate flag specifies whether
-  * the debug target will support termination (<code>ITerminate</code>).
+  * given process for console I/O. The allow terminate flag specifies
+  * whether the debug target will support termination (<code>ITerminate</code>).
   * The allow disconnect flag specifies whether the debug target will
   * support disconnection (<code>IDisconnect</code>). The resume
   * flag specifies if the target process should be resumed on startup.
@@ -111,6 +111,59 @@
              cdiTarget,
              name,
              process,
+             null,
+             project,
+             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 newDebugTarget( final ILaunch launch,
+              final ICDITarget cdiTarget,
+              final String name,
+              final IProcess debuggeeProcess,
+              final IProcess debuggerProcess,
+              final IProject project,
+              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,
              project,
              allowTerminate,
              allowDisconnect );
@@ -157,6 +210,7 @@
              cdiTarget,
              name,
              null,
+             null,
              project,
              false,
              true );
@@ -189,9 +243,109 @@
   return target[0];
  }
 
+ public static IDebugTarget newAttachDebugTarget( final ILaunch launch,
+              final ICDITarget cdiTarget,
+              final String name,
+              final IProcess debuggerProcess,
+              final IProject project ) 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,
+             project,
+             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,
+                final IProject project ) 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,
+             null,
+             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 IProject project ) throws DebugException
  {
   final IDebugTarget[] target = new IDebugTarget[1];
@@ -205,6 +359,7 @@
              cdiTarget,
              name,
              null,
+             debuggerProcess,
              project,
              true,
              false );
Index: src/org/eclipse/cdt/debug/core/IDebuggerProcessSupport.java
===================================================================
RCS file: src/org/eclipse/cdt/debug/core/IDebuggerProcessSupport.java
diff -N src/org/eclipse/cdt/debug/core/IDebuggerProcessSupport.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ src/org/eclipse/cdt/debug/core/IDebuggerProcessSupport.java 23 Oct 2002 17:19:30 -0000
@@ -0,0 +1,20 @@
+/*
+ *(c) Copyright QNX Software Systems Ltd. 2002.
+ * All Rights Reserved.
+ *
+ */
+package org.eclipse.cdt.debug.core;
+
+/**
+ * Provides the functionality to support debugger console.
+ *
+ * @since: Oct 23, 2002
+ */
+public interface IDebuggerProcessSupport
+{
+ boolean supportsDebuggerProcess();

+ boolean isDebuggerProcessDefault();

+ void setDebuggerProcessDefault( boolean value );
+}
Index: src/org/eclipse/cdt/debug/core/IFormattedMemoryBlock.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/IFormattedMemoryBlock.java,v
retrieving revision 1.4
diff -u -r1.4 IFormattedMemoryBlock.java
--- src/org/eclipse/cdt/debug/core/IFormattedMemoryBlock.java 21 Oct 2002 03:35:35 -0000 1.4
+++ src/org/eclipse/cdt/debug/core/IFormattedMemoryBlock.java 23 Oct 2002 17:19:30 -0000
@@ -17,6 +17,26 @@
  */
 public interface IFormattedMemoryBlock extends IMemoryBlock
 {
+ public static final int MEMORY_SIZE_BYTE = 1;
+ public static final int MEMORY_SIZE_HALF_WORD = 2;
+ public static final int MEMORY_SIZE_WORD = 4;
+ public static final int MEMORY_SIZE_DOUBLE_WORD = 8;
+ public static final int MEMORY_SIZE_FLOAT = 8;
+ public static final int MEMORY_SIZE_DOUBLE_FLOAT = 16;
+
+ public static final int MEMORY_FORMAT_HEX = 0;
+ public static final int MEMORY_FORMAT_BINARY = 1;
+ public static final int MEMORY_FORMAT_OCTAL = 2;
+ public static final int MEMORY_FORMAT_SIGNED_DECIMAL = 3;
+ public static final int MEMORY_FORMAT_UNSIGNED_DECIMAL = 4;
+
+ public static final int MEMORY_BYTES_PER_ROW_4 = 4;
+ public static final int MEMORY_BYTES_PER_ROW_8 = 8;
+ public static final int MEMORY_BYTES_PER_ROW_16 = 16;
+ public static final int MEMORY_BYTES_PER_ROW_32 = 32;
+ public static final int MEMORY_BYTES_PER_ROW_64 = 64;
+ public static final int MEMORY_BYTES_PER_ROW_128 = 128;
+
  /**
   * Returns the address _expression_ specified to obtain this memory block.
   *
Index: src/org/eclipse/cdt/debug/core/IFormattedMemoryRetrieval.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/IFormattedMemoryRetrieval.java,v
retrieving revision 1.1
diff -u -r1.1 IFormattedMemoryRetrieval.java
--- src/org/eclipse/cdt/debug/core/IFormattedMemoryRetrieval.java 6 Aug 2002 18:56:15 -0000 1.1
+++ src/org/eclipse/cdt/debug/core/IFormattedMemoryRetrieval.java 23 Oct 2002 17:19:30 -0000
@@ -15,26 +15,6 @@
  */
 public interface IFormattedMemoryRetrieval
 {
- public static final int MEMORY_SIZE_BYTE = 1;
- public static final int MEMORY_SIZE_HALF_WORD = 2;
- public static final int MEMORY_SIZE_WORD = 4;
- public static final int MEMORY_SIZE_DOUBLE_WORD = 8;
- public static final int MEMORY_SIZE_FLOAT = 8;
- public static final int MEMORY_SIZE_DOUBLE_FLOAT = 16;
-
- public static final int MEMORY_FORMAT_HEX = 0;
- public static final int MEMORY_FORMAT_BINARY = 1;
- public static final int MEMORY_FORMAT_OCTAL = 2;
- public static final int MEMORY_FORMAT_SIGNED_DECIMAL = 3;
- public static final int MEMORY_FORMAT_UNSIGNED_DECIMAL = 4;
-
- public static final int MEMORY_BYTES_PER_ROW_4 = 4;
- public static final int MEMORY_BYTES_PER_ROW_8 = 8;
- public static final int MEMORY_BYTES_PER_ROW_16 = 16;
- public static final int MEMORY_BYTES_PER_ROW_32 = 32;
- public static final int MEMORY_BYTES_PER_ROW_64 = 64;
- public static final int MEMORY_BYTES_PER_ROW_128 = 128;
-
  int[] getSupportedFormats() throws DebugException;
  
  IFormattedMemoryBlock getFormattedMemoryBlock( long startAddress,
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.45
diff -u -r1.45 CDebugTarget.java
--- src/org/eclipse/cdt/debug/internal/core/model/CDebugTarget.java 15 Oct 2002 21:42:17 -0000 1.45
+++ src/org/eclipse/cdt/debug/internal/core/model/CDebugTarget.java 23 Oct 2002 17:19:31 -0000
@@ -18,6 +18,7 @@
 import org.eclipse.cdt.debug.core.ICLineBreakpoint;
 import org.eclipse.cdt.debug.core.ICMemoryManager;
 import org.eclipse.cdt.debug.core.ICWatchpoint;
+import org.eclipse.cdt.debug.core.IDebuggerProcessSupport;
 import org.eclipse.cdt.debug.core.IFormattedMemoryBlock;
 import org.eclipse.cdt.debug.core.IFormattedMemoryRetrieval;
 import org.eclipse.cdt.debug.core.IRestart;
@@ -101,7 +102,8 @@
             ILaunchListener,
             ISwitchToThread,
             IExpressionListener,
-            ICExpressionEvaluator
+            ICExpressionEvaluator,
+            IDebuggerProcessSupport
 {
  /**
   * The type of this target.
@@ -116,9 +118,14 @@
  private ArrayList fThreads;
 
  /**
-  * Associated system process, or <code>null</code> if not available.
+  * Associated inferrior process, or <code>null</code> if not available.
   */
- private IProcess fProcess;
+ private IProcess fDebuggeeProcess = null;
+
+ /**
+  * Associated debugger process, or <code>null</code> if not available.
+  */
+ private IProcess fDebuggerProcess = null;
 
  /**
   * The underlying CDI target.
@@ -206,6 +213,11 @@
  private CMemoryManager fMemoryManager;
 
  /**
+  * A memory manager for this target.
+  */
+ private boolean fIsDebuggerProcessDefault = false;
+
+ /**
   * Constructor for CDebugTarget.
   * @param target
   */
@@ -213,7 +225,8 @@
        int targetType,
        ICDITarget cdiTarget,
        String name,
-       IProcess process,
+       IProcess debuggeeProcess,
+       IProcess debuggerProcess,
        IProject project,
        boolean allowsTerminate,
        boolean allowsDisconnect )
@@ -223,7 +236,7 @@
   setTargetType( targetType );
   setDebugTarget( this );
   setName( name );
-  setProcess( process );
+  setProcesses( debuggeeProcess, debuggerProcess );
   setCDITarget( cdiTarget );
   setBreakpoints( new HashMap( 5 ) );
   setTemporaryBreakpoints( new ArrayList() );
@@ -307,7 +320,7 @@
   */
  public IProcess getProcess()
  {
-  return fProcess;
+  return ( fIsDebuggerProcessDefault ) ? fDebuggerProcess : fDebuggeeProcess;
  }
 
  /**
@@ -318,9 +331,10 @@
   *  underlying CDI target, or <code>null</code> if no process is
   *  associated with this debug target (for example, a core dump debugging).
   */
- protected void setProcess( IProcess process )
+ protected void setProcesses( IProcess debuggeeProcess, IProcess debuggerProcess )
  {
-  fProcess = process;
+  fDebuggeeProcess = debuggeeProcess;
+  fDebuggerProcess = debuggerProcess;
  }
 
  /* (non-Javadoc)
@@ -1920,4 +1934,29 @@
  {
   getMemoryManager().dispose();
  }
+
+ /* (non-Javadoc)
+  * @see org.eclipse.cdt.debug.core.IDebuggerProcessSupport#isDefault()
+  */
+ public boolean isDebuggerProcessDefault()
+ {
+  return fIsDebuggerProcessDefault;
+ }
+
+ /* (non-Javadoc)
+  * @see org.eclipse.cdt.debug.core.IDebuggerProcessSupport#setDefault(boolean)
+  */
+ public void setDebuggerProcessDefault( boolean value )
+ {
+  fIsDebuggerProcessDefault = value;
+ }
+
+ /* (non-Javadoc)
+  * @see org.eclipse.cdt.debug.core.IDebuggerProcessSupport#supportsDebuggerProcess()
+  */
+ public boolean supportsDebuggerProcess()
+ {
+  return ( fDebuggerProcess != null );
+ }
+
 }


Back to the top