Index: frysk-core/frysk/proc/live/LogicalMemoryBuffer.java =================================================================== RCS file: /cvs/frysk/frysk-core/frysk/proc/live/LogicalMemoryBuffer.java,v retrieving revision 1.3 diff -u -r1.3 LogicalMemoryBuffer.java --- frysk-core/frysk/proc/live/LogicalMemoryBuffer.java 2 Aug 2007 11:23:28 -0000 1.3 +++ frysk-core/frysk/proc/live/LogicalMemoryBuffer.java 21 Oct 2007 04:57:42 -0000 @@ -128,14 +128,37 @@ } } + /** + * Pokes the value at the given index. Unless a breakpoint is set at + * that location (FIXME: this limitation should be lifted). + */ protected void poke (long index, int value) { - throw new UnsupportedOperationException("read only memory buffer"); + Breakpoint breakpoint = breakpoints.getBreakpoint(index); + if (breakpoint != null) + throw new UnsupportedOperationException("breakpoint set at: " + index); + + super.poke(index, value); } + /** + * Pokes the given bytes from offset at the index plus the given + * lenght. Unless a breakpoint is set in that range (FIXME: this + * limitation should be lifted). + */ protected int poke(long index, byte[] bytes, int offset, int length) { - throw new UnsupportedOperationException("read only memory buffer"); + synchronized (breakpoints) + { + Iterator it; + it = breakpoints.getBreakpoints(index, index + length); + if (it.hasNext()) + throw new UnsupportedOperationException("breakpoint set between " + + index + " and " + + index + length); + } + + return super.poke(index, bytes, offset, length); } protected ByteBuffer subBuffer(ByteBuffer parent, Index: frysk-core/frysk/proc/live/TestByteBuffer.java =================================================================== RCS file: /cvs/frysk/frysk-core/frysk/proc/live/TestByteBuffer.java,v retrieving revision 1.4 diff -u -r1.4 TestByteBuffer.java --- frysk-core/frysk/proc/live/TestByteBuffer.java 21 Sep 2007 16:30:53 -0000 1.4 +++ frysk-core/frysk/proc/live/TestByteBuffer.java 21 Oct 2007 04:57:42 -0000 @@ -83,8 +83,6 @@ // Cheat with the proc, it is not actually used if no // breakpoints are set (testing with breakpoints set is done through // TestTaskObserverCode in the various BreakpointMemoryView tests). - // LogicalMemory isn't writable atm, so we exclude it from those - // tests (the raw variant is of course). frysk.proc.Proc proc = new frysk.proc.dummy.Proc(); BreakpointAddresses breakpoints = new BreakpointAddresses(proc); memorySpaceByteBuffer = new LogicalMemoryBuffer(pid, @@ -179,8 +177,7 @@ public void testModifyAddressBuffers() { for (int i = 0; i < addressBuffers.length; i++) - if (! (addressBuffers[i] instanceof LogicalMemoryBuffer)) - verifyModify(addressBuffers[i], LocalMemory.getCodeAddr()); + verifyModify(addressBuffers[i], LocalMemory.getCodeAddr()); } private void verifyAsyncModify(ByteBuffer buffer, long addr) { @@ -236,9 +233,8 @@ public void testAsyncAddressBuffers() { for (int i = 0; i < addressBuffers.length; i++) - if (! (addressBuffers[i] instanceof LogicalMemoryBuffer)) - verifyAsyncModify(addressBuffers[i], - LocalMemory.getCodeAddr()); + verifyAsyncModify(addressBuffers[i], + LocalMemory.getCodeAddr()); } public void verifyPeeks(ByteBuffer buffer, long addr, byte[] origBytes) @@ -357,9 +353,8 @@ public void testBulkPutAddressBuffers() { for (int i = 0; i < addressBuffers.length; i++) - if (! (addressBuffers[i] instanceof LogicalMemoryBuffer)) - verifyBulkPut(addressBuffers[i], LocalMemory.getCodeAddr(), - LocalMemory.getCodeBytes().length); + verifyBulkPut(addressBuffers[i], LocalMemory.getCodeAddr(), + LocalMemory.getCodeBytes().length); } }