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

reuse refresh() to fire events if the assign was succesffull.

This commit is contained in:
Alain Magloire 2002-10-30 20:51:53 +00:00
parent 33f9b69bf6
commit ac61f0f586

View file

@ -10,7 +10,6 @@ import org.eclipse.cdt.debug.mi.core.MIFormat;
import org.eclipse.cdt.debug.mi.core.MISession; 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.CommandFactory;
import org.eclipse.cdt.debug.mi.core.command.MIDataWriteMemory; 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.MIDataReadMemoryInfo;
import org.eclipse.cdt.debug.mi.core.output.MIInfo; import org.eclipse.cdt.debug.mi.core.output.MIInfo;
import org.eclipse.cdt.debug.mi.core.output.MIMemory; import org.eclipse.cdt.debug.mi.core.output.MIMemory;
@ -140,26 +139,23 @@ public class MemoryBlock extends CObject implements ICDIMemoryBlock {
} }
MISession mi = getCTarget().getCSession().getMISession(); MISession mi = getCTarget().getCSession().getMISession();
CommandFactory factory = mi.getCommandFactory(); CommandFactory factory = mi.getCommandFactory();
Long[] addresses = new Long[bytes.length];
for (int i = 0; i < bytes.length; i++) { for (int i = 0; i < bytes.length; i++) {
long l = new Byte(bytes[i]).longValue(); long l = new Byte(bytes[i]).longValue();
String value = "0x" + Long.toHexString(l); String value = "0x" + Long.toHexString(l);
MIDataWriteMemory mem = factory.createMIDataWriteMemory(offset + i, MIDataWriteMemory mw = factory.createMIDataWriteMemory(offset + i,
expression, MIFormat.HEXADECIMAL, 1, value); expression, MIFormat.HEXADECIMAL, 1, value);
try { try {
mi.postCommand(mem); mi.postCommand(mw);
MIInfo info = mem.getMIInfo(); MIInfo info = mw.getMIInfo();
if (info == null) { if (info == null) {
throw new CDIException("No answer"); throw new CDIException("No answer");
} }
} catch (MIException e) { } catch (MIException e) {
throw new CDIException(e.getMessage()); throw new CDIException(e.getMessage());
} }
addresses[i] = new Long(getStartAddress() + offset + i);
} }
// If the assign was succesfull fire a MIChangedEvent() // If the assign was succesfull fire a MIChangedEvent() via refresh.
MIMemoryChangedEvent change = new MIMemoryChangedEvent(addresses); refresh();
mi.fireEvent(change);
} }
} }