Skip to main content
aboutsummaryrefslogtreecommitdiffstats
path: root/debug
diff options
context:
space:
mode:
authorMikhail Khodjaiants2007-06-19 10:06:55 +0000
committerMikhail Khodjaiants2007-06-19 10:06:55 +0000
commit828cb951d5143e240831dbab5b7b2b37487a712b (patch)
tree632d3f825c0e7d3748c77fcc26bee1723e89cdb4 /debug
parentd31446aba072db0e36daedce24c82620adc59b59 (diff)
downloadorg.eclipse.cdt-828cb951d5143e240831dbab5b7b2b37487a712b.tar.gz
org.eclipse.cdt-828cb951d5143e240831dbab5b7b2b37487a712b.tar.xz
org.eclipse.cdt-828cb951d5143e240831dbab5b7b2b37487a712b.zip
Bug 138920: Disassembly windows not refresh after program memory change.
Diffstat (limited to 'debug')
-rw-r--r--debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/Disassembly.java30
-rw-r--r--debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/DisassemblyBlock.java4
2 files changed, 33 insertions, 1 deletions
diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/Disassembly.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/Disassembly.java
index b1ac60822c1..956e78f4e56 100644
--- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/Disassembly.java
+++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/Disassembly.java
@@ -17,6 +17,9 @@ import org.eclipse.cdt.core.IAddressFactory;
import org.eclipse.cdt.debug.core.CDebugCorePlugin;
import org.eclipse.cdt.debug.core.ICDebugConstants;
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.ICDIMixedInstruction;
import org.eclipse.cdt.debug.core.cdi.model.ICDITarget;
@@ -30,7 +33,7 @@ import org.eclipse.debug.core.DebugException;
/**
* 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;
@@ -43,6 +46,7 @@ public class Disassembly extends CDebugElement implements IDisassembly {
*/
public Disassembly( CDebugTarget target ) {
super( target );
+ getCDISession().getEventManager().addEventListener( this );
}
/* (non-Javadoc)
@@ -117,6 +121,7 @@ public class Disassembly extends CDebugElement implements IDisassembly {
}
public void dispose() {
+ getCDISession().getEventManager().removeEventListener( this );
for ( int i = 0; i < fBlocks.length; ++i )
if ( fBlocks[i] != null ) {
fBlocks[i].dispose();
@@ -148,4 +153,27 @@ public class Disassembly extends CDebugElement implements IDisassembly {
public IAddressFactory 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();
+ }
}
diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/DisassemblyBlock.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/DisassemblyBlock.java
index a80c3ecac75..ae67a25f1df 100644
--- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/DisassemblyBlock.java
+++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/DisassemblyBlock.java
@@ -225,4 +225,8 @@ public class DisassemblyBlock implements IDisassemblyBlock, IAdaptable {
private void setMixedMode( boolean mixedMode ) {
this.fMixedMode = mixedMode;
}
+
+ protected boolean contains( IAddress address ) {
+ return ( address.compareTo( fStartAddress ) >= 0 && address.compareTo( fEndAddress ) <= 0 );
+ }
}

Back to the top