Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[cdt-patch] Live editing of the memory view

Index: ChangeLog
===================================================================
RCS file: /home/tools/org.eclipse.cdt.debug.core/ChangeLog,v
retrieving revision 1.64
diff -u -r1.64 ChangeLog
--- ChangeLog 28 Nov 2002 16:20:02 -0000 1.64
+++ ChangeLog 28 Nov 2002 19:11:31 -0000
@@ -1,3 +1,8 @@
+2002-11-28 Mikhail Khodjaiants
+ Live editing of the memory view: removed support of the 'Save Changes' action.
+ * IFormattedMemoryBlock.java
+ * CFormattedMemoryBlock.java
+
 2002-11-27 Alain Magloire
 
  * src/org/eclipse/cdt/debug/core/cdi/model/ICDITarget.java (runUntil): new method.
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.14
diff -u -r1.14 IFormattedMemoryBlock.java
--- src/org/eclipse/cdt/debug/core/IFormattedMemoryBlock.java 20 Nov 2002 21:51:43 -0000 1.14
+++ src/org/eclipse/cdt/debug/core/IFormattedMemoryBlock.java 28 Nov 2002 19:11:31 -0000
@@ -124,11 +124,7 @@
  boolean isFrozen();
  
  void setFrozen( boolean frozen );

- boolean isDirty();

- void saveChanges() throws DebugException;

+
  void refresh() throws DebugException;
  
  boolean canChangeFormat( int format );
Index: src/org/eclipse/cdt/debug/internal/core/model/CFormattedMemoryBlock.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CFormattedMemoryBlock.java,v
retrieving revision 1.17
diff -u -r1.17 CFormattedMemoryBlock.java
--- src/org/eclipse/cdt/debug/internal/core/model/CFormattedMemoryBlock.java 21 Nov 2002 21:58:05 -0000 1.17
+++ src/org/eclipse/cdt/debug/internal/core/model/CFormattedMemoryBlock.java 28 Nov 2002 19:11:32 -0000
@@ -6,7 +6,6 @@
 package org.eclipse.cdt.debug.internal.core.model;
 
 import java.util.ArrayList;
-import java.util.Arrays;
 import java.util.List;
 
 import org.eclipse.cdt.debug.core.CDebugCorePlugin;
@@ -37,106 +36,6 @@
            implements IFormattedMemoryBlock,
              ICDIEventListener
 {
- protected class ByteRange
- {
-  private int fStart;
-  private byte[] fRangeBytes;
-
-  /**
-   * Constructor for Range.
-   */
-  public ByteRange( int start, byte[] bytes )
-  {
-   fStart = start;
-   fRangeBytes = bytes;
-  }
-
-  public int getStart()
-  {
-   return fStart;
-  }
-
-  public int getLength()
-  {
-   if ( fRangeBytes != null )
-   {
-    return fRangeBytes.length;
-   }
-   return 0;
-  }
-  
-  public byte[] getBytes()
-  {
-   return fRangeBytes;
-  }
- }
-
- protected class DirtyBytes
- {
-  private boolean[] fDirtyBytes = null;
-  
-  /**
-   * Constructor for DirtyBytes.
-   */
-  public DirtyBytes( int size )
-  {
-   fDirtyBytes = new boolean[size];
-   Arrays.fill( fDirtyBytes, false );
-  }
-  
-  public void reset()
-  {
-   Arrays.fill( fDirtyBytes, false );
-  }
-  
-  public void set( int start, int length, boolean value )
-  {
-   Arrays.fill( fDirtyBytes, start, start + length, value );
-  }
-
-  public void set( ByteRange range, boolean value )
-  {
-   Arrays.fill( fDirtyBytes, range.getStart(), range.getStart() + range.getLength(), value );
-  }
-  
-  public ByteRange[] getDirtyRanges( byte[] bytes )
-  {
-   ArrayList list = new ArrayList();
-   int startIndex = -1;
-   for ( int i = 0; i < fDirtyBytes.length; ++i )
-   {
-    if ( fDirtyBytes[i] )
-    {
-     if ( startIndex == -1 )
-     {
-      startIndex = i;
-     }
-    }
-    else
-    {
-     if ( startIndex != -1 )
-     {
-      byte[] rangeBytes = new byte[i - startIndex];
-      System.arraycopy( bytes, startIndex, rangeBytes, 0, i - startIndex );
-      list.add( new ByteRange( startIndex, rangeBytes ) );
-      startIndex = -1;
-     }
-    }
-   }
-   return (ByteRange[])list.toArray( new ByteRange[list.size()] );
-  }
-
-  public boolean isDirty()
-  {
-   for ( int i = 0; i < fDirtyBytes.length; ++i )
-   {
-    if ( fDirtyBytes[i] )
-     return true;
-   }
-   return false;
-  }
- }
-
  class CFormattedMemoryBlockRow implements IFormattedMemoryBlockRow
  {
   private long fAddress;
@@ -178,7 +77,6 @@
   }
  }
 
-// private String fAddressExpression;
  private ICDIExpression fAddressExpression;
  private ICDIMemoryBlock fCDIMemoryBlock;
  private byte[] fBytes = null;
@@ -190,7 +88,6 @@
  private char fPaddingChar = '.';
  private List fRows = null;
  private Long[] fChangedAddresses = new Long[0];
- private DirtyBytes fDirtyBytes = null;
  private boolean fStartAddressChanged = false;
 
  /**
@@ -307,10 +204,6 @@
  private synchronized void resetBytes()
  {
   fBytes = null;
-  if ( fDirtyBytes != null )
-  {
-   fDirtyBytes.reset();
-  }
  }
 
  private void resetRows()
@@ -418,10 +311,6 @@
     try
     {
      fBytes = fCDIMemoryBlock.getBytes();
-     if ( fDirtyBytes == null )
-     {
-      fDirtyBytes = createDirtyBytes( fBytes.length );
-     }
     }
     catch( CDIException e )
     {
@@ -657,19 +546,18 @@
  {
   byte[] bytes = itemToBytes( newValue.toCharArray() );
   setBytes( index * getWordSize(), bytes );
-  fDirtyBytes.set( index * getWordSize(), bytes.length, true );
   resetRows();
  }
  
- private void setBytes( int index, byte[] newBytes )
+ private void setBytes( int index, byte[] newBytes ) throws DebugException
  {
-  if ( fBytes != null && fDirtyBytes != null )
+  try
   {
-   for ( int i = index; i < index + newBytes.length; ++i )
-   {
-    fBytes[i] = newBytes[i - index];
-    fDirtyBytes.set( index, newBytes.length, true );
-   }
+   getCDIMemoryBlock().setValue( index, newBytes );
+  }
+  catch( CDIException e )
+  {
+   targetRequestFailed( e.getMessage(), null );
   }
  }
  
@@ -696,6 +584,7 @@
  /**
   * @see org.eclipse.cdt.debug.core.IFormattedMemoryBlock#isDirty()
   */
+/*
  public boolean isDirty()
  {
   if ( fDirtyBytes != null )
@@ -704,10 +593,11 @@
   }
   return false;
  }
-
+*/
  /* (non-Javadoc)
   * @see org.eclipse.cdt.debug.core.IFormattedMemoryBlock#saveChanges()
   */
+/*
  public void saveChanges() throws DebugException
  {
   byte[] bytes = getBytes();
@@ -728,7 +618,7 @@
    fDirtyBytes.reset();
   }
  }
-
+*/
  /* (non-Javadoc)
   * @see org.eclipse.cdt.debug.core.IFormattedMemoryBlock#refresh()
   */
@@ -745,11 +635,6 @@
     targetRequestFailed( e.getMessage(), null );
    }
   }
- }
-
- private DirtyBytes createDirtyBytes( int size )
- {
-  return new DirtyBytes( size );
  }
 
  /**

Back to the top