1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-23 17:05:26 +02:00

2005-03-23 Alain Magloire

Changes in the CDI ICDIMemoryBlock && ICDIMemoryBlockManagement API.
	* cdi/org/eclipse/cdt/debug/mi/core/cdi/MemoryManager.java
	* cdi/org/eclipse/cdt/debug/mi/core/cdi/model/MemoryBlock.java
	* cdi/org/eclipse/cdt/debug/mi/core/cdi/model/Target.java
This commit is contained in:
Alain Magloire 2005-03-23 22:36:18 +00:00
parent 02cff41bd7
commit 106f442a0d
4 changed files with 26 additions and 23 deletions

View file

@ -1,3 +1,9 @@
2005-03-23 Alain Magloire
Changes in the CDI ICDIMemoryBlock && ICDIMemoryBlockManagement API.
* cdi/org/eclipse/cdt/debug/mi/core/cdi/MemoryManager.java
* cdi/org/eclipse/cdt/debug/mi/core/cdi/model/MemoryBlock.java
* cdi/org/eclipse/cdt/debug/mi/core/cdi/model/Target.java
2005-03-09 Mikhail Khodjaiants 2005-03-09 Mikhail Khodjaiants
Fix for bug 87546: Obsolete debug MI settings in Preference need to be removed. Fix for bug 87546: Obsolete debug MI settings in Preference need to be removed.
* RegisterManager.java * RegisterManager.java

View file

@ -134,16 +134,17 @@ public class MemoryManager extends Manager {
MemoryBlock cloneBlock(MemoryBlock block) throws CDIException { MemoryBlock cloneBlock(MemoryBlock block) throws CDIException {
Target target = (Target)block.getTarget(); Target target = (Target)block.getTarget();
String exp = block.getExpression(); String exp = block.getExpression();
MIDataReadMemoryInfo info = createMIDataReadMemoryInfo(target.getMISession(), exp, (int)block.getLength()); int wordSize = block.getWordSize();
return new MemoryBlock(target, exp, info); MIDataReadMemoryInfo info = createMIDataReadMemoryInfo(target.getMISession(), exp, (int)block.getLength(), wordSize);
return new MemoryBlock(target, exp, wordSize, info);
} }
/** /**
* Post a -data-read-memory to gdb/mi. * Post a -data-read-memory to gdb/mi.
*/ */
MIDataReadMemoryInfo createMIDataReadMemoryInfo(MISession miSession, String exp, int length) throws CDIException { MIDataReadMemoryInfo createMIDataReadMemoryInfo(MISession miSession, String exp, int units, int wordSize) throws CDIException {
CommandFactory factory = miSession.getCommandFactory(); CommandFactory factory = miSession.getCommandFactory();
MIDataReadMemory mem = factory.createMIDataReadMemory(0, exp, MIFormat.HEXADECIMAL, 1, 1, length, null); MIDataReadMemory mem = factory.createMIDataReadMemory(0, exp, MIFormat.HEXADECIMAL, wordSize, 1, units, null);
try { try {
miSession.postCommand(mem); miSession.postCommand(mem);
MIDataReadMemoryInfo info = mem.getMIDataReadMemoryInfo(); MIDataReadMemoryInfo info = mem.getMIDataReadMemoryInfo();
@ -156,14 +157,9 @@ public class MemoryManager extends Manager {
} }
} }
public ICDIMemoryBlock createMemoryBlock(Target target, BigInteger address, int length) public ICDIMemoryBlock createMemoryBlock(Target target, String address, int units, int wordSize) throws CDIException {
throws CDIException { MIDataReadMemoryInfo info = createMIDataReadMemoryInfo(target.getMISession(), address, units, wordSize);
return createMemoryBlock(target, address.toString(16), length); ICDIMemoryBlock block = new MemoryBlock(target, address, wordSize, info);
}
public ICDIMemoryBlock createMemoryBlock(Target target, String address, int length) throws CDIException {
MIDataReadMemoryInfo info = createMIDataReadMemoryInfo(target.getMISession(), address, length);
ICDIMemoryBlock block = new MemoryBlock(target, address, info);
List blockList = getMemoryBlockList(target); List blockList = getMemoryBlockList(target);
blockList.add(block); blockList.add(block);
MISession miSession = target.getMISession(); MISession miSession = target.getMISession();

View file

@ -37,13 +37,15 @@ public class MemoryBlock extends CObject implements ICDIMemoryBlock {
boolean dirty; boolean dirty;
private MIDataReadMemoryInfo mem; private MIDataReadMemoryInfo mem;
private int fWordSize;
private BigInteger cStartAddress; //cached start address private BigInteger cStartAddress; //cached start address
private byte[] cBytes; //cached bytes private byte[] cBytes; //cached bytes
private int[] badOffsets; private int[] badOffsets;
public MemoryBlock(Target target, String exp, MIDataReadMemoryInfo info) { public MemoryBlock(Target target, String exp, int wordSize, MIDataReadMemoryInfo info) {
super(target); super(target);
expression = exp; expression = exp;
fWordSize = wordSize;
frozen = true; frozen = true;
setMIDataReadMemoryInfo(info); setMIDataReadMemoryInfo(info);
} }
@ -55,6 +57,13 @@ public class MemoryBlock extends CObject implements ICDIMemoryBlock {
return expression; return expression;
} }
/**
* @return the size of each memory word in bytes.
*/
public int getWordSize() {
return fWordSize;
}
/** /**
* Reset the internal MIDataReadMemoryInfo. All modifications into mem info should be done * Reset the internal MIDataReadMemoryInfo. All modifications into mem info should be done
* using this method * using this method

View file

@ -888,17 +888,9 @@ public class Target extends SessionObject implements ICDITarget {
/* (non-Javadoc) /* (non-Javadoc)
* @see org.eclipse.cdt.debug.core.cdi.model.ICDIMemoryBlockManagement#createMemoryBlock(java.lang.String, int) * @see org.eclipse.cdt.debug.core.cdi.model.ICDIMemoryBlockManagement#createMemoryBlock(java.lang.String, int)
*/ */
public ICDIMemoryBlock createMemoryBlock(String address, int length) throws CDIException { public ICDIMemoryBlock createMemoryBlock(String address, int units, int wordSize) throws CDIException {
MemoryManager memMgr = ((Session)getSession()).getMemoryManager(); MemoryManager memMgr = ((Session)getSession()).getMemoryManager();
return memMgr.createMemoryBlock(this, address, length); return memMgr.createMemoryBlock(this, address, units, wordSize);
}
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.core.cdi.model.ICDIMemoryBlockManagement#createMemoryBlock(java.math.BigInteger, int)
*/
public ICDIMemoryBlock createMemoryBlock(BigInteger address, int length) throws CDIException {
MemoryManager memMgr = ((Session)getSession()).getMemoryManager();
return memMgr.createMemoryBlock(this, address, length);
} }
/* (non-Javadoc) /* (non-Javadoc)