GP-0: memview mods

This commit is contained in:
d-millar
2025-03-11 16:40:01 -04:00
parent 73d29e3488
commit 7ed42228a0
2 changed files with 29 additions and 6 deletions

View File

@@ -15,17 +15,21 @@
*/
package ghidra.app.plugin.core.debug.gui.memview;
import java.awt.Color;
import java.util.*;
import ghidra.async.AsyncDebouncer;
import ghidra.async.AsyncTimer;
import ghidra.debug.api.tracemgr.DebuggerCoordinates;
import ghidra.framework.model.DomainObjectChangeRecord;
import ghidra.framework.model.DomainObjectEvent;
import ghidra.program.model.address.*;
import ghidra.trace.database.module.TraceObjectSection;
import ghidra.trace.model.*;
import ghidra.trace.model.breakpoint.*;
import ghidra.trace.model.memory.*;
import ghidra.trace.model.modules.*;
import ghidra.trace.model.stack.*;
import ghidra.trace.model.target.TraceObject;
import ghidra.trace.model.thread.*;
import ghidra.trace.util.TraceEvents;
@@ -79,6 +83,8 @@ public class DebuggerMemviewTraceListener extends TraceDomainObjectListener {
listenFor(TraceEvents.BREAKPOINT_DELETED, this::breakpointChanged);
listenFor(TraceEvents.BYTES_CHANGED, this::bytesChanged);
listenForUntyped(DomainObjectEvent.RESTORED, this::objectRestored);
}
public MemviewProvider getProvider() {
@@ -180,6 +186,14 @@ public class DebuggerMemviewTraceListener extends TraceDomainObjectListener {
updateLabelDebouncer.contact(null);
}
private void objectRestored(DomainObjectChangeRecord domainObjectChangeRecord) {
if (!trackTrace) {
return;
}
processTrace(currentTrace);
updateLabelDebouncer.contact(null);
}
private void doUpdate() {
provider.addBoxes(updateList);
}
@@ -208,6 +222,7 @@ public class DebuggerMemviewTraceListener extends TraceDomainObjectListener {
removeListener();
}
current = coordinates;
currentTrace = current.getTrace();
if (doListeners) {
addListener();
}
@@ -248,7 +263,7 @@ public class DebuggerMemviewTraceListener extends TraceDomainObjectListener {
private void processTrace(Trace trace) {
updateList.clear();
provider.reset();
//provider.reset();
if (!provider.isVisible()) {
return;
}

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.
@@ -42,16 +42,20 @@ public class MemoryBox {
protected int pixTstart;
protected int pixTend;
protected int boundT;
protected final Color color;
protected Color color;
protected boolean current;
public MemoryBox(String id, MemviewBoxType type, AddressRange range, long tick) {
public MemoryBox(String id, MemviewBoxType type, AddressRange range, long tick, Color color) {
this.id = id;
this.type = type;
this.range = range;
this.start = tick;
this.color = type.getColor();
this.color = color;
}
public MemoryBox(String id, MemviewBoxType type, AddressRange range, long tick) {
this(id, type, range, tick, type.getColor());
}
public MemoryBox(String id, MemviewBoxType type, AddressRange range, Lifespan trange) {
@@ -91,6 +95,10 @@ public class MemoryBox {
return color;
}
public void setColor(Color color) {
this.color = color;
}
public int getAddressPixelStart() {
return pixAstart;
}