GP-5314: Destroy LiveMemoryHandler

This commit is contained in:
Dan 2025-02-18 18:23:30 +00:00
parent 7c74de60e6
commit bef0660e6a
32 changed files with 667 additions and 783 deletions

View file

@ -4,9 +4,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@ -225,16 +225,6 @@ public class DBTraceGuestPlatformMappedMemory implements Memory {
return guest.getLanguage().isBigEndian();
}
@Override
public void setLiveMemoryHandler(LiveMemoryHandler handler) {
throw new UnsupportedOperationException();
}
@Override
public LiveMemoryHandler getLiveMemoryHandler() {
return null;
}
@Override
public MemoryBlock createInitializedBlock(String name, Address start, InputStream is,
long length, TaskMonitor monitor, boolean overlay)

View file

@ -4,9 +4,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@ -47,8 +47,6 @@ public abstract class AbstractDBTraceProgramViewMemory
protected boolean forceFullView = false;
protected long snap;
protected LiveMemoryHandler memoryWriteRedirect;
private static final int CACHE_PAGE_COUNT = 3;
protected final ByteCache cache = new ByteCache(CACHE_PAGE_COUNT) {
@Override
@ -162,16 +160,6 @@ public abstract class AbstractDBTraceProgramViewMemory
return program.getLanguage().isBigEndian();
}
@Override
public void setLiveMemoryHandler(LiveMemoryHandler handler) {
this.memoryWriteRedirect = handler;
}
@Override
public LiveMemoryHandler getLiveMemoryHandler() {
return memoryWriteRedirect;
}
@Override
public MemoryBlock createInitializedBlock(String name, Address start, InputStream is,
long length, TaskMonitor monitor, boolean overlay)
@ -339,10 +327,6 @@ public abstract class AbstractDBTraceProgramViewMemory
@Override
public void setByte(Address addr, byte value) throws MemoryAccessException {
if (memoryWriteRedirect != null) {
memoryWriteRedirect.putByte(addr, value);
return;
}
DBTraceMemorySpace space = memoryManager.getMemorySpace(addr.getAddressSpace(), true);
if (space.putBytes(snap, addr, ByteBuffer.wrap(new byte[] { value })) != 1) {
throw new MemoryAccessException();
@ -352,10 +336,6 @@ public abstract class AbstractDBTraceProgramViewMemory
@Override
public void setBytes(Address addr, byte[] source, int sIndex, int size)
throws MemoryAccessException {
if (memoryWriteRedirect != null) {
memoryWriteRedirect.putBytes(addr, source, sIndex, size);
return;
}
DBTraceMemorySpace space = memoryManager.getMemorySpace(addr.getAddressSpace(), true);
if (space.putBytes(snap, addr, ByteBuffer.wrap(source, sIndex, size)) != size) {
throw new MemoryAccessException();

View file

@ -15,7 +15,6 @@
*/
package ghidra.trace.model.program;
import ghidra.program.model.mem.LiveMemoryHandler;
import ghidra.program.model.mem.Memory;
public interface TraceProgramViewMemory extends Memory, SnapSpecificTraceView {
@ -25,13 +24,4 @@ public interface TraceProgramViewMemory extends Memory, SnapSpecificTraceView {
void setForceFullView(boolean forceFullView);
boolean isForceFullView();
/**
* {@inheritDoc}
*
* <p>
* For trace views, this only redirects memory writes.
*/
@Override
void setLiveMemoryHandler(LiveMemoryHandler handler);
}