mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-23 08:55:25 +02:00
Implementing the disassembly mode.
This commit is contained in:
parent
16e22eb4b8
commit
e01a121c1c
5 changed files with 48 additions and 2 deletions
|
@ -1,3 +1,9 @@
|
|||
2002-10-10 Mikhail Khodjaiants
|
||||
* CSourceManager.java: Implementing the disassembly mode.
|
||||
* DisassemblyManager.java: Implementing the disassembly mode.
|
||||
* DisassemblyStorage.java: Implementing the disassembly mode.
|
||||
* CDebugUtils.java: Added the 'toHexAddressString' method.
|
||||
|
||||
2002-10-10 Alain Magloire
|
||||
|
||||
* ICDISourceManager.java: Changing the getInstructions()
|
||||
|
|
|
@ -64,4 +64,17 @@ public class CDebugUtils
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static String toHexAddressString( long address )
|
||||
{
|
||||
String addressString = Long.toHexString( address );
|
||||
StringBuffer sb = new StringBuffer( 10 );
|
||||
sb.append( "0x" );
|
||||
for ( int i = 0; i < 8 - addressString.length(); ++i )
|
||||
{
|
||||
sb.append( '0' );
|
||||
}
|
||||
sb.append( addressString );
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -62,6 +62,13 @@ public class DisassemblyStorage implements IDisassemblyStorage
|
|||
*/
|
||||
public int getLineNumber( long address )
|
||||
{
|
||||
for ( int i = 0; i < fInstructions.length; ++i )
|
||||
{
|
||||
if ( fInstructions[i].getAdress() == address )
|
||||
{
|
||||
return i + 1;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -139,7 +146,7 @@ public class DisassemblyStorage implements IDisassemblyStorage
|
|||
StringBuffer lines = new StringBuffer();
|
||||
for ( int i = 0; i < fInstructions.length; ++i )
|
||||
{
|
||||
lines.append( fInstructions[i].toString() );
|
||||
lines.append( getInstructionString( fInstructions[i] ) );
|
||||
}
|
||||
fInputStream = new ByteArrayInputStream( lines.toString().getBytes() );
|
||||
}
|
||||
|
@ -158,6 +165,22 @@ public class DisassemblyStorage implements IDisassemblyStorage
|
|||
StringBuffer sb = new StringBuffer();
|
||||
if ( instruction != null )
|
||||
{
|
||||
sb .append( CDebugUtils.toHexAddressString( instruction.getAdress() ) );
|
||||
sb.append( ' ' );
|
||||
if ( instruction.getFuntionName() != null && instruction.getFuntionName().length() > 0 )
|
||||
{
|
||||
sb.append( '<' );
|
||||
sb.append( instruction.getFuntionName() );
|
||||
if ( instruction.getOffset() != 0 )
|
||||
{
|
||||
sb.append( '+' );
|
||||
sb.append( instruction.getOffset() );
|
||||
}
|
||||
sb.append( ">:" );
|
||||
sb.append( '\t' );
|
||||
}
|
||||
sb.append( instruction.getInstruction() );
|
||||
sb.append( '\n' );
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
|
|
|
@ -52,6 +52,10 @@ public class CSourceManager implements ICSourceLocator, ISourceMode, IAdaptable
|
|||
return frameInfo.getFrameLineNumber();
|
||||
}
|
||||
}
|
||||
if ( getRealMode() == ISourceMode.MODE_DISASSEMBLY && getDisassemblyManager() != null )
|
||||
{
|
||||
return getDisassemblyManager().getLineNumber( frameInfo );
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -118,7 +118,7 @@ public class DisassemblyManager
|
|||
{
|
||||
try
|
||||
{
|
||||
instructions = sm.getInstructions( "0x" + Long.toHexString( address ), "0x" + Long.toHexString( address + DISASSEMBLY_BLOCK_SIZE ) );
|
||||
instructions = sm.getInstructions( address, address + DISASSEMBLY_BLOCK_SIZE );
|
||||
}
|
||||
catch( CDIException e )
|
||||
{
|
||||
|
|
Loading…
Add table
Reference in a new issue