mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-09-10 12:03:16 +02:00
Bug 138920: Disassembly windows not refresh after program memory change.
This commit is contained in:
parent
d31446aba0
commit
828cb951d5
2 changed files with 33 additions and 1 deletions
|
@ -17,6 +17,9 @@ import org.eclipse.cdt.core.IAddressFactory;
|
||||||
import org.eclipse.cdt.debug.core.CDebugCorePlugin;
|
import org.eclipse.cdt.debug.core.CDebugCorePlugin;
|
||||||
import org.eclipse.cdt.debug.core.ICDebugConstants;
|
import org.eclipse.cdt.debug.core.ICDebugConstants;
|
||||||
import org.eclipse.cdt.debug.core.cdi.CDIException;
|
import org.eclipse.cdt.debug.core.cdi.CDIException;
|
||||||
|
import org.eclipse.cdt.debug.core.cdi.event.ICDIEvent;
|
||||||
|
import org.eclipse.cdt.debug.core.cdi.event.ICDIEventListener;
|
||||||
|
import org.eclipse.cdt.debug.core.cdi.event.ICDIMemoryChangedEvent;
|
||||||
import org.eclipse.cdt.debug.core.cdi.model.ICDIInstruction;
|
import org.eclipse.cdt.debug.core.cdi.model.ICDIInstruction;
|
||||||
import org.eclipse.cdt.debug.core.cdi.model.ICDIMixedInstruction;
|
import org.eclipse.cdt.debug.core.cdi.model.ICDIMixedInstruction;
|
||||||
import org.eclipse.cdt.debug.core.cdi.model.ICDITarget;
|
import org.eclipse.cdt.debug.core.cdi.model.ICDITarget;
|
||||||
|
@ -30,7 +33,7 @@ import org.eclipse.debug.core.DebugException;
|
||||||
/**
|
/**
|
||||||
* CDI implementation of IDisassembly
|
* CDI implementation of IDisassembly
|
||||||
*/
|
*/
|
||||||
public class Disassembly extends CDebugElement implements IDisassembly {
|
public class Disassembly extends CDebugElement implements IDisassembly, ICDIEventListener {
|
||||||
|
|
||||||
final static private int DISASSEMBLY_BLOCK_SIZE = 100;
|
final static private int DISASSEMBLY_BLOCK_SIZE = 100;
|
||||||
|
|
||||||
|
@ -43,6 +46,7 @@ public class Disassembly extends CDebugElement implements IDisassembly {
|
||||||
*/
|
*/
|
||||||
public Disassembly( CDebugTarget target ) {
|
public Disassembly( CDebugTarget target ) {
|
||||||
super( target );
|
super( target );
|
||||||
|
getCDISession().getEventManager().addEventListener( this );
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
|
@ -117,6 +121,7 @@ public class Disassembly extends CDebugElement implements IDisassembly {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void dispose() {
|
public void dispose() {
|
||||||
|
getCDISession().getEventManager().removeEventListener( this );
|
||||||
for ( int i = 0; i < fBlocks.length; ++i )
|
for ( int i = 0; i < fBlocks.length; ++i )
|
||||||
if ( fBlocks[i] != null ) {
|
if ( fBlocks[i] != null ) {
|
||||||
fBlocks[i].dispose();
|
fBlocks[i].dispose();
|
||||||
|
@ -148,4 +153,27 @@ public class Disassembly extends CDebugElement implements IDisassembly {
|
||||||
public IAddressFactory getAddressFactory() {
|
public IAddressFactory getAddressFactory() {
|
||||||
return ((CDebugTarget)getDebugTarget()).getAddressFactory();
|
return ((CDebugTarget)getDebugTarget()).getAddressFactory();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.debug.core.cdi.event.ICDIEventListener#handleDebugEvents(org.eclipse.cdt.debug.core.cdi.event.ICDIEvent[])
|
||||||
|
*/
|
||||||
|
public void handleDebugEvents( ICDIEvent[] events ) {
|
||||||
|
boolean update = false;
|
||||||
|
for ( int i = 0; i < events.length; ++i ) {
|
||||||
|
if ( events[i] instanceof ICDIMemoryChangedEvent ) {
|
||||||
|
BigInteger[] addresses = ((ICDIMemoryChangedEvent)events[i]).getAddresses();
|
||||||
|
for ( int j = 0; j < addresses.length; ++j ) {
|
||||||
|
IAddress address = getAddressFactory().createAddress( addresses[i] );
|
||||||
|
for ( int k = 0; k < fBlocks.length; ++k ) {
|
||||||
|
if ( fBlocks[k] != null && fBlocks[k].contains( address ) ) {
|
||||||
|
update = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ( update )
|
||||||
|
reset();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -225,4 +225,8 @@ public class DisassemblyBlock implements IDisassemblyBlock, IAdaptable {
|
||||||
private void setMixedMode( boolean mixedMode ) {
|
private void setMixedMode( boolean mixedMode ) {
|
||||||
this.fMixedMode = mixedMode;
|
this.fMixedMode = mixedMode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected boolean contains( IAddress address ) {
|
||||||
|
return ( address.compareTo( fStartAddress ) >= 0 && address.compareTo( fEndAddress ) <= 0 );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue