mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Fix for bug 40108: The memory view does not handle big/little endian.
This commit is contained in:
parent
fd9750f26f
commit
843606db1d
2 changed files with 24 additions and 1 deletions
|
@ -1,3 +1,7 @@
|
||||||
|
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
|
2004-02-10 Mikhail Khodjaiants
|
||||||
Fix for bug 51519: Enable 'Format' action if multiple variables are selected.
|
Fix for bug 51519: Enable 'Format' action if multiple variables are selected.
|
||||||
* VariableFormatActionDelegate.java
|
* VariableFormatActionDelegate.java
|
||||||
|
|
|
@ -425,7 +425,7 @@ public class MemoryPresentation
|
||||||
switch( getDataFormat() )
|
switch( getDataFormat() )
|
||||||
{
|
{
|
||||||
case IFormattedMemoryBlock.MEMORY_FORMAT_HEX:
|
case IFormattedMemoryBlock.MEMORY_FORMAT_HEX:
|
||||||
return item;
|
return convertToHex( getWordSize(), item );
|
||||||
case IFormattedMemoryBlock.MEMORY_FORMAT_SIGNED_DECIMAL:
|
case IFormattedMemoryBlock.MEMORY_FORMAT_SIGNED_DECIMAL:
|
||||||
return convertToDecimal( getWordSize(), item, true );
|
return convertToDecimal( getWordSize(), item, true );
|
||||||
case IFormattedMemoryBlock.MEMORY_FORMAT_UNSIGNED_DECIMAL:
|
case IFormattedMemoryBlock.MEMORY_FORMAT_UNSIGNED_DECIMAL:
|
||||||
|
@ -457,6 +457,25 @@ public class MemoryPresentation
|
||||||
return 0;
|
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 )
|
private String convertToDecimal( int wordSize, String item, boolean signed )
|
||||||
{
|
{
|
||||||
String result = "";
|
String result = "";
|
||||||
|
|
Loading…
Add table
Reference in a new issue