Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[cdt-patch] Fix for evaluation of expression to address in the Memory view

Index: ChangeLog
===================================================================
RCS file: /home/tools/org.eclipse.cdt.debug.ui/ChangeLog,v
retrieving revision 1.40
diff -u -r1.40 ChangeLog
--- ChangeLog 22 Nov 2002 19:00:17 -0000 1.40
+++ ChangeLog 26 Nov 2002 16:36:36 -0000
@@ -1,3 +1,8 @@
+2002-11-26 Mikhail Khodjaiants
+ Fix for evaluation of _expression_ to address in the Memory view.
+ GDB evaluates the array of chars to a string not an address.
+ * MemoryControlArea.java
+
 2002-11-21 Mikhail Khodjaiants
  Added the 'Evaluate' button to the Memory view.
  * MemoryControlArea.java
Index: src/org/eclipse/cdt/debug/internal/ui/views/memory/MemoryControlArea.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/views/memory/MemoryControlArea.java,v
retrieving revision 1.18
diff -u -r1.18 MemoryControlArea.java
--- src/org/eclipse/cdt/debug/internal/ui/views/memory/MemoryControlArea.java 22 Nov 2002 19:00:17 -0000 1.18
+++ src/org/eclipse/cdt/debug/internal/ui/views/memory/MemoryControlArea.java 26 Nov 2002 16:36:36 -0000
@@ -7,9 +7,9 @@
 package org.eclipse.cdt.debug.internal.ui.views.memory;
 
 import org.eclipse.cdt.debug.core.CDebugModel;
-import org.eclipse.cdt.debug.core.ICExpressionEvaluator;
 import org.eclipse.cdt.debug.core.ICMemoryManager;
 import org.eclipse.cdt.debug.core.IFormattedMemoryBlock;
+import org.eclipse.cdt.debug.internal.ui.CDebugUIUtils;
 import org.eclipse.cdt.debug.internal.ui.preferences.ICDebugPreferenceConstants;
 import org.eclipse.cdt.debug.ui.CDebugUIPlugin;
 import org.eclipse.debug.core.DebugException;
@@ -474,58 +474,27 @@
  {
   if ( getMemoryManager() != null )
   {
-   IDebugTarget target = (IDebugTarget)getMemoryManager().getAdapter( IDebugTarget.class );
-   if ( target != null )
-   {
-    ICExpressionEvaluator ee = (ICExpressionEvaluator)target.getAdapter( ICExpressionEvaluator.class );
-    String newExpression = convertToHexString( evaluateExpression( ee, fAddressText.getText().trim() ) );
-    if ( newExpression != null )
-    {
-     fAddressText.setText( newExpression );
-     handleAddressEnter();
-    }
-   }
-  }
-  fAddressText.forceFocus();
- }

- private String evaluateExpression( ICExpressionEvaluator ee, String _expression_ )
- {
-  String result = null;
-  if ( ee != null && ee.canEvaluate() )
-  {
-   try
-   {
-    result = ee.evaluateExpressionToString( _expression_ );
-   }
-   catch( DebugException e )
-   {
-    CDebugUIPlugin.errorDialog( "Unable to evaluate _expression_.", e.getStatus() );
-   }
-  }
-  return result;
- }

- private String convertToHexString( String value )
- {
-  String result = null;
-  if ( value != null )
-  {
-   if ( !value.startsWith( "0x" ) )
+   if ( getMemoryBlock() == null )
    {
+    String _expression_ = fAddressText.getText().trim();
     try
     {
-     result = "0x" + Long.toHexString( Long.parseLong( value ) );
+     removeBlock();
+     if ( _expression_.length() > 0 )
+     {
+      createBlock( _expression_ );
+     }
     }
-    catch( NumberFormatException e )
+    catch( DebugException e )
     {
+     CDebugUIPlugin.errorDialog( "Unable to get memory block.", e.getStatus() );
     }
    }
-   else
+   if ( getMemoryBlock() != null )
    {
-    result = value;
+    fAddressText.setText( CDebugUIUtils.toHexAddressString( getMemoryBlock().getStartAddress() ) );
+    handleAddressEnter();
    }
   }
-  return result;
  }
 }

Back to the top