mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-04 14:55:41 +02:00
- a bit of extensibility for disassembly view
This commit is contained in:
parent
1c9e947c87
commit
60aa52eccf
3 changed files with 51 additions and 1 deletions
|
@ -97,6 +97,46 @@ public class Disassembly extends CDebugElement implements IDisassembly, ICDIEven
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public IDisassemblyBlock getDisassemblyBlock( IAddress address ) throws DebugException {
|
||||||
|
fBlocks[0] = createBlock( address, null);
|
||||||
|
return fBlocks[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
public IDisassemblyBlock getDisassemblyBlock( IAddress startAddress, IAddress endAddress ) throws DebugException {
|
||||||
|
fBlocks[0] = createBlock( startAddress, endAddress );
|
||||||
|
return fBlocks[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
private DisassemblyBlock createBlock( IAddress startAddress, IAddress endAddress) throws DebugException {
|
||||||
|
ICDITarget target = (ICDITarget)getDebugTarget().getAdapter( ICDITarget.class );
|
||||||
|
if ( target != null ) {
|
||||||
|
ICDIMixedInstruction[] mixedInstrs = new ICDIMixedInstruction[0];
|
||||||
|
if ( mixedInstrs.length == 0 ||
|
||||||
|
!containsAddress( mixedInstrs, startAddress ) ) {
|
||||||
|
try {
|
||||||
|
BigInteger startAddr = new BigInteger( startAddress.toString() );
|
||||||
|
BigInteger endAddr = null;
|
||||||
|
if (endAddress != null) {
|
||||||
|
endAddr = new BigInteger( endAddress.toString() );
|
||||||
|
} else {
|
||||||
|
endAddr = startAddr.add( BigInteger.valueOf(
|
||||||
|
CDebugCorePlugin.getDefault().getPluginPreferences().getInt(ICDebugConstants.PREF_MAX_NUMBER_OF_INSTRUCTIONS)));
|
||||||
|
}
|
||||||
|
mixedInstrs = target.getMixedInstructions( startAddr, endAddr);
|
||||||
|
return DisassemblyBlock.create( this, mixedInstrs );
|
||||||
|
}
|
||||||
|
catch( CDIException e ) {
|
||||||
|
targetRequestFailed( e.getMessage(), e );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return DisassemblyBlock.create( this, mixedInstrs );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
private boolean containsAddress( ICDIMixedInstruction[] mi, IAddress address ) {
|
private boolean containsAddress( ICDIMixedInstruction[] mi, IAddress address ) {
|
||||||
for( int i = 0; i < mi.length; ++i ) {
|
for( int i = 0; i < mi.length; ++i ) {
|
||||||
|
|
|
@ -226,6 +226,9 @@ public class DisassemblyEditorInput implements IEditorInput {
|
||||||
return input;
|
return input;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static DisassemblyEditorInput create( IDisassemblyBlock block) throws DebugException {
|
||||||
|
return new DisassemblyEditorInput(block);
|
||||||
|
}
|
||||||
private void createContents() {
|
private void createContents() {
|
||||||
fSourceRegions = new IRegion[0];
|
fSourceRegions = new IRegion[0];
|
||||||
StringBuffer lines = new StringBuffer();
|
StringBuffer lines = new StringBuffer();
|
||||||
|
@ -320,6 +323,13 @@ public class DisassemblyEditorInput implements IEditorInput {
|
||||||
return ( fBlock != null ) ? fBlock.getDisassembly() : null;
|
return ( fBlock != null ) ? fBlock.getDisassembly() : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the disassembly block
|
||||||
|
*/
|
||||||
|
public IDisassemblyBlock getDisassemblyBlock() {
|
||||||
|
return fBlock;
|
||||||
|
}
|
||||||
|
|
||||||
public ICLineBreakpoint breakpointExists( IAddress address ) throws CoreException {
|
public ICLineBreakpoint breakpointExists( IAddress address ) throws CoreException {
|
||||||
Assert.isTrue( address != null );
|
Assert.isTrue( address != null );
|
||||||
IDisassembly dis = getDisassembly();
|
IDisassembly dis = getDisassembly();
|
||||||
|
|
|
@ -439,7 +439,7 @@ public class DisassemblyView extends AbstractDebugEventHandlerView
|
||||||
resetViewerInput();
|
resetViewerInput();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void setViewerInput( IEditorInput input ) {
|
public void setViewerInput( IEditorInput input ) {
|
||||||
SourceViewer viewer = getSourceViewer();
|
SourceViewer viewer = getSourceViewer();
|
||||||
if ( viewer == null )
|
if ( viewer == null )
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Add table
Reference in a new issue