mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Fix for bug 26595.
This commit is contained in:
parent
88455f3cd6
commit
fdc45b36d4
9 changed files with 107 additions and 19 deletions
|
@ -1,3 +1,11 @@
|
||||||
|
2002-11-20 Mikhail Khodjaiants
|
||||||
|
Fix for bug 26595.
|
||||||
|
The type of the address expression has been changed from String to ICDIExpression to handle
|
||||||
|
changes of the start address.
|
||||||
|
* CDebugModel.java
|
||||||
|
* CFormattedMemoryBlock.java
|
||||||
|
* IFormattedMemoryBlock.java: added the 'isStartAddressChanged' method.
|
||||||
|
|
||||||
2002-11-15 Mikhail Khodjaiants
|
2002-11-15 Mikhail Khodjaiants
|
||||||
Partial fix for bug 25956.
|
Partial fix for bug 25956.
|
||||||
* DisassemblyManager.java: Filter out the instructions that do not belong to the function.
|
* DisassemblyManager.java: Filter out the instructions that do not belong to the function.
|
||||||
|
|
|
@ -367,7 +367,7 @@ public class CDebugModel
|
||||||
}
|
}
|
||||||
|
|
||||||
public static IFormattedMemoryBlock createFormattedMemoryBlock( IDebugTarget target,
|
public static IFormattedMemoryBlock createFormattedMemoryBlock( IDebugTarget target,
|
||||||
String startAddress,
|
String addressExpression,
|
||||||
int format,
|
int format,
|
||||||
int wordSize,
|
int wordSize,
|
||||||
int numberOfRows,
|
int numberOfRows,
|
||||||
|
@ -378,12 +378,15 @@ public class CDebugModel
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
ICDIExpression expression = ((CDebugTarget)target).getCDISession()
|
||||||
|
.getExpressionManager()
|
||||||
|
.createExpression( addressExpression );
|
||||||
ICDIMemoryBlock cdiMemoryBlock = ((CDebugTarget)target).getCDISession()
|
ICDIMemoryBlock cdiMemoryBlock = ((CDebugTarget)target).getCDISession()
|
||||||
.getMemoryManager()
|
.getMemoryManager()
|
||||||
.createMemoryBlock( startAddress, wordSize * numberOfRows * numberOfColumns );
|
.createMemoryBlock( expression.getName(), wordSize * numberOfRows * numberOfColumns );
|
||||||
return new CFormattedMemoryBlock( (CDebugTarget)target,
|
return new CFormattedMemoryBlock( (CDebugTarget)target,
|
||||||
cdiMemoryBlock,
|
cdiMemoryBlock,
|
||||||
startAddress,
|
expression,
|
||||||
format,
|
format,
|
||||||
wordSize,
|
wordSize,
|
||||||
numberOfRows,
|
numberOfRows,
|
||||||
|
@ -403,7 +406,7 @@ public class CDebugModel
|
||||||
}
|
}
|
||||||
|
|
||||||
public static IFormattedMemoryBlock createFormattedMemoryBlock( IDebugTarget target,
|
public static IFormattedMemoryBlock createFormattedMemoryBlock( IDebugTarget target,
|
||||||
String startAddress,
|
String addressExpression,
|
||||||
int format,
|
int format,
|
||||||
int wordSize,
|
int wordSize,
|
||||||
int numberOfRows,
|
int numberOfRows,
|
||||||
|
@ -413,12 +416,15 @@ public class CDebugModel
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
ICDIExpression expression = ((CDebugTarget)target).getCDISession()
|
||||||
|
.getExpressionManager()
|
||||||
|
.createExpression( addressExpression );
|
||||||
ICDIMemoryBlock cdiMemoryBlock = ((CDebugTarget)target).getCDISession()
|
ICDIMemoryBlock cdiMemoryBlock = ((CDebugTarget)target).getCDISession()
|
||||||
.getMemoryManager()
|
.getMemoryManager()
|
||||||
.createMemoryBlock( startAddress, wordSize * numberOfRows * numberOfColumns );
|
.createMemoryBlock( expression.getName(), wordSize * numberOfRows * numberOfColumns );
|
||||||
return new CFormattedMemoryBlock( (CDebugTarget)target,
|
return new CFormattedMemoryBlock( (CDebugTarget)target,
|
||||||
cdiMemoryBlock,
|
cdiMemoryBlock,
|
||||||
startAddress,
|
expression,
|
||||||
format,
|
format,
|
||||||
wordSize,
|
wordSize,
|
||||||
numberOfRows,
|
numberOfRows,
|
||||||
|
|
|
@ -134,4 +134,6 @@ public interface IFormattedMemoryBlock extends IMemoryBlock
|
||||||
boolean canChangeFormat( int format );
|
boolean canChangeFormat( int format );
|
||||||
|
|
||||||
boolean isLittleEndian();
|
boolean isLittleEndian();
|
||||||
|
|
||||||
|
boolean isStartAddressChanged();
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,10 +14,12 @@ import org.eclipse.cdt.debug.core.IExecFileInfo;
|
||||||
import org.eclipse.cdt.debug.core.IFormattedMemoryBlock;
|
import org.eclipse.cdt.debug.core.IFormattedMemoryBlock;
|
||||||
import org.eclipse.cdt.debug.core.IFormattedMemoryBlockRow;
|
import org.eclipse.cdt.debug.core.IFormattedMemoryBlockRow;
|
||||||
import org.eclipse.cdt.debug.core.cdi.CDIException;
|
import org.eclipse.cdt.debug.core.cdi.CDIException;
|
||||||
|
import org.eclipse.cdt.debug.core.cdi.event.ICDIChangedEvent;
|
||||||
import org.eclipse.cdt.debug.core.cdi.event.ICDIEvent;
|
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.ICDIEventListener;
|
||||||
import org.eclipse.cdt.debug.core.cdi.event.ICDIMemoryChangedEvent;
|
import org.eclipse.cdt.debug.core.cdi.event.ICDIMemoryChangedEvent;
|
||||||
import org.eclipse.cdt.debug.core.cdi.event.ICDIResumedEvent;
|
import org.eclipse.cdt.debug.core.cdi.event.ICDIResumedEvent;
|
||||||
|
import org.eclipse.cdt.debug.core.cdi.model.ICDIExpression;
|
||||||
import org.eclipse.cdt.debug.core.cdi.model.ICDIMemoryBlock;
|
import org.eclipse.cdt.debug.core.cdi.model.ICDIMemoryBlock;
|
||||||
import org.eclipse.cdt.debug.core.cdi.model.ICDIObject;
|
import org.eclipse.cdt.debug.core.cdi.model.ICDIObject;
|
||||||
import org.eclipse.cdt.debug.core.cdi.model.ICDITarget;
|
import org.eclipse.cdt.debug.core.cdi.model.ICDITarget;
|
||||||
|
@ -175,7 +177,8 @@ public class CFormattedMemoryBlock extends CDebugElement
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private String fAddressExpression;
|
// private String fAddressExpression;
|
||||||
|
private ICDIExpression fAddressExpression;
|
||||||
private ICDIMemoryBlock fCDIMemoryBlock;
|
private ICDIMemoryBlock fCDIMemoryBlock;
|
||||||
private byte[] fBytes = null;
|
private byte[] fBytes = null;
|
||||||
private int fFormat;
|
private int fFormat;
|
||||||
|
@ -187,6 +190,7 @@ public class CFormattedMemoryBlock extends CDebugElement
|
||||||
private List fRows = null;
|
private List fRows = null;
|
||||||
private Long[] fChangedAddresses = new Long[0];
|
private Long[] fChangedAddresses = new Long[0];
|
||||||
private DirtyBytes fDirtyBytes = null;
|
private DirtyBytes fDirtyBytes = null;
|
||||||
|
private boolean fStartAddressChanged = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor for CFormattedMemoryBlock.
|
* Constructor for CFormattedMemoryBlock.
|
||||||
|
@ -194,7 +198,7 @@ public class CFormattedMemoryBlock extends CDebugElement
|
||||||
*/
|
*/
|
||||||
public CFormattedMemoryBlock( CDebugTarget target,
|
public CFormattedMemoryBlock( CDebugTarget target,
|
||||||
ICDIMemoryBlock cdiMemoryBlock,
|
ICDIMemoryBlock cdiMemoryBlock,
|
||||||
String addressExpression,
|
ICDIExpression addressExpression,
|
||||||
int format,
|
int format,
|
||||||
int wordSize,
|
int wordSize,
|
||||||
int numberOfRows,
|
int numberOfRows,
|
||||||
|
@ -209,7 +213,7 @@ public class CFormattedMemoryBlock extends CDebugElement
|
||||||
*/
|
*/
|
||||||
public CFormattedMemoryBlock( CDebugTarget target,
|
public CFormattedMemoryBlock( CDebugTarget target,
|
||||||
ICDIMemoryBlock cdiMemoryBlock,
|
ICDIMemoryBlock cdiMemoryBlock,
|
||||||
String addressExpression,
|
ICDIExpression addressExpression,
|
||||||
int format,
|
int format,
|
||||||
int wordSize,
|
int wordSize,
|
||||||
int numberOfRows,
|
int numberOfRows,
|
||||||
|
@ -473,6 +477,18 @@ public class CFormattedMemoryBlock extends CDebugElement
|
||||||
}
|
}
|
||||||
fCDIMemoryBlock = null;
|
fCDIMemoryBlock = null;
|
||||||
}
|
}
|
||||||
|
if ( fAddressExpression != null )
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
((CDebugTarget)getDebugTarget()).getCDISession().getExpressionManager().removeExpression( fAddressExpression );
|
||||||
|
}
|
||||||
|
catch( CDIException e )
|
||||||
|
{
|
||||||
|
CDebugCorePlugin.log( e );
|
||||||
|
}
|
||||||
|
fAddressExpression = null;
|
||||||
|
}
|
||||||
getCDISession().getEventManager().removeEventListener( this );
|
getCDISession().getEventManager().removeEventListener( this );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -481,7 +497,15 @@ public class CFormattedMemoryBlock extends CDebugElement
|
||||||
*/
|
*/
|
||||||
public String getAddressExpression()
|
public String getAddressExpression()
|
||||||
{
|
{
|
||||||
return fAddressExpression;
|
try
|
||||||
|
{
|
||||||
|
return fAddressExpression.getName();
|
||||||
|
}
|
||||||
|
catch( CDIException e )
|
||||||
|
{
|
||||||
|
// ignore
|
||||||
|
}
|
||||||
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
private String[] createData( byte[] bytes, int offset, int length )
|
private String[] createData( byte[] bytes, int offset, int length )
|
||||||
|
@ -539,6 +563,13 @@ public class CFormattedMemoryBlock extends CDebugElement
|
||||||
handleChangedEvent( (ICDIMemoryChangedEvent)event );
|
handleChangedEvent( (ICDIMemoryChangedEvent)event );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if ( event instanceof ICDIChangedEvent )
|
||||||
|
{
|
||||||
|
if ( source instanceof ICDIExpression && source.equals( fAddressExpression ) )
|
||||||
|
{
|
||||||
|
handleAddressChangedEvent( (ICDIChangedEvent)event );
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -555,6 +586,7 @@ public class CFormattedMemoryBlock extends CDebugElement
|
||||||
private void handleResumedEvent( ICDIResumedEvent event )
|
private void handleResumedEvent( ICDIResumedEvent event )
|
||||||
{
|
{
|
||||||
resetChangedAddresses();
|
resetChangedAddresses();
|
||||||
|
fStartAddressChanged = false;
|
||||||
fireChangeEvent( DebugEvent.CONTENT );
|
fireChangeEvent( DebugEvent.CONTENT );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -566,6 +598,14 @@ public class CFormattedMemoryBlock extends CDebugElement
|
||||||
fireChangeEvent( DebugEvent.CONTENT );
|
fireChangeEvent( DebugEvent.CONTENT );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void handleAddressChangedEvent( ICDIChangedEvent event )
|
||||||
|
{
|
||||||
|
resetBytes();
|
||||||
|
resetRows();
|
||||||
|
fStartAddressChanged = true;
|
||||||
|
fireChangeEvent( DebugEvent.CONTENT );
|
||||||
|
}
|
||||||
|
|
||||||
public Long[] getChangedAddresses()
|
public Long[] getChangedAddresses()
|
||||||
{
|
{
|
||||||
return fChangedAddresses;
|
return fChangedAddresses;
|
||||||
|
@ -730,4 +770,12 @@ public class CFormattedMemoryBlock extends CDebugElement
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.debug.core.IFormattedMemoryBlock#isStartAddressChanged()
|
||||||
|
*/
|
||||||
|
public boolean isStartAddressChanged()
|
||||||
|
{
|
||||||
|
return fStartAddressChanged;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,3 +1,9 @@
|
||||||
|
2002-11-20 Mikhail Khodjaiants
|
||||||
|
Fix for bug 26595.
|
||||||
|
* src/.../mi/core/cdi/MemoryManager.java (compareBlocks):
|
||||||
|
If the start address of a memory block has changed fir 'changed' event
|
||||||
|
only for the corresponding bytes of the overlapping area of new and old blocks.
|
||||||
|
|
||||||
2002-11-19 Alain Magloire
|
2002-11-19 Alain Magloire
|
||||||
|
|
||||||
* src/.../mi/core/cdi/MemoryManager.java (compareBlocks):
|
* src/.../mi/core/cdi/MemoryManager.java (compareBlocks):
|
||||||
|
|
|
@ -58,10 +58,11 @@ public class MemoryManager extends SessionObject implements ICDIMemoryManager {
|
||||||
*/
|
*/
|
||||||
public Long[] update(MemoryBlock block, List aList) throws CDIException {
|
public Long[] update(MemoryBlock block, List aList) throws CDIException {
|
||||||
MemoryBlock newBlock = cloneBlock(block);
|
MemoryBlock newBlock = cloneBlock(block);
|
||||||
|
boolean newAddress = ( newBlock.getStartAddress() != block.getStartAddress() );
|
||||||
Long[] array = compareBlocks(block, newBlock);
|
Long[] array = compareBlocks(block, newBlock);
|
||||||
// Update the block MIDataReadMemoryInfo.
|
// Update the block MIDataReadMemoryInfo.
|
||||||
block.setMIDataReadMemoryInfo(newBlock.getMIDataReadMemoryInfo());
|
block.setMIDataReadMemoryInfo(newBlock.getMIDataReadMemoryInfo());
|
||||||
if (array.length > 0) {
|
if (array.length > 0 || newAddress) {
|
||||||
if (aList != null) {
|
if (aList != null) {
|
||||||
aList.add(new MIMemoryChangedEvent(array));
|
aList.add(new MIMemoryChangedEvent(array));
|
||||||
} else {
|
} else {
|
||||||
|
@ -90,13 +91,14 @@ public class MemoryManager extends SessionObject implements ICDIMemoryManager {
|
||||||
byte[] oldBytes = oldBlock.getBytes();
|
byte[] oldBytes = oldBlock.getBytes();
|
||||||
byte[] newBytes = newBlock.getBytes();
|
byte[] newBytes = newBlock.getBytes();
|
||||||
List aList = new ArrayList(newBytes.length);
|
List aList = new ArrayList(newBytes.length);
|
||||||
|
long diff = newBlock.getStartAddress() - oldBlock.getStartAddress();
|
||||||
|
if ( Math.abs( diff ) < newBytes.length ) {
|
||||||
for (int i = 0; i < newBytes.length; i++) {
|
for (int i = 0; i < newBytes.length; i++) {
|
||||||
if (i < oldBytes.length) {
|
if (i + (int)diff < oldBytes.length && i + (int)diff >= 0) {
|
||||||
if (oldBytes[i] != newBytes[i]) {
|
if (oldBytes[i + (int)diff] != newBytes[i]) {
|
||||||
aList.add(new Long(newBlock.getStartAddress() + i));
|
aList.add(new Long(newBlock.getStartAddress() + i));
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
aList.add(new Long(newBlock.getStartAddress() + i));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return (Long[])aList.toArray(new Long[0]);
|
return (Long[])aList.toArray(new Long[0]);
|
||||||
|
|
|
@ -1,3 +1,9 @@
|
||||||
|
2002-11-20 Mikhail Khodjaiants
|
||||||
|
Fix for bug 26595.
|
||||||
|
Highlight the addresses if the start address of a memory expression has changed.
|
||||||
|
*MemoryPresentation.java
|
||||||
|
*MemoryText.java
|
||||||
|
|
||||||
2002-11-19 Mikhail Khodjaiants
|
2002-11-19 Mikhail Khodjaiants
|
||||||
Added enablement condition to some actions.
|
Added enablement condition to some actions.
|
||||||
*plugin.xml
|
*plugin.xml
|
||||||
|
|
|
@ -562,4 +562,13 @@ public class MemoryPresentation
|
||||||
}
|
}
|
||||||
return CDebugUtils.prependString( result, getDataItemLength(), ' ' );
|
return CDebugUtils.prependString( result, getDataItemLength(), ' ' );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected boolean isStartAddressChanged()
|
||||||
|
{
|
||||||
|
if ( getMemoryBlock() != null )
|
||||||
|
{
|
||||||
|
return getMemoryBlock().isStartAddressChanged();
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -142,11 +142,12 @@ public class MemoryText
|
||||||
|
|
||||||
}
|
}
|
||||||
zones = fPresentation.getAddressZones();
|
zones = fPresentation.getAddressZones();
|
||||||
|
boolean isStartAddressChanged = fPresentation.isStartAddressChanged();
|
||||||
for ( int i = 0; i < zones.length; ++i )
|
for ( int i = 0; i < zones.length; ++i )
|
||||||
{
|
{
|
||||||
fText.setStyleRange( new StyleRange( zones[i].x,
|
fText.setStyleRange( new StyleRange( zones[i].x,
|
||||||
zones[i].y - zones[i].x + 1,
|
zones[i].y - zones[i].x + 1,
|
||||||
getAddressColor(),
|
( isStartAddressChanged ) ? getChangedColor() : getAddressColor(),
|
||||||
getBackgroundColor() ) );
|
getBackgroundColor() ) );
|
||||||
}
|
}
|
||||||
fText.redraw();
|
fText.redraw();
|
||||||
|
|
Loading…
Add table
Reference in a new issue