1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

Generate a MIMemoryChangedEvent when doing setValue.

This commit is contained in:
Alain Magloire 2002-10-28 20:38:18 +00:00
parent c8ad29addc
commit 9a92aa9b13

View file

@ -10,6 +10,7 @@ import org.eclipse.cdt.debug.mi.core.MIFormat;
import org.eclipse.cdt.debug.mi.core.MISession;
import org.eclipse.cdt.debug.mi.core.command.CommandFactory;
import org.eclipse.cdt.debug.mi.core.command.MIDataWriteMemory;
import org.eclipse.cdt.debug.mi.core.event.MIMemoryChangedEvent;
import org.eclipse.cdt.debug.mi.core.output.MIDataReadMemoryInfo;
import org.eclipse.cdt.debug.mi.core.output.MIInfo;
import org.eclipse.cdt.debug.mi.core.output.MIMemory;
@ -134,8 +135,12 @@ public class MemoryBlock extends CObject implements ICDIMemoryBlock {
* @see org.eclipse.cdt.debug.core.cdi.model.ICDIMemoryBlock#setValue(long, byte[])
*/
public void setValue(long offset, byte[] bytes) throws CDIException {
if (offset >= getLength() || offset + bytes.length > getLength()) {
throw new CDIException("Bad Offset");
}
MISession mi = getCTarget().getCSession().getMISession();
CommandFactory factory = mi.getCommandFactory();
Long[] addresses = new Long[bytes.length];
for (int i = 0; i < bytes.length; i++) {
long l = new Byte(bytes[i]).longValue();
String value = "0x" + Long.toHexString(l);
@ -150,7 +155,11 @@ public class MemoryBlock extends CObject implements ICDIMemoryBlock {
} catch (MIException e) {
throw new CDIException(e.getMessage());
}
addresses[i] = new Long(getStartAddress() + offset + i);
}
// If the assign was succesfull fire a MIChangedEvent()
MIMemoryChangedEvent change = new MIMemoryChangedEvent(addresses);
mi.fireEvent(change);
}
}