diff options
author | Mikhail Khodjaiants | 2004-02-10 21:52:39 +0000 |
---|---|---|
committer | Mikhail Khodjaiants | 2004-02-10 21:52:39 +0000 |
commit | e88f821bbea2536bed54c43a675848d06275aba9 (patch) | |
tree | 04cd117390eb961dc37f6ad48d3e479ccc4a98e9 | |
parent | 98589999f9e7e477554339e7e12a6d184afa4728 (diff) | |
download | org.eclipse.cdt-e88f821bbea2536bed54c43a675848d06275aba9.tar.gz org.eclipse.cdt-e88f821bbea2536bed54c43a675848d06275aba9.tar.xz org.eclipse.cdt-e88f821bbea2536bed54c43a675848d06275aba9.zip |
Fix for bug 40108: The memory view does not handle big/little endian.
-rw-r--r-- | debug/org.eclipse.cdt.debug.ui/ChangeLog | 4 | ||||
-rw-r--r-- | debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/views/memory/MemoryPresentation.java | 21 |
2 files changed, 24 insertions, 1 deletions
diff --git a/debug/org.eclipse.cdt.debug.ui/ChangeLog b/debug/org.eclipse.cdt.debug.ui/ChangeLog index 979223dca7f..f2c0769c999 100644 --- a/debug/org.eclipse.cdt.debug.ui/ChangeLog +++ b/debug/org.eclipse.cdt.debug.ui/ChangeLog @@ -1,4 +1,8 @@ 2004-02-10 Mikhail Khodjaiants
+ Fix for bug 40108: The memory view does not handle big/little endian.
+ * MemoryPresentation.java
+
+2004-02-10 Mikhail Khodjaiants
Fix for bug 51519: Enable 'Format' action if multiple variables are selected.
* VariableFormatActionDelegate.java
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/views/memory/MemoryPresentation.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/views/memory/MemoryPresentation.java index d6bb6fd5f83..6b4bb3561fc 100644 --- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/views/memory/MemoryPresentation.java +++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/views/memory/MemoryPresentation.java @@ -425,7 +425,7 @@ public class MemoryPresentation switch( getDataFormat() ) { case IFormattedMemoryBlock.MEMORY_FORMAT_HEX: - return item; + return convertToHex( getWordSize(), item ); case IFormattedMemoryBlock.MEMORY_FORMAT_SIGNED_DECIMAL: return convertToDecimal( getWordSize(), item, true ); case IFormattedMemoryBlock.MEMORY_FORMAT_UNSIGNED_DECIMAL: @@ -456,6 +456,25 @@ public class MemoryPresentation } return 0; } + + /** + * Performs endianness swap (in a brainless, but right most of the time) fashion. + * @param item + * @return + */ + private String convertToHex( int wordsize, String item ) + { + if( !getMemoryBlock().isLittleEndian() || wordsize == IFormattedMemoryBlock.MEMORY_SIZE_BYTE ) + return item; + + int length = item.length(); + StringBuffer ret = new StringBuffer( length ); + for( int i = length - 2 ; i >= 0 ; i -= 2 ) + { + ret.append( item.substring( i, i + 2 ) ); + } + return ret.toString(); + } private String convertToDecimal( int wordSize, String item, boolean signed ) { |