mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2025-10-03 09:49:23 +02:00
GP-2076 domain object event refactor
This commit is contained in:
parent
daca354c47
commit
856aa904aa
143 changed files with 3621 additions and 3652 deletions
|
@ -43,7 +43,7 @@ import ghidra.debug.api.breakpoint.LogicalBreakpointsChangeListener;
|
|||
import ghidra.debug.api.control.ControlMode;
|
||||
import ghidra.debug.api.target.Target;
|
||||
import ghidra.debug.api.tracemgr.DebuggerCoordinates;
|
||||
import ghidra.framework.model.DomainObject;
|
||||
import ghidra.framework.model.DomainObjectEvent;
|
||||
import ghidra.framework.plugintool.*;
|
||||
import ghidra.framework.plugintool.annotation.AutoServiceConsumed;
|
||||
import ghidra.pcode.exec.SleighUtils;
|
||||
|
@ -300,8 +300,7 @@ public class DebuggerBreakpointsProvider extends ComponentProviderAdapter
|
|||
|
||||
@Override
|
||||
public boolean isEnabledForContext(ActionContext context) {
|
||||
return contextHasMatchingBreakpoints(context,
|
||||
row -> row.getState() != State.ENABLED,
|
||||
return contextHasMatchingBreakpoints(context, row -> row.getState() != State.ENABLED,
|
||||
row -> row.getState() != State.ENABLED);
|
||||
}
|
||||
|
||||
|
@ -380,8 +379,7 @@ public class DebuggerBreakpointsProvider extends ComponentProviderAdapter
|
|||
|
||||
@Override
|
||||
public boolean isEnabledForContext(ActionContext context) {
|
||||
return contextHasMatchingBreakpoints(context,
|
||||
row -> row.getState() != State.DISABLED,
|
||||
return contextHasMatchingBreakpoints(context, row -> row.getState() != State.DISABLED,
|
||||
row -> row.getState() != State.DISABLED);
|
||||
}
|
||||
|
||||
|
@ -546,8 +544,7 @@ public class DebuggerBreakpointsProvider extends ComponentProviderAdapter
|
|||
|
||||
static ActionBuilder builder(Plugin owner) {
|
||||
String ownerName = owner.getName();
|
||||
return new ActionBuilder(NAME, ownerName)
|
||||
.description(DESCRIPTION)
|
||||
return new ActionBuilder(NAME, ownerName).description(DESCRIPTION)
|
||||
.popupMenuPath(NAME)
|
||||
.popupMenuGroup(GROUP)
|
||||
.helpLocation(new HelpLocation(ownerName, HELP_ANCHOR));
|
||||
|
@ -562,8 +559,7 @@ public class DebuggerBreakpointsProvider extends ComponentProviderAdapter
|
|||
|
||||
static ActionBuilder builder(Plugin owner) {
|
||||
String ownerName = owner.getName();
|
||||
return new ActionBuilder(NAME, ownerName)
|
||||
.description(DESCRIPTION)
|
||||
return new ActionBuilder(NAME, ownerName).description(DESCRIPTION)
|
||||
.popupMenuPath(NAME)
|
||||
.popupMenuGroup(GROUP)
|
||||
.helpLocation(new HelpLocation(ownerName, HELP_ANCHOR));
|
||||
|
@ -605,7 +601,7 @@ public class DebuggerBreakpointsProvider extends ComponentProviderAdapter
|
|||
|
||||
public ForBreakpointLocationsTraceListener(Trace trace) {
|
||||
this.trace = trace;
|
||||
listenForUntyped(DomainObject.DO_OBJECT_RESTORED, e -> objectRestored());
|
||||
listenForUntyped(DomainObjectEvent.RESTORED, e -> objectRestored());
|
||||
listenFor(TraceBreakpointChangeType.ADDED, this::locationAdded);
|
||||
listenFor(TraceBreakpointChangeType.CHANGED, this::locationChanged);
|
||||
listenFor(TraceBreakpointChangeType.LIFESPAN_CHANGED, this::locationLifespanChanged);
|
||||
|
@ -865,9 +861,8 @@ public class DebuggerBreakpointsProvider extends ComponentProviderAdapter
|
|||
}
|
||||
|
||||
private void loadBreakpointLocations(Trace trace) {
|
||||
ControlMode mode = controlService == null
|
||||
? ControlMode.DEFAULT
|
||||
: controlService.getCurrentMode(trace);
|
||||
ControlMode mode =
|
||||
controlService == null ? ControlMode.DEFAULT : controlService.getCurrentMode(trace);
|
||||
DebuggerCoordinates currentFor = traceManager.getCurrentFor(trace);
|
||||
Target target = currentFor.getTarget();
|
||||
if (!mode.useEmulatedBreakpoints() && target == null) {
|
||||
|
@ -876,8 +871,8 @@ public class DebuggerBreakpointsProvider extends ComponentProviderAdapter
|
|||
Lifespan span = Lifespan.at(currentFor.getSnap());
|
||||
Collection<TraceBreakpoint> visible = new ArrayList<>();
|
||||
for (AddressRange range : trace.getBaseAddressFactory().getAddressSet()) {
|
||||
Collection<? extends TraceBreakpoint> breaks = trace.getBreakpointManager()
|
||||
.getBreakpointsIntersecting(span, range);
|
||||
Collection<? extends TraceBreakpoint> breaks =
|
||||
trace.getBreakpointManager().getBreakpointsIntersecting(span, range);
|
||||
if (mode.useEmulatedBreakpoints()) {
|
||||
visible.addAll(breaks);
|
||||
}
|
||||
|
@ -1039,21 +1034,19 @@ public class DebuggerBreakpointsProvider extends ComponentProviderAdapter
|
|||
});
|
||||
|
||||
TableColumnModel bptColModel = breakpointTable.getColumnModel();
|
||||
TableColumn bptEnCol =
|
||||
bptColModel.getColumn(LogicalBreakpointTableColumns.STATE.ordinal());
|
||||
TableColumn bptEnCol = bptColModel.getColumn(LogicalBreakpointTableColumns.STATE.ordinal());
|
||||
bptEnCol.setCellRenderer(new DebuggerBreakpointStateTableCellRenderer());
|
||||
bptEnCol.setCellEditor(
|
||||
new DebuggerBreakpointStateTableCellEditor<>(breakpointFilterPanel) {
|
||||
@Override
|
||||
protected State getToggledState(LogicalBreakpointRow row, State current) {
|
||||
boolean mapped = row.isMapped();
|
||||
if (!mapped) {
|
||||
tool.setStatusInfo(
|
||||
"Breakpoint has no locations. Only toggling its bookmark.", true);
|
||||
}
|
||||
return current.getToggled(mapped);
|
||||
bptEnCol.setCellEditor(new DebuggerBreakpointStateTableCellEditor<>(breakpointFilterPanel) {
|
||||
@Override
|
||||
protected State getToggledState(LogicalBreakpointRow row, State current) {
|
||||
boolean mapped = row.isMapped();
|
||||
if (!mapped) {
|
||||
tool.setStatusInfo("Breakpoint has no locations. Only toggling its bookmark.",
|
||||
true);
|
||||
}
|
||||
});
|
||||
return current.getToggled(mapped);
|
||||
}
|
||||
});
|
||||
bptEnCol.setMaxWidth(24);
|
||||
bptEnCol.setMinWidth(24);
|
||||
TableColumn bptNameCol =
|
||||
|
|
|
@ -34,7 +34,7 @@ import ghidra.app.plugin.core.debug.gui.DebuggerResources;
|
|||
import ghidra.app.plugin.core.debug.utils.DebouncedRowWrappedEnumeratedColumnTableModel;
|
||||
import ghidra.app.services.DebuggerListingService;
|
||||
import ghidra.debug.api.tracemgr.DebuggerCoordinates;
|
||||
import ghidra.framework.model.DomainObject;
|
||||
import ghidra.framework.model.DomainObjectEvent;
|
||||
import ghidra.framework.plugintool.AutoService;
|
||||
import ghidra.framework.plugintool.PluginTool;
|
||||
import ghidra.framework.plugintool.annotation.AutoServiceConsumed;
|
||||
|
@ -107,9 +107,8 @@ public class DebuggerLegacyRegionsPanel extends JPanel {
|
|||
}
|
||||
}
|
||||
|
||||
protected static class RegionTableModel
|
||||
extends DebouncedRowWrappedEnumeratedColumnTableModel< //
|
||||
RegionTableColumns, ObjectKey, RegionRow, TraceMemoryRegion> {
|
||||
protected static class RegionTableModel extends DebouncedRowWrappedEnumeratedColumnTableModel< //
|
||||
RegionTableColumns, ObjectKey, RegionRow, TraceMemoryRegion> {
|
||||
|
||||
public RegionTableModel(PluginTool tool) {
|
||||
super(tool, "Regions", RegionTableColumns.class, TraceMemoryRegion::getObjectKey,
|
||||
|
@ -142,7 +141,7 @@ public class DebuggerLegacyRegionsPanel extends JPanel {
|
|||
|
||||
private class RegionsListener extends TraceDomainObjectListener {
|
||||
public RegionsListener() {
|
||||
listenForUntyped(DomainObject.DO_OBJECT_RESTORED, e -> objectRestored());
|
||||
listenForUntyped(DomainObjectEvent.RESTORED, e -> objectRestored());
|
||||
|
||||
listenFor(TraceMemoryRegionChangeType.ADDED, this::regionAdded);
|
||||
listenFor(TraceMemoryRegionChangeType.CHANGED, this::regionChanged);
|
||||
|
|
|
@ -22,6 +22,7 @@ import java.util.stream.Stream;
|
|||
|
||||
import docking.widgets.table.RangeCursorTableHeaderRenderer.SeekListener;
|
||||
import docking.widgets.table.threaded.ThreadedTableModel;
|
||||
import ghidra.framework.model.DomainObjectEvent;
|
||||
import ghidra.framework.model.DomainObjectChangeRecord;
|
||||
import ghidra.framework.plugintool.Plugin;
|
||||
import ghidra.trace.model.*;
|
||||
|
@ -38,7 +39,7 @@ public abstract class AbstractQueryTableModel<T> extends ThreadedTableModel<T, T
|
|||
|
||||
protected class ListenerForChanges extends TraceDomainObjectListener {
|
||||
public ListenerForChanges() {
|
||||
listenForUntyped(Trace.DO_OBJECT_RESTORED, this::objectRestored);
|
||||
listenForUntyped(DomainObjectEvent.RESTORED, this::objectRestored);
|
||||
listenFor(TraceObjectChangeType.VALUE_CREATED, this::valueCreated);
|
||||
listenFor(TraceObjectChangeType.VALUE_DELETED, this::valueDeleted);
|
||||
listenFor(TraceObjectChangeType.VALUE_LIFESPAN_CHANGED, this::valueLifespanChanged);
|
||||
|
|
|
@ -39,7 +39,7 @@ public class ObjectTreeModel implements DisplaysModified {
|
|||
class ListenerForChanges extends TraceDomainObjectListener
|
||||
implements DomainObjectClosedListener {
|
||||
public ListenerForChanges() {
|
||||
listenForUntyped(DomainObject.DO_OBJECT_RESTORED, this::domainObjectRestored);
|
||||
listenForUntyped(DomainObjectEvent.RESTORED, this::domainObjectRestored);
|
||||
listenFor(TraceObjectChangeType.CREATED, this::objectCreated);
|
||||
listenFor(TraceObjectChangeType.VALUE_CREATED, this::valueCreated);
|
||||
listenFor(TraceObjectChangeType.VALUE_DELETED, this::valueDeleted);
|
||||
|
|
|
@ -32,7 +32,7 @@ import docking.widgets.table.DefaultEnumeratedColumnTableModel.EnumeratedTableCo
|
|||
import ghidra.app.plugin.core.debug.gui.DebuggerResources;
|
||||
import ghidra.app.plugin.core.debug.utils.DebouncedRowWrappedEnumeratedColumnTableModel;
|
||||
import ghidra.debug.api.tracemgr.DebuggerCoordinates;
|
||||
import ghidra.framework.model.DomainObject;
|
||||
import ghidra.framework.model.DomainObjectEvent;
|
||||
import ghidra.framework.plugintool.PluginTool;
|
||||
import ghidra.program.model.address.*;
|
||||
import ghidra.trace.model.*;
|
||||
|
@ -141,9 +141,8 @@ public class DebuggerLegacyModulesPanel extends JPanel {
|
|||
}
|
||||
}
|
||||
|
||||
protected static class ModuleTableModel
|
||||
extends DebouncedRowWrappedEnumeratedColumnTableModel< //
|
||||
ModuleTableColumns, ObjectKey, ModuleRow, TraceModule> {
|
||||
protected static class ModuleTableModel extends DebouncedRowWrappedEnumeratedColumnTableModel< //
|
||||
ModuleTableColumns, ObjectKey, ModuleRow, TraceModule> {
|
||||
|
||||
public ModuleTableModel(PluginTool tool, DebuggerModulesProvider provider) {
|
||||
super(tool, "Modules", ModuleTableColumns.class, TraceModule::getObjectKey,
|
||||
|
@ -158,7 +157,7 @@ public class DebuggerLegacyModulesPanel extends JPanel {
|
|||
|
||||
private class ModulesListener extends TraceDomainObjectListener {
|
||||
public ModulesListener() {
|
||||
listenForUntyped(DomainObject.DO_OBJECT_RESTORED, e -> objectRestored());
|
||||
listenForUntyped(DomainObjectEvent.RESTORED, e -> objectRestored());
|
||||
|
||||
listenFor(TraceModuleChangeType.ADDED, this::moduleAdded);
|
||||
listenFor(TraceModuleChangeType.CHANGED, this::moduleChanged);
|
||||
|
|
|
@ -33,7 +33,7 @@ import docking.widgets.table.TableFilter;
|
|||
import ghidra.app.plugin.core.debug.gui.DebuggerResources;
|
||||
import ghidra.app.plugin.core.debug.utils.DebouncedRowWrappedEnumeratedColumnTableModel;
|
||||
import ghidra.debug.api.tracemgr.DebuggerCoordinates;
|
||||
import ghidra.framework.model.DomainObject;
|
||||
import ghidra.framework.model.DomainObjectEvent;
|
||||
import ghidra.framework.plugintool.PluginTool;
|
||||
import ghidra.program.model.address.*;
|
||||
import ghidra.trace.model.Trace;
|
||||
|
@ -124,9 +124,8 @@ public class DebuggerLegacySectionsPanel extends JPanel {
|
|||
}
|
||||
}
|
||||
|
||||
protected static class SectionTableModel
|
||||
extends DebouncedRowWrappedEnumeratedColumnTableModel< //
|
||||
SectionTableColumns, ObjectKey, SectionRow, TraceSection> {
|
||||
protected static class SectionTableModel extends DebouncedRowWrappedEnumeratedColumnTableModel< //
|
||||
SectionTableColumns, ObjectKey, SectionRow, TraceSection> {
|
||||
|
||||
public SectionTableModel(PluginTool tool) {
|
||||
super(tool, "Sections", SectionTableColumns.class, TraceSection::getObjectKey,
|
||||
|
@ -141,7 +140,7 @@ public class DebuggerLegacySectionsPanel extends JPanel {
|
|||
|
||||
private class SectionsListener extends TraceDomainObjectListener {
|
||||
public SectionsListener() {
|
||||
listenForUntyped(DomainObject.DO_OBJECT_RESTORED, e -> objectRestored());
|
||||
listenForUntyped(DomainObjectEvent.RESTORED, e -> objectRestored());
|
||||
|
||||
/**
|
||||
* NOTE: No need for Module.ADDED here. A TraceModule is created empty, so when each
|
||||
|
|
|
@ -40,7 +40,7 @@ import ghidra.app.plugin.core.debug.gui.DebuggerResources;
|
|||
import ghidra.app.plugin.core.debug.gui.DebuggerResources.*;
|
||||
import ghidra.app.plugin.core.debug.utils.DebouncedRowWrappedEnumeratedColumnTableModel;
|
||||
import ghidra.app.services.*;
|
||||
import ghidra.framework.model.DomainObject;
|
||||
import ghidra.framework.model.DomainObjectEvent;
|
||||
import ghidra.framework.plugintool.*;
|
||||
import ghidra.framework.plugintool.annotation.AutoServiceConsumed;
|
||||
import ghidra.program.model.address.*;
|
||||
|
@ -94,9 +94,8 @@ public class DebuggerStaticMappingProvider extends ComponentProviderAdapter
|
|||
}
|
||||
}
|
||||
|
||||
protected static class MappingTableModel
|
||||
extends DebouncedRowWrappedEnumeratedColumnTableModel< //
|
||||
StaticMappingTableColumns, ObjectKey, StaticMappingRow, TraceStaticMapping> {
|
||||
protected static class MappingTableModel extends DebouncedRowWrappedEnumeratedColumnTableModel< //
|
||||
StaticMappingTableColumns, ObjectKey, StaticMappingRow, TraceStaticMapping> {
|
||||
|
||||
public MappingTableModel(PluginTool tool) {
|
||||
super(tool, "Mappings", StaticMappingTableColumns.class,
|
||||
|
@ -107,7 +106,7 @@ public class DebuggerStaticMappingProvider extends ComponentProviderAdapter
|
|||
|
||||
protected class ListenerForStaticMappingDisplay extends TraceDomainObjectListener {
|
||||
public ListenerForStaticMappingDisplay() {
|
||||
listenForUntyped(DomainObject.DO_OBJECT_RESTORED, e -> objectRestored());
|
||||
listenForUntyped(DomainObjectEvent.RESTORED, e -> objectRestored());
|
||||
listenFor(TraceStaticMappingChangeType.ADDED, this::staticMappingAdded);
|
||||
listenFor(TraceStaticMappingChangeType.DELETED, this::staticMappingDeleted);
|
||||
}
|
||||
|
|
|
@ -52,7 +52,7 @@ import ghidra.dbg.error.DebuggerModelAccessException;
|
|||
import ghidra.debug.api.target.Target;
|
||||
import ghidra.debug.api.tracemgr.DebuggerCoordinates;
|
||||
import ghidra.docking.settings.*;
|
||||
import ghidra.framework.model.DomainObject;
|
||||
import ghidra.framework.model.DomainObjectEvent;
|
||||
import ghidra.framework.model.DomainObjectChangeRecord;
|
||||
import ghidra.framework.options.AutoOptions;
|
||||
import ghidra.framework.options.SaveState;
|
||||
|
@ -104,8 +104,7 @@ public class DebuggerRegistersProvider extends ComponentProviderAdapter
|
|||
|
||||
static ActionBuilder builder(Plugin owner) {
|
||||
String ownerName = owner.getName();
|
||||
return new ActionBuilder(NAME, ownerName)
|
||||
.description(DESCRIPTION);
|
||||
return new ActionBuilder(NAME, ownerName).description(DESCRIPTION);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -116,8 +115,7 @@ public class DebuggerRegistersProvider extends ComponentProviderAdapter
|
|||
|
||||
static ActionBuilder builder(Plugin owner) {
|
||||
String ownerName = owner.getName();
|
||||
return new ActionBuilder(NAME, ownerName)
|
||||
.description(DESCRIPTION)
|
||||
return new ActionBuilder(NAME, ownerName).description(DESCRIPTION)
|
||||
.popupMenuPath(NAME)
|
||||
.helpLocation(new HelpLocation(ownerName, HELP_ANCHOR));
|
||||
}
|
||||
|
@ -152,9 +150,8 @@ public class DebuggerRegistersProvider extends ComponentProviderAdapter
|
|||
RegisterRow::isValueEditable, SortDirection.ASCENDING) {
|
||||
private static final RegisterValueCellRenderer RENDERER =
|
||||
new RegisterValueCellRenderer();
|
||||
private static final SettingsDefinition[] DEFS = new SettingsDefinition[] {
|
||||
FormatSettingsDefinition.DEF_HEX,
|
||||
};
|
||||
private static final SettingsDefinition[] DEFS =
|
||||
new SettingsDefinition[] { FormatSettingsDefinition.DEF_HEX, };
|
||||
|
||||
@Override
|
||||
public GColumnRenderer<BigInteger> getRenderer() {
|
||||
|
@ -186,9 +183,8 @@ public class DebuggerRegistersProvider extends ComponentProviderAdapter
|
|||
|
||||
@SuppressWarnings("unchecked")
|
||||
<T> RegisterTableColumns(String header, int width, Class<T> cls,
|
||||
Function<RegisterRow, T> getter,
|
||||
BiConsumer<RegisterRow, T> setter, Predicate<RegisterRow> editable,
|
||||
SortDirection direction) {
|
||||
Function<RegisterRow, T> getter, BiConsumer<RegisterRow, T> setter,
|
||||
Predicate<RegisterRow> editable, SortDirection direction) {
|
||||
this.header = header;
|
||||
this.width = width;
|
||||
this.cls = cls;
|
||||
|
@ -277,7 +273,7 @@ public class DebuggerRegistersProvider extends ComponentProviderAdapter
|
|||
|
||||
class TraceChangeListener extends TraceDomainObjectListener {
|
||||
public TraceChangeListener() {
|
||||
listenForUntyped(DomainObject.DO_OBJECT_RESTORED, e -> objectRestored(e));
|
||||
listenForUntyped(DomainObjectEvent.RESTORED, e -> objectRestored(e));
|
||||
listenFor(TraceMemoryBytesChangeType.CHANGED, this::registerValueChanged);
|
||||
listenFor(TraceMemoryStateChangeType.CHANGED, this::registerStateChanged);
|
||||
listenFor(TraceCodeChangeType.ADDED, this::registerTypeAdded);
|
||||
|
@ -899,8 +895,7 @@ public class DebuggerRegistersProvider extends ComponentProviderAdapter
|
|||
getRegisterMemorySpace(register.getAddressSpace(), true).getCodeSpace(true);
|
||||
long snap = current.getViewSnap();
|
||||
TracePlatform platform = current.getPlatform();
|
||||
code.definedUnits()
|
||||
.clear(platform, Lifespan.at(snap), register, TaskMonitor.DUMMY);
|
||||
code.definedUnits().clear(platform, Lifespan.at(snap), register, TaskMonitor.DUMMY);
|
||||
if (dataType != null) {
|
||||
code.definedData().create(platform, Lifespan.nowOn(snap), register, dataType);
|
||||
}
|
||||
|
@ -936,8 +931,8 @@ public class DebuggerRegistersProvider extends ComponentProviderAdapter
|
|||
return;
|
||||
}
|
||||
try {
|
||||
RegisterValue rv = TraceRegisterUtils.encodeValueRepresentationHackPointer(
|
||||
register, data, representation);
|
||||
RegisterValue rv = TraceRegisterUtils.encodeValueRepresentationHackPointer(register,
|
||||
data, representation);
|
||||
writeRegisterValue(rv);
|
||||
}
|
||||
catch (DataTypeEncodeException e) {
|
||||
|
@ -1109,9 +1104,7 @@ public class DebuggerRegistersProvider extends ComponentProviderAdapter
|
|||
protected static TraceMemorySpace getRegisterMemorySpace(DebuggerCoordinates coords,
|
||||
AddressSpace space, boolean createIfAbsent) {
|
||||
if (!space.isRegisterSpace()) {
|
||||
return coords.getTrace()
|
||||
.getMemoryManager()
|
||||
.getMemorySpace(space, createIfAbsent);
|
||||
return coords.getTrace().getMemoryManager().getMemorySpace(space, createIfAbsent);
|
||||
}
|
||||
TraceThread thread = coords.getThread();
|
||||
if (thread == null) {
|
||||
|
@ -1122,17 +1115,14 @@ public class DebuggerRegistersProvider extends ComponentProviderAdapter
|
|||
.getMemoryRegisterSpace(thread, coords.getFrame(), createIfAbsent);
|
||||
}
|
||||
|
||||
protected TraceMemorySpace getRegisterMemorySpace(AddressSpace space,
|
||||
boolean createIfAbsent) {
|
||||
protected TraceMemorySpace getRegisterMemorySpace(AddressSpace space, boolean createIfAbsent) {
|
||||
return getRegisterMemorySpace(current, space, createIfAbsent);
|
||||
}
|
||||
|
||||
protected static TraceCodeSpace getRegisterCodeSpace(DebuggerCoordinates coords,
|
||||
AddressSpace space, boolean createIfAbsent) {
|
||||
if (!space.isRegisterSpace()) {
|
||||
return coords.getTrace()
|
||||
.getCodeManager()
|
||||
.getCodeSpace(space, createIfAbsent);
|
||||
return coords.getTrace().getCodeManager().getCodeSpace(space, createIfAbsent);
|
||||
}
|
||||
TraceThread thread = coords.getThread();
|
||||
if (thread == null) {
|
||||
|
|
|
@ -33,7 +33,7 @@ import ghidra.app.plugin.core.debug.gui.DebuggerSnapActionContext;
|
|||
import ghidra.app.services.DebuggerTraceManagerService;
|
||||
import ghidra.debug.api.tracemgr.DebuggerCoordinates;
|
||||
import ghidra.docking.settings.Settings;
|
||||
import ghidra.framework.model.DomainObject;
|
||||
import ghidra.framework.model.DomainObjectEvent;
|
||||
import ghidra.framework.model.DomainObjectChangeRecord;
|
||||
import ghidra.framework.plugintool.AutoService;
|
||||
import ghidra.framework.plugintool.annotation.AutoServiceConsumed;
|
||||
|
@ -120,14 +120,13 @@ public class DebuggerLegacyThreadsPanel extends JPanel {
|
|||
|
||||
public ThreadTableModel(DebuggerThreadsProvider provider) {
|
||||
super(provider.getTool(), "Threads", ThreadTableColumns.class,
|
||||
TraceThread::getObjectKey, t -> new ThreadRow(provider, t),
|
||||
ThreadRow::getThread);
|
||||
TraceThread::getObjectKey, t -> new ThreadRow(provider, t), ThreadRow::getThread);
|
||||
}
|
||||
}
|
||||
|
||||
private class ForThreadsListener extends TraceDomainObjectListener {
|
||||
public ForThreadsListener() {
|
||||
listenForUntyped(DomainObject.DO_OBJECT_RESTORED, this::objectRestored);
|
||||
listenForUntyped(DomainObjectEvent.RESTORED, this::objectRestored);
|
||||
|
||||
listenFor(TraceThreadChangeType.ADDED, this::threadAdded);
|
||||
listenFor(TraceThreadChangeType.CHANGED, this::threadChanged);
|
||||
|
|
|
@ -33,7 +33,7 @@ import ghidra.app.plugin.core.debug.gui.DebuggerResources.ToToggleSelectionListe
|
|||
import ghidra.app.services.*;
|
||||
import ghidra.app.services.DebuggerTraceManagerService.BooleanChangeAdapter;
|
||||
import ghidra.debug.api.tracemgr.DebuggerCoordinates;
|
||||
import ghidra.framework.model.DomainObject;
|
||||
import ghidra.framework.model.DomainObjectEvent;
|
||||
import ghidra.framework.model.DomainObjectChangeRecord;
|
||||
import ghidra.framework.plugintool.AutoService;
|
||||
import ghidra.framework.plugintool.ComponentProviderAdapter;
|
||||
|
@ -65,7 +65,7 @@ public class DebuggerThreadsProvider extends ComponentProviderAdapter {
|
|||
private Trace currentTrace;
|
||||
|
||||
public ForSnapsListener() {
|
||||
listenForUntyped(DomainObject.DO_OBJECT_RESTORED, this::objectRestored);
|
||||
listenForUntyped(DomainObjectEvent.RESTORED, this::objectRestored);
|
||||
|
||||
listenFor(TraceSnapshotChangeType.ADDED, this::snapAdded);
|
||||
listenFor(TraceSnapshotChangeType.DELETED, this::snapDeleted);
|
||||
|
@ -210,7 +210,7 @@ public class DebuggerThreadsProvider extends ComponentProviderAdapter {
|
|||
void threadsPanelContextChanged() {
|
||||
myActionContext = panel.getActionContext();
|
||||
}
|
||||
|
||||
|
||||
void legacyThreadsPanelContextChanged() {
|
||||
myActionContext = legacyPanel.getActionContext();
|
||||
}
|
||||
|
@ -247,8 +247,8 @@ public class DebuggerThreadsProvider extends ComponentProviderAdapter {
|
|||
.enabledWhen(c -> traceManager != null)
|
||||
.onAction(c -> toggleSyncFocus(actionSyncTarget.isSelected()))
|
||||
.buildAndInstallLocal(this);
|
||||
traceManager.addSynchronizeActiveChangeListener(toToggleSelectionListener =
|
||||
new ToToggleSelectionListener(actionSyncTarget));
|
||||
traceManager.addSynchronizeActiveChangeListener(
|
||||
toToggleSelectionListener = new ToToggleSelectionListener(actionSyncTarget));
|
||||
}
|
||||
|
||||
private void changedSynchronizeTarget(boolean value) {
|
||||
|
|
|
@ -28,7 +28,7 @@ import javax.swing.table.*;
|
|||
import docking.widgets.table.*;
|
||||
import docking.widgets.table.DefaultEnumeratedColumnTableModel.EnumeratedTableColumn;
|
||||
import ghidra.docking.settings.Settings;
|
||||
import ghidra.framework.model.DomainObject;
|
||||
import ghidra.framework.model.DomainObjectEvent;
|
||||
import ghidra.framework.plugintool.PluginTool;
|
||||
import ghidra.trace.model.Trace;
|
||||
import ghidra.trace.model.Trace.TraceSnapshotChangeType;
|
||||
|
@ -94,7 +94,7 @@ public class DebuggerSnapshotTablePanel extends JPanel {
|
|||
|
||||
private class SnapshotListener extends TraceDomainObjectListener {
|
||||
public SnapshotListener() {
|
||||
listenForUntyped(DomainObject.DO_OBJECT_RESTORED, e -> objectRestored());
|
||||
listenForUntyped(DomainObjectEvent.RESTORED, e -> objectRestored());
|
||||
|
||||
listenFor(TraceSnapshotChangeType.ADDED, this::snapAdded);
|
||||
listenFor(TraceSnapshotChangeType.CHANGED, this::snapChanged);
|
||||
|
@ -234,9 +234,9 @@ public class DebuggerSnapshotTablePanel extends JPanel {
|
|||
return;
|
||||
}
|
||||
TraceTimeManager manager = currentTrace.getTimeManager();
|
||||
Collection<? extends TraceSnapshot> snapshots = hideScratch
|
||||
? manager.getSnapshots(0, true, Long.MAX_VALUE, true)
|
||||
: manager.getAllSnapshots();
|
||||
Collection<? extends TraceSnapshot> snapshots =
|
||||
hideScratch ? manager.getSnapshots(0, true, Long.MAX_VALUE, true)
|
||||
: manager.getAllSnapshots();
|
||||
snapshotTableModel
|
||||
.addAll(snapshots.stream().map(s -> new SnapshotRow(currentTrace, s)).toList());
|
||||
}
|
||||
|
|
|
@ -56,7 +56,7 @@ import ghidra.base.widgets.table.DataTypeTableCellEditor;
|
|||
import ghidra.debug.api.tracemgr.DebuggerCoordinates;
|
||||
import ghidra.debug.api.watch.WatchRow;
|
||||
import ghidra.docking.settings.*;
|
||||
import ghidra.framework.model.DomainObject;
|
||||
import ghidra.framework.model.DomainObjectEvent;
|
||||
import ghidra.framework.model.DomainObjectChangeRecord;
|
||||
import ghidra.framework.options.SaveState;
|
||||
import ghidra.framework.plugintool.*;
|
||||
|
@ -109,8 +109,7 @@ public class DebuggerWatchesProvider extends ComponentProviderAdapter
|
|||
|
||||
static ActionBuilder builder(Plugin owner) {
|
||||
String ownerName = owner.getName();
|
||||
return new ActionBuilder(NAME, ownerName)
|
||||
.description(DESCRIPTION)
|
||||
return new ActionBuilder(NAME, ownerName).description(DESCRIPTION)
|
||||
.popupMenuPath(NAME)
|
||||
.helpLocation(new HelpLocation(ownerName, HELP_ANCHOR));
|
||||
}
|
||||
|
@ -247,7 +246,7 @@ public class DebuggerWatchesProvider extends ComponentProviderAdapter
|
|||
|
||||
class ForDepsListener extends TraceDomainObjectListener {
|
||||
public ForDepsListener() {
|
||||
listenForUntyped(DomainObject.DO_OBJECT_RESTORED, this::objectRestored);
|
||||
listenForUntyped(DomainObjectEvent.RESTORED, this::objectRestored);
|
||||
listenFor(TraceMemoryBytesChangeType.CHANGED, this::bytesChanged);
|
||||
listenFor(TraceMemoryStateChangeType.CHANGED, this::stateChanged);
|
||||
}
|
||||
|
@ -459,8 +458,8 @@ public class DebuggerWatchesProvider extends ComponentProviderAdapter
|
|||
int modelCol = watchTable.convertColumnIndexToModel(watchTable.getSelectedColumn());
|
||||
Throwable error = row.getError(); // I don't care the selected column for errors
|
||||
if (error != null) {
|
||||
Msg.showError(this, getComponent(), "Evaluation error",
|
||||
"Could not evaluate watch", error);
|
||||
Msg.showError(this, getComponent(), "Evaluation error", "Could not evaluate watch",
|
||||
error);
|
||||
}
|
||||
else if (modelCol == WatchTableColumns.ADDRESS.ordinal()) {
|
||||
Address address = row.getAddress();
|
||||
|
@ -509,9 +508,8 @@ public class DebuggerWatchesProvider extends ComponentProviderAdapter
|
|||
selHasMemoryReads(ctx))
|
||||
.onAction(this::activatedSelectReads)
|
||||
.buildAndInstallLocal(this);
|
||||
actionAdd = AddAction.builder(plugin)
|
||||
.onAction(this::activatedAdd)
|
||||
.buildAndInstallLocal(this);
|
||||
actionAdd =
|
||||
AddAction.builder(plugin).onAction(this::activatedAdd).buildAndInstallLocal(this);
|
||||
actionRemove = RemoveAction.builder(plugin)
|
||||
.withContext(DebuggerWatchActionContext.class)
|
||||
.enabledWhen(ctx -> !ctx.getWatchRows().isEmpty())
|
||||
|
@ -609,8 +607,7 @@ public class DebuggerWatchesProvider extends ComponentProviderAdapter
|
|||
return;
|
||||
}
|
||||
}
|
||||
try (Transaction tx =
|
||||
current.getTrace().openTransaction("Apply Watch Data Type")) {
|
||||
try (Transaction tx = current.getTrace().openTransaction("Apply Watch Data Type")) {
|
||||
try {
|
||||
listing.clearCodeUnits(row.getAddress(), row.getRange().getMaxAddress(), false);
|
||||
Data data = listing.createData(address, dataType, size);
|
||||
|
|
|
@ -58,26 +58,17 @@ import ghidra.util.Msg;
|
|||
import ghidra.util.datastruct.ListenerSet;
|
||||
|
||||
@PluginInfo(
|
||||
shortDescription = "Debugger logical breakpoints service plugin",
|
||||
description = "Aggregates breakpoints from open programs and live traces",
|
||||
category = PluginCategoryNames.DEBUGGER,
|
||||
packageName = DebuggerPluginPackage.NAME,
|
||||
status = PluginStatus.RELEASED,
|
||||
eventsConsumed = {
|
||||
ProgramOpenedPluginEvent.class,
|
||||
ProgramClosedPluginEvent.class,
|
||||
TraceOpenedPluginEvent.class,
|
||||
TraceActivatedPluginEvent.class,
|
||||
TraceInactiveCoordinatesPluginEvent.class,
|
||||
TraceClosedPluginEvent.class,
|
||||
},
|
||||
servicesRequired = {
|
||||
DebuggerTraceManagerService.class,
|
||||
DebuggerStaticMappingService.class,
|
||||
},
|
||||
servicesProvided = {
|
||||
DebuggerLogicalBreakpointService.class,
|
||||
})
|
||||
shortDescription = "Debugger logical breakpoints service plugin",
|
||||
description = "Aggregates breakpoints from open programs and live traces",
|
||||
category = PluginCategoryNames.DEBUGGER,
|
||||
packageName = DebuggerPluginPackage.NAME,
|
||||
status = PluginStatus.RELEASED,
|
||||
eventsConsumed = { ProgramOpenedPluginEvent.class, ProgramClosedPluginEvent.class,
|
||||
TraceOpenedPluginEvent.class, TraceActivatedPluginEvent.class,
|
||||
TraceInactiveCoordinatesPluginEvent.class, TraceClosedPluginEvent.class, },
|
||||
servicesRequired = { DebuggerTraceManagerService.class,
|
||||
DebuggerStaticMappingService.class, },
|
||||
servicesProvided = { DebuggerLogicalBreakpointService.class, })
|
||||
public class DebuggerLogicalBreakpointServicePlugin extends Plugin
|
||||
implements DebuggerLogicalBreakpointService {
|
||||
|
||||
|
@ -206,7 +197,7 @@ public class DebuggerLogicalBreakpointServicePlugin extends Plugin
|
|||
// (Same in break provider for locations)
|
||||
this.info = info;
|
||||
|
||||
listenForUntyped(DomainObject.DO_OBJECT_RESTORED, e -> objectRestored());
|
||||
listenForUntyped(DomainObjectEvent.RESTORED, e -> objectRestored());
|
||||
listenFor(TraceBreakpointChangeType.ADDED, this::breakpointAdded);
|
||||
listenFor(TraceBreakpointChangeType.CHANGED, this::breakpointChanged);
|
||||
listenFor(TraceBreakpointChangeType.LIFESPAN_CHANGED, this::breakpointLifespanChanged);
|
||||
|
@ -254,13 +245,12 @@ public class DebuggerLogicalBreakpointServicePlugin extends Plugin
|
|||
}
|
||||
catch (NoSuchElementException e) {
|
||||
// TODO: This catch clause should not be necessary.
|
||||
Msg.error(this,
|
||||
"!!!! Object-based breakpoint emitted event without a spec: " + tb);
|
||||
Msg.error(this, "!!!! Object-based breakpoint emitted event without a spec: " + tb);
|
||||
}
|
||||
}
|
||||
|
||||
private void breakpointLifespanChanged(TraceAddressSpace spaceIsNull,
|
||||
TraceBreakpoint tb, Lifespan oldSpan, Lifespan newSpan) {
|
||||
private void breakpointLifespanChanged(TraceAddressSpace spaceIsNull, TraceBreakpoint tb,
|
||||
Lifespan oldSpan, Lifespan newSpan) {
|
||||
// NOTE: User/script probably modified historical breakpoint
|
||||
boolean isInOld = oldSpan.contains(info.snap);
|
||||
boolean isInNew = newSpan.contains(info.snap);
|
||||
|
@ -294,12 +284,12 @@ public class DebuggerLogicalBreakpointServicePlugin extends Plugin
|
|||
public ProgramBreakpointsListener(InfoPerProgram info) {
|
||||
this.info = info;
|
||||
|
||||
listenForUntyped(DomainObject.DO_OBJECT_RESTORED, e -> objectRestored());
|
||||
listenForUntyped(ChangeManager.DOCR_BOOKMARK_ADDED,
|
||||
listenForUntyped(DomainObjectEvent.RESTORED, e -> objectRestored());
|
||||
listenForUntyped(ProgramEvent.BOOKMARK_ADDED,
|
||||
onBreakpoint(this::breakpointBookmarkAdded));
|
||||
listenForUntyped(ChangeManager.DOCR_BOOKMARK_CHANGED,
|
||||
listenForUntyped(ProgramEvent.BOOKMARK_CHANGED,
|
||||
onBreakpoint(this::breakpointBookmarkChanged));
|
||||
listenForUntyped(ChangeManager.DOCR_BOOKMARK_REMOVED,
|
||||
listenForUntyped(ProgramEvent.BOOKMARK_REMOVED,
|
||||
onBreakpoint(this::breakpointBookmarkDeleted));
|
||||
}
|
||||
|
||||
|
@ -504,9 +494,8 @@ public class DebuggerLogicalBreakpointServicePlugin extends Plugin
|
|||
protected void forgetAllBreakpoints(RemoveCollector r) {
|
||||
Collection<TraceBreakpoint> toForget = new ArrayList<>();
|
||||
for (AddressRange range : trace.getBaseAddressFactory().getAddressSet()) {
|
||||
toForget.addAll(trace
|
||||
.getBreakpointManager()
|
||||
.getBreakpointsIntersecting(Lifespan.ALL, range));
|
||||
toForget.addAll(
|
||||
trace.getBreakpointManager().getBreakpointsIntersecting(Lifespan.ALL, range));
|
||||
}
|
||||
for (TraceBreakpoint tb : toForget) {
|
||||
forgetTraceBreakpoint(r, tb);
|
||||
|
@ -520,8 +509,7 @@ public class DebuggerLogicalBreakpointServicePlugin extends Plugin
|
|||
* has changed or become invalid, or because it has no live breakpoint in target mode.
|
||||
*/
|
||||
ControlMode mode = getMode(trace);
|
||||
for (Set<LogicalBreakpointInternal> set : List
|
||||
.copyOf(breakpointsByAddress.values())) {
|
||||
for (Set<LogicalBreakpointInternal> set : List.copyOf(breakpointsByAddress.values())) {
|
||||
for (LogicalBreakpointInternal lb : Set.copyOf(set)) {
|
||||
for (TraceBreakpoint tb : Set.copyOf(lb.getTraceBreakpoints(trace))) {
|
||||
if (!mode.useEmulatedBreakpoints() &&
|
||||
|
@ -576,8 +564,7 @@ public class DebuggerLogicalBreakpointServicePlugin extends Plugin
|
|||
}
|
||||
|
||||
protected ProgramLocation computeStaticLocation(TraceBreakpoint tb) {
|
||||
if (traceManager == null ||
|
||||
!traceManager.getOpenTraces().contains(tb.getTrace())) {
|
||||
if (traceManager == null || !traceManager.getOpenTraces().contains(tb.getTrace())) {
|
||||
/**
|
||||
* Mapping service will throw an exception otherwise. NB: When trace is opened,
|
||||
* mapping service will fire events causing this service to coalesce affected
|
||||
|
@ -593,9 +580,8 @@ public class DebuggerLogicalBreakpointServicePlugin extends Plugin
|
|||
new DefaultTraceLocation(trace, null, Lifespan.at(snap), minAddress));
|
||||
}
|
||||
|
||||
protected void trackTraceBreakpoint(AddCollector a, TraceBreakpoint tb,
|
||||
ControlMode mode, boolean forceUpdate)
|
||||
throws TrackedTooSoonException {
|
||||
protected void trackTraceBreakpoint(AddCollector a, TraceBreakpoint tb, ControlMode mode,
|
||||
boolean forceUpdate) throws TrackedTooSoonException {
|
||||
if (!mode.useEmulatedBreakpoints() &&
|
||||
(target == null || !target.isBreakpointValid(tb))) {
|
||||
return;
|
||||
|
@ -681,9 +667,8 @@ public class DebuggerLogicalBreakpointServicePlugin extends Plugin
|
|||
}
|
||||
}
|
||||
|
||||
LogicalBreakpointInternal lb =
|
||||
createLogicalBreakpoint(address, ProgramBreakpoint.lengthFromBookmark(pb),
|
||||
ProgramBreakpoint.kindsFromBookmark(pb));
|
||||
LogicalBreakpointInternal lb = createLogicalBreakpoint(address,
|
||||
ProgramBreakpoint.lengthFromBookmark(pb), ProgramBreakpoint.kindsFromBookmark(pb));
|
||||
set.add(lb);
|
||||
a.added(lb);
|
||||
return lb;
|
||||
|
@ -747,8 +732,7 @@ public class DebuggerLogicalBreakpointServicePlugin extends Plugin
|
|||
* NOTE: A change in the program (other than bookmark address), should not affect the
|
||||
* mapped trace addresses. That would require a change in the trace.
|
||||
*/
|
||||
for (Set<LogicalBreakpointInternal> set : List
|
||||
.copyOf(breakpointsByAddress.values())) {
|
||||
for (Set<LogicalBreakpointInternal> set : List.copyOf(breakpointsByAddress.values())) {
|
||||
for (LogicalBreakpointInternal lb : Set.copyOf(set)) {
|
||||
Bookmark pb = lb.getProgramBookmark();
|
||||
if (pb == null) {
|
||||
|
@ -768,10 +752,10 @@ public class DebuggerLogicalBreakpointServicePlugin extends Plugin
|
|||
|
||||
protected void trackAllProgramBreakpoints(AddCollector a) {
|
||||
BookmarkManager bookmarks = program.getBookmarkManager();
|
||||
trackProgramBreakpoints(a, IteratorUtils.asIterable(bookmarks
|
||||
.getBookmarksIterator(LogicalBreakpoint.ENABLED_BOOKMARK_TYPE)));
|
||||
trackProgramBreakpoints(a, IteratorUtils.asIterable(bookmarks
|
||||
.getBookmarksIterator(LogicalBreakpoint.DISABLED_BOOKMARK_TYPE)));
|
||||
trackProgramBreakpoints(a, IteratorUtils.asIterable(
|
||||
bookmarks.getBookmarksIterator(LogicalBreakpoint.ENABLED_BOOKMARK_TYPE)));
|
||||
trackProgramBreakpoints(a, IteratorUtils.asIterable(
|
||||
bookmarks.getBookmarksIterator(LogicalBreakpoint.DISABLED_BOOKMARK_TYPE)));
|
||||
}
|
||||
|
||||
protected void trackProgramBreakpoints(AddCollector a, Iterable<Bookmark> bptMarks) {
|
||||
|
@ -798,8 +782,7 @@ public class DebuggerLogicalBreakpointServicePlugin extends Plugin
|
|||
|
||||
private boolean isConsistentAfterRemoval(Bookmark pb, LogicalBreakpointInternal lb,
|
||||
boolean forChange) {
|
||||
Set<LogicalBreakpointInternal> present =
|
||||
breakpointsByAddress.get(pb.getAddress());
|
||||
Set<LogicalBreakpointInternal> present = breakpointsByAddress.get(pb.getAddress());
|
||||
boolean shouldBeAbsent = lb.isEmpty() && !forChange;
|
||||
boolean isAbsent = present == null || !present.contains(lb);
|
||||
return shouldBeAbsent == isAbsent;
|
||||
|
@ -859,15 +842,13 @@ public class DebuggerLogicalBreakpointServicePlugin extends Plugin
|
|||
for (Trace t : affectedTraces) {
|
||||
InfoPerTrace info = traceInfos.get(t);
|
||||
if (info != null) {
|
||||
info.forgetMismappedBreakpoints(c.r, additionalTraces,
|
||||
additionalPrograms);
|
||||
info.forgetMismappedBreakpoints(c.r, additionalTraces, additionalPrograms);
|
||||
}
|
||||
}
|
||||
for (Program p : affectedPrograms) {
|
||||
InfoPerProgram info = programInfos.get(p);
|
||||
if (info != null) {
|
||||
info.forgetMismappedBreakpoints(c.r, additionalTraces,
|
||||
additionalPrograms);
|
||||
info.forgetMismappedBreakpoints(c.r, additionalTraces, additionalPrograms);
|
||||
}
|
||||
}
|
||||
for (Trace t : additionalTraces) {
|
||||
|
@ -1131,8 +1112,7 @@ public class DebuggerLogicalBreakpointServicePlugin extends Plugin
|
|||
|
||||
@Override
|
||||
public Set<LogicalBreakpoint> getBreakpointsAt(ProgramLocation loc) {
|
||||
return DebuggerLogicalBreakpointService.programOrTrace(loc,
|
||||
this::getBreakpointsAt,
|
||||
return DebuggerLogicalBreakpointService.programOrTrace(loc, this::getBreakpointsAt,
|
||||
this::getBreakpointsAt);
|
||||
}
|
||||
|
||||
|
@ -1263,9 +1243,7 @@ public class DebuggerLogicalBreakpointServicePlugin extends Plugin
|
|||
}
|
||||
|
||||
private ControlMode getMode(Trace trace) {
|
||||
return controlService == null
|
||||
? ControlMode.DEFAULT
|
||||
: controlService.getCurrentMode(trace);
|
||||
return controlService == null ? ControlMode.DEFAULT : controlService.getCurrentMode(trace);
|
||||
}
|
||||
|
||||
interface TargetBreakpointConsumer {
|
||||
|
@ -1315,26 +1293,20 @@ public class DebuggerLogicalBreakpointServicePlugin extends Plugin
|
|||
|
||||
@Override
|
||||
public CompletableFuture<Void> enableLocs(Collection<TraceBreakpoint> col) {
|
||||
return actOnLocs(col,
|
||||
BreakpointActionSet::planEnableTarget,
|
||||
BreakpointActionSet::planEnableEmu,
|
||||
LogicalBreakpoint::enableForProgram);
|
||||
return actOnLocs(col, BreakpointActionSet::planEnableTarget,
|
||||
BreakpointActionSet::planEnableEmu, LogicalBreakpoint::enableForProgram);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CompletableFuture<Void> disableLocs(Collection<TraceBreakpoint> col) {
|
||||
return actOnLocs(col,
|
||||
BreakpointActionSet::planDisableTarget,
|
||||
BreakpointActionSet::planDisableEmu,
|
||||
LogicalBreakpoint::disableForProgram);
|
||||
return actOnLocs(col, BreakpointActionSet::planDisableTarget,
|
||||
BreakpointActionSet::planDisableEmu, LogicalBreakpoint::disableForProgram);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CompletableFuture<Void> deleteLocs(Collection<TraceBreakpoint> col) {
|
||||
return actOnLocs(col,
|
||||
BreakpointActionSet::planDeleteTarget,
|
||||
BreakpointActionSet::planDeleteEmu,
|
||||
lb -> {
|
||||
return actOnLocs(col, BreakpointActionSet::planDeleteTarget,
|
||||
BreakpointActionSet::planDeleteEmu, lb -> {
|
||||
// Never delete bookmark when user requests deleting locations
|
||||
});
|
||||
}
|
||||
|
|
|
@ -61,24 +61,15 @@ import ghidra.util.exception.CancelledException;
|
|||
import ghidra.util.task.TaskMonitor;
|
||||
|
||||
@PluginInfo(
|
||||
shortDescription = "Debugger static mapping manager",
|
||||
description = "Track and manage static mappings (program-trace relocations)",
|
||||
category = PluginCategoryNames.DEBUGGER,
|
||||
packageName = DebuggerPluginPackage.NAME,
|
||||
status = PluginStatus.RELEASED,
|
||||
eventsConsumed = {
|
||||
ProgramOpenedPluginEvent.class,
|
||||
ProgramClosedPluginEvent.class,
|
||||
TraceOpenedPluginEvent.class,
|
||||
TraceClosedPluginEvent.class,
|
||||
},
|
||||
servicesRequired = {
|
||||
ProgramManager.class,
|
||||
DebuggerTraceManagerService.class,
|
||||
},
|
||||
servicesProvided = {
|
||||
DebuggerStaticMappingService.class,
|
||||
})
|
||||
shortDescription = "Debugger static mapping manager",
|
||||
description = "Track and manage static mappings (program-trace relocations)",
|
||||
category = PluginCategoryNames.DEBUGGER,
|
||||
packageName = DebuggerPluginPackage.NAME,
|
||||
status = PluginStatus.RELEASED,
|
||||
eventsConsumed = { ProgramOpenedPluginEvent.class, ProgramClosedPluginEvent.class,
|
||||
TraceOpenedPluginEvent.class, TraceClosedPluginEvent.class, },
|
||||
servicesRequired = { ProgramManager.class, DebuggerTraceManagerService.class, },
|
||||
servicesProvided = { DebuggerStaticMappingService.class, })
|
||||
public class DebuggerStaticMappingServicePlugin extends Plugin
|
||||
implements DebuggerStaticMappingService, DomainFolderChangeAdapter {
|
||||
|
||||
|
@ -230,7 +221,7 @@ public class DebuggerStaticMappingServicePlugin extends Plugin
|
|||
public InfoPerTrace(Trace trace) {
|
||||
this.trace = trace;
|
||||
|
||||
listenForUntyped(DomainObject.DO_OBJECT_RESTORED, e -> objectRestored());
|
||||
listenForUntyped(DomainObjectEvent.RESTORED, e -> objectRestored());
|
||||
listenFor(TraceStaticMappingChangeType.ADDED, this::staticMappingAdded);
|
||||
listenFor(TraceStaticMappingChangeType.DELETED, this::staticMappingDeleted);
|
||||
|
||||
|
@ -420,7 +411,7 @@ public class DebuggerStaticMappingServicePlugin extends Plugin
|
|||
|
||||
@Override
|
||||
public void domainObjectChanged(DomainObjectChangedEvent ev) {
|
||||
if (ev.containsEvent(DomainObject.DO_DOMAIN_FILE_CHANGED)) {
|
||||
if (ev.contains(DomainObjectEvent.FILE_CHANGED)) {
|
||||
// TODO: This seems like overkill
|
||||
programClosed(program);
|
||||
programOpened(program);
|
||||
|
@ -461,8 +452,8 @@ public class DebuggerStaticMappingServicePlugin extends Plugin
|
|||
|
||||
public Set<TraceLocation> getOpenMappedTraceLocations(Address address) {
|
||||
Set<TraceLocation> result = new HashSet<>();
|
||||
for (Entry<MappingEntry, Address> inPreceding : inbound.headMapByValue(address,
|
||||
true).entrySet()) {
|
||||
for (Entry<MappingEntry, Address> inPreceding : inbound.headMapByValue(address, true)
|
||||
.entrySet()) {
|
||||
Address start = inPreceding.getValue();
|
||||
if (start == null) {
|
||||
continue;
|
||||
|
@ -478,8 +469,8 @@ public class DebuggerStaticMappingServicePlugin extends Plugin
|
|||
|
||||
public TraceLocation getOpenMappedTraceLocation(Trace trace, Address address, long snap) {
|
||||
// TODO: Map by trace?
|
||||
for (Entry<MappingEntry, Address> inPreceding : inbound.headMapByValue(address,
|
||||
true).entrySet()) {
|
||||
for (Entry<MappingEntry, Address> inPreceding : inbound.headMapByValue(address, true)
|
||||
.entrySet()) {
|
||||
Address start = inPreceding.getValue();
|
||||
if (start == null) {
|
||||
continue;
|
||||
|
@ -501,8 +492,9 @@ public class DebuggerStaticMappingServicePlugin extends Plugin
|
|||
|
||||
protected void collectOpenMappedViews(AddressRange rng,
|
||||
Map<TraceSpan, Collection<MappedAddressRange>> result) {
|
||||
for (Entry<MappingEntry, Address> inPreceeding : inbound.headMapByValue(
|
||||
rng.getMaxAddress(), true).entrySet()) {
|
||||
for (Entry<MappingEntry, Address> inPreceeding : inbound
|
||||
.headMapByValue(rng.getMaxAddress(), true)
|
||||
.entrySet()) {
|
||||
Address start = inPreceeding.getValue();
|
||||
if (start == null) {
|
||||
continue;
|
||||
|
@ -658,8 +650,8 @@ public class DebuggerStaticMappingServicePlugin extends Plugin
|
|||
return;
|
||||
}
|
||||
// NB. The URL may have changed, so can't use that as key
|
||||
for (Iterator<InfoPerProgram> it =
|
||||
trackedProgramInfo.values().iterator(); it.hasNext();) {
|
||||
for (Iterator<InfoPerProgram> it = trackedProgramInfo.values().iterator(); it
|
||||
.hasNext();) {
|
||||
InfoPerProgram info = it.next();
|
||||
if (info.program == program) {
|
||||
it.remove();
|
||||
|
@ -797,8 +789,7 @@ public class DebuggerStaticMappingServicePlugin extends Plugin
|
|||
}
|
||||
}
|
||||
for (Map.Entry<Program, List<ModuleMapEntry>> ent : entriesByProgram.entrySet()) {
|
||||
try (Transaction tx =
|
||||
ent.getKey().openTransaction("Memorize module mapping")) {
|
||||
try (Transaction tx = ent.getKey().openTransaction("Memorize module mapping")) {
|
||||
for (ModuleMapEntry entry : ent.getValue()) {
|
||||
ProgramModuleIndexer.addModulePaths(entry.getToProgram(),
|
||||
List.of(entry.getModule().getName()));
|
||||
|
|
|
@ -104,13 +104,13 @@ public class ProgramModuleIndexer implements DomainFolderChangeAdapter {
|
|||
if (disposed) {
|
||||
return;
|
||||
}
|
||||
if (ev.containsEvent(DomainObject.DO_OBJECT_RESTORED)) {
|
||||
if (ev.contains(DomainObjectEvent.RESTORED)) {
|
||||
refreshIndex(program.getDomainFile(), program);
|
||||
return;
|
||||
}
|
||||
if (ev.containsEvent(DomainObject.DO_PROPERTY_CHANGED)) {
|
||||
if (ev.contains(DomainObjectEvent.PROPERTY_CHANGED)) {
|
||||
for (DomainObjectChangeRecord rec : ev) {
|
||||
if (rec.getEventType() == DomainObject.DO_PROPERTY_CHANGED) {
|
||||
if (rec.getEventType() == DomainObjectEvent.PROPERTY_CHANGED) {
|
||||
// OldValue is actually the property name :/
|
||||
// See DomainObjectAdapter#propertyChanged
|
||||
String propertyName = (String) rec.getOldValue();
|
||||
|
|
|
@ -124,7 +124,7 @@ public class DomainObjectEventQueues {
|
|||
this.eventsEnabled = eventsEnabled;
|
||||
if (eventsEnabled) {
|
||||
DomainObjectChangeRecord restored =
|
||||
new DomainObjectChangeRecord(DomainObject.DO_OBJECT_RESTORED);
|
||||
new DomainObjectChangeRecord(DomainObjectEvent.RESTORED);
|
||||
eventQueue.fireEvent(restored);
|
||||
for (PrivateQueue privateQueue : privateEventQueues.values()) {
|
||||
privateQueue.fireEvent(restored);
|
||||
|
|
|
@ -54,9 +54,9 @@ public class DBTraceObjectBreakpointSpec
|
|||
this.object = object;
|
||||
TargetObjectSchema schema = object.getTargetSchema();
|
||||
synchronized (KEYS_BY_SCHEMA) {
|
||||
keys = KEYS_BY_SCHEMA.computeIfAbsent(schema, s -> Set.of(
|
||||
schema.checkAliasedAttribute(TargetBreakpointSpec.KINDS_ATTRIBUTE_NAME),
|
||||
schema.checkAliasedAttribute(TargetTogglable.ENABLED_ATTRIBUTE_NAME)));
|
||||
keys = KEYS_BY_SCHEMA.computeIfAbsent(schema,
|
||||
s -> Set.of(schema.checkAliasedAttribute(TargetBreakpointSpec.KINDS_ATTRIBUTE_NAME),
|
||||
schema.checkAliasedAttribute(TargetTogglable.ENABLED_ATTRIBUTE_NAME)));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -234,14 +234,16 @@ public class DBTraceObjectBreakpointSpec
|
|||
@Override
|
||||
public Collection<? extends TraceObjectBreakpointLocation> getLocations() {
|
||||
try (LockHold hold = object.getTrace().lockRead()) {
|
||||
return object.querySuccessorsInterface(getLifespan(),
|
||||
TraceObjectBreakpointLocation.class, true).collect(Collectors.toSet());
|
||||
return object
|
||||
.querySuccessorsInterface(getLifespan(), TraceObjectBreakpointLocation.class,
|
||||
true)
|
||||
.collect(Collectors.toSet());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public TraceChangeRecord<?, ?> translateEvent(TraceChangeRecord<?, ?> rec) {
|
||||
if (rec.getEventType() == TraceObjectChangeType.VALUE_CREATED.getType()) {
|
||||
if (rec.getEventType() == TraceObjectChangeType.VALUE_CREATED.getEventType()) {
|
||||
TraceChangeRecord<TraceObjectValue, Void> cast =
|
||||
TraceObjectChangeType.VALUE_CREATED.cast(rec);
|
||||
TraceObjectValue affected = cast.getAffectedObject();
|
||||
|
|
|
@ -43,8 +43,7 @@ import ghidra.program.model.reloc.RelocationTable;
|
|||
import ghidra.program.model.symbol.*;
|
||||
import ghidra.program.model.util.AddressSetPropertyMap;
|
||||
import ghidra.program.model.util.PropertyMapManager;
|
||||
import ghidra.program.util.ChangeManager;
|
||||
import ghidra.program.util.ProgramChangeRecord;
|
||||
import ghidra.program.util.*;
|
||||
import ghidra.trace.database.*;
|
||||
import ghidra.trace.database.listing.DBTraceCodeSpace;
|
||||
import ghidra.trace.database.listing.DBTraceDefinedUnitsView;
|
||||
|
@ -86,12 +85,12 @@ public class DBTraceProgramView implements TraceProgramView {
|
|||
protected class EventTranslator extends TypedEventDispatcher
|
||||
implements DBTraceDirectChangeListener {
|
||||
public EventTranslator() {
|
||||
listenForUntyped(DomainObject.DO_OBJECT_SAVED, this::eventPassthrough);
|
||||
listenForUntyped(DomainObject.DO_DOMAIN_FILE_CHANGED, this::eventPassthrough);
|
||||
listenForUntyped(DomainObject.DO_OBJECT_RENAMED, this::eventPassthrough);
|
||||
listenForUntyped(DomainObject.DO_OBJECT_RESTORED, this::objectRestored);
|
||||
listenForUntyped(DomainObject.DO_OBJECT_CLOSED, this::eventPassthrough);
|
||||
listenForUntyped(DomainObject.DO_OBJECT_ERROR, this::eventPassthrough);
|
||||
listenForUntyped(DomainObjectEvent.SAVED, this::eventPassthrough);
|
||||
listenForUntyped(DomainObjectEvent.FILE_CHANGED, this::eventPassthrough);
|
||||
listenForUntyped(DomainObjectEvent.RENAMED, this::eventPassthrough);
|
||||
listenForUntyped(DomainObjectEvent.RESTORED, this::objectRestored);
|
||||
listenForUntyped(DomainObjectEvent.CLOSED, this::eventPassthrough);
|
||||
listenForUntyped(DomainObjectEvent.ERROR, this::eventPassthrough);
|
||||
|
||||
listenFor(TraceBookmarkChangeType.TYPE_ADDED, this::bookmarkTypeAdded);
|
||||
listenFor(TraceBookmarkChangeType.ADDED, this::bookmarkAdded);
|
||||
|
@ -175,8 +174,8 @@ public class DBTraceProgramView implements TraceProgramView {
|
|||
}
|
||||
|
||||
private void bookmarkTypeAdded(TraceBookmarkType type) {
|
||||
fireEventAllViews(new ProgramChangeRecord(ChangeManager.DOCR_BOOKMARK_TYPE_ADDED, null,
|
||||
null, type, null, null));
|
||||
fireEventAllViews(new ProgramChangeRecord(ProgramEvent.BOOKMARK_TYPE_ADDED, null, null,
|
||||
type, null, null));
|
||||
}
|
||||
|
||||
private void bookmarkAdded(TraceAddressSpace space, TraceBookmark bm) {
|
||||
|
@ -188,8 +187,8 @@ public class DBTraceProgramView implements TraceProgramView {
|
|||
}
|
||||
|
||||
protected void fireBookmarkAdded(DomainObjectEventQueues queues, TraceBookmark bm) {
|
||||
queues.fireEvent(new ProgramChangeRecord(ChangeManager.DOCR_BOOKMARK_ADDED,
|
||||
bm.getAddress(), bm.getAddress(), bm, null, null));
|
||||
queues.fireEvent(new ProgramChangeRecord(ProgramEvent.BOOKMARK_ADDED, bm.getAddress(),
|
||||
bm.getAddress(), bm, null, null));
|
||||
}
|
||||
|
||||
private void bookmarkChanged(TraceAddressSpace space, TraceBookmark bm) {
|
||||
|
@ -201,8 +200,8 @@ public class DBTraceProgramView implements TraceProgramView {
|
|||
}
|
||||
|
||||
protected void fireBookmarkChanged(DomainObjectEventQueues queues, TraceBookmark bm) {
|
||||
queues.fireEvent(new ProgramChangeRecord(ChangeManager.DOCR_BOOKMARK_CHANGED,
|
||||
bm.getAddress(), bm.getAddress(), bm, null, null));
|
||||
queues.fireEvent(new ProgramChangeRecord(ProgramEvent.BOOKMARK_CHANGED, bm.getAddress(),
|
||||
bm.getAddress(), bm, null, null));
|
||||
}
|
||||
|
||||
private void bookmarkLifespanChanged(TraceAddressSpace space, TraceBookmark bm,
|
||||
|
@ -230,30 +229,30 @@ public class DBTraceProgramView implements TraceProgramView {
|
|||
}
|
||||
|
||||
protected void fireBookmarkRemoved(DomainObjectEventQueues queues, TraceBookmark bm) {
|
||||
queues.fireEvent(new ProgramChangeRecord(ChangeManager.DOCR_BOOKMARK_REMOVED,
|
||||
bm.getAddress(), bm.getAddress(), bm, null, null));
|
||||
queues.fireEvent(new ProgramChangeRecord(ProgramEvent.BOOKMARK_REMOVED, bm.getAddress(),
|
||||
bm.getAddress(), bm, null, null));
|
||||
}
|
||||
|
||||
private void categoryAdded(long id, Category oldIsNull, Category added) {
|
||||
fireEventAllViews(new ProgramChangeRecord(ChangeManager.DOCR_CATEGORY_ADDED, null, null,
|
||||
null, oldIsNull, added));
|
||||
fireEventAllViews(new ProgramChangeRecord(ProgramEvent.DATA_TYPE_CATEGORY_ADDED, null,
|
||||
null, null, oldIsNull, added));
|
||||
}
|
||||
|
||||
private void categoryMoved(long id, CategoryPath oldPath, CategoryPath newPath) {
|
||||
Category category = getDataTypeManager().getCategory(id);
|
||||
fireEventAllViews(new ProgramChangeRecord(ChangeManager.DOCR_CATEGORY_MOVED, null, null,
|
||||
null, oldPath, category));
|
||||
fireEventAllViews(new ProgramChangeRecord(ProgramEvent.DATA_TYPE_CATEGORY_MOVED, null,
|
||||
null, null, oldPath, category));
|
||||
}
|
||||
|
||||
private void categoryRenamed(long id, String oldName, String newName) {
|
||||
Category category = getDataTypeManager().getCategory(id);
|
||||
fireEventAllViews(new ProgramChangeRecord(ChangeManager.DOCR_CATEGORY_RENAMED, null,
|
||||
fireEventAllViews(new ProgramChangeRecord(ProgramEvent.DATA_TYPE_CATEGORY_RENAMED, null,
|
||||
null, null, oldName, category));
|
||||
}
|
||||
|
||||
private void categoryDeleted(long id, CategoryPath deleted, CategoryPath newIsNull) {
|
||||
Category parent = getDataTypeManager().getCategory(deleted.getParent());
|
||||
fireEventAllViews(new ProgramChangeRecord(ChangeManager.DOCR_CATEGORY_REMOVED, null,
|
||||
fireEventAllViews(new ProgramChangeRecord(ProgramEvent.DATA_TYPE_CATEGORY_REMOVED, null,
|
||||
null, null, parent, deleted.getName()));
|
||||
}
|
||||
|
||||
|
@ -271,7 +270,7 @@ public class DBTraceProgramView implements TraceProgramView {
|
|||
|
||||
protected void fireCodeAdded(DomainObjectEventQueues queues, Address min, Address max) {
|
||||
queues.fireEvent(
|
||||
new ProgramChangeRecord(ChangeManager.DOCR_CODE_ADDED, min, max, null, null, null));
|
||||
new ProgramChangeRecord(ProgramEvent.CODE_ADDED, min, max, null, null, null));
|
||||
}
|
||||
|
||||
private void codeLifespanChanged(TraceAddressSpace space, TraceCodeUnit unit,
|
||||
|
@ -302,8 +301,8 @@ public class DBTraceProgramView implements TraceProgramView {
|
|||
|
||||
protected void fireCodeRemoved(DomainObjectEventQueues queues, Address min, Address max,
|
||||
TraceCodeUnit removed) {
|
||||
queues.fireEvent(new ProgramChangeRecord(ChangeManager.DOCR_CODE_REMOVED, min, max,
|
||||
null, removed, null));
|
||||
queues.fireEvent(
|
||||
new ProgramChangeRecord(ProgramEvent.CODE_REMOVED, min, max, null, removed, null));
|
||||
}
|
||||
|
||||
private void codeFragmentChanged(TraceAddressSpace space, TraceAddressSnapRange range,
|
||||
|
@ -312,7 +311,7 @@ public class DBTraceProgramView implements TraceProgramView {
|
|||
if (queues == null) {
|
||||
return;
|
||||
}
|
||||
queues.fireEvent(new ProgramChangeRecord(ChangeManager.DOCR_CODE_MOVED, null, null,
|
||||
queues.fireEvent(new ProgramChangeRecord(ProgramEvent.FRAGMENT_CHANGED, null, null,
|
||||
null, range.getX1(), range.getX2()));
|
||||
}
|
||||
|
||||
|
@ -323,8 +322,8 @@ public class DBTraceProgramView implements TraceProgramView {
|
|||
if (queues == null) {
|
||||
return;
|
||||
}
|
||||
queues.fireEvent(new ProgramChangeRecord(ChangeManager.DOCR_DATA_TYPE_REPLACED,
|
||||
range.getX1(), range.getX2(), null, null, null));
|
||||
queues.fireEvent(new ProgramChangeRecord(ProgramEvent.DATA_TYPE_REPLACED, range.getX1(),
|
||||
range.getX2(), null, null, null));
|
||||
}
|
||||
|
||||
private void codeDataTypeSettingsChanged(TraceAddressSpace space,
|
||||
|
@ -334,49 +333,44 @@ public class DBTraceProgramView implements TraceProgramView {
|
|||
return;
|
||||
}
|
||||
// Yes, x1 twice
|
||||
queues.fireEvent(new ProgramChangeRecord(ChangeManager.DOCR_DATA_TYPE_SETTING_CHANGED,
|
||||
queues.fireEvent(new ProgramChangeRecord(ProgramEvent.DATA_TYPE_SETTING_CHANGED,
|
||||
range.getX1(), range.getX1(), null, null, null));
|
||||
}
|
||||
|
||||
private void commentChanged(int docrType, TraceAddressSpace space,
|
||||
private void commentChanged(int commentType, TraceAddressSpace space,
|
||||
TraceAddressSnapRange range, String oldValue, String newValue) {
|
||||
DomainObjectEventQueues queues = isVisible(space, range);
|
||||
if (queues == null) {
|
||||
return;
|
||||
}
|
||||
queues.fireEvent(new ProgramChangeRecord(docrType, range.getX1(), range.getX2(), null,
|
||||
oldValue, newValue));
|
||||
queues.fireEvent(
|
||||
new CommentChangeRecord(commentType, range.getX1(), oldValue, newValue));
|
||||
}
|
||||
|
||||
private void commentEolChanged(TraceAddressSpace space, TraceAddressSnapRange range,
|
||||
String oldValue, String newValue) {
|
||||
commentChanged(ChangeManager.DOCR_EOL_COMMENT_CHANGED, space, range, oldValue,
|
||||
newValue);
|
||||
commentChanged(CodeUnit.EOL_COMMENT, space, range, oldValue, newValue);
|
||||
}
|
||||
|
||||
private void commentPlateChanged(TraceAddressSpace space, TraceAddressSnapRange range,
|
||||
String oldValue, String newValue) {
|
||||
commentChanged(ChangeManager.DOCR_PLATE_COMMENT_CHANGED, space, range, oldValue,
|
||||
newValue);
|
||||
commentChanged(CodeUnit.PLATE_COMMENT, space, range, oldValue, newValue);
|
||||
}
|
||||
|
||||
private void commentPostChanged(TraceAddressSpace space, TraceAddressSnapRange range,
|
||||
String oldValue, String newValue) {
|
||||
commentChanged(ChangeManager.DOCR_POST_COMMENT_CHANGED, space, range, oldValue,
|
||||
newValue);
|
||||
commentChanged(CodeUnit.POST_COMMENT, space, range, oldValue, newValue);
|
||||
}
|
||||
|
||||
private void commentPreChanged(TraceAddressSpace space, TraceAddressSnapRange range,
|
||||
String oldValue, String newValue) {
|
||||
commentChanged(ChangeManager.DOCR_PRE_COMMENT_CHANGED, space, range, oldValue,
|
||||
newValue);
|
||||
commentChanged(CodeUnit.PRE_COMMENT, space, range, oldValue, newValue);
|
||||
}
|
||||
|
||||
private void commentRepeatableChanged(TraceAddressSpace space, TraceAddressSnapRange range,
|
||||
String oldValue, String newValue) {
|
||||
// TODO: The "repeatable" semantics are not implemented, yet.
|
||||
commentChanged(ChangeManager.DOCR_REPEATABLE_COMMENT_CHANGED, space, range, oldValue,
|
||||
newValue);
|
||||
commentChanged(CodeUnit.REPEATABLE_COMMENT, space, range, oldValue, newValue);
|
||||
}
|
||||
|
||||
private void compositeDataAdded(TraceAddressSpace space, TraceAddressSnapRange range,
|
||||
|
@ -385,7 +379,7 @@ public class DBTraceProgramView implements TraceProgramView {
|
|||
if (queues == null) {
|
||||
return;
|
||||
}
|
||||
queues.fireEvent(new ProgramChangeRecord(ChangeManager.DOCR_COMPOSITE_ADDED,
|
||||
queues.fireEvent(new ProgramChangeRecord(ProgramEvent.COMPOSITE_ADDED,
|
||||
added.getMinAddress(), added.getMaxAddress(), null, null, added));
|
||||
}
|
||||
|
||||
|
@ -398,11 +392,11 @@ public class DBTraceProgramView implements TraceProgramView {
|
|||
boolean inOld = isCodeVisible(data, oldSpan);
|
||||
boolean inNew = isCodeVisible(data, newSpan);
|
||||
if (inOld && !inNew) {
|
||||
queues.fireEvent(new ProgramChangeRecord(ChangeManager.DOCR_COMPOSITE_REMOVED,
|
||||
queues.fireEvent(new ProgramChangeRecord(ProgramEvent.COMPOSITE_REMOVED,
|
||||
data.getMinAddress(), data.getMaxAddress(), null, data, null));
|
||||
}
|
||||
if (!inOld && inNew) {
|
||||
queues.fireEvent(new ProgramChangeRecord(ChangeManager.DOCR_COMPOSITE_ADDED,
|
||||
queues.fireEvent(new ProgramChangeRecord(ProgramEvent.COMPOSITE_ADDED,
|
||||
data.getMinAddress(), data.getMaxAddress(), null, null, data));
|
||||
}
|
||||
}
|
||||
|
@ -414,42 +408,42 @@ public class DBTraceProgramView implements TraceProgramView {
|
|||
return;
|
||||
}
|
||||
// TODO: ProgramDB doesn't send this.... Should I?
|
||||
queues.fireEvent(new ProgramChangeRecord(ChangeManager.DOCR_COMPOSITE_REMOVED,
|
||||
queues.fireEvent(new ProgramChangeRecord(ProgramEvent.COMPOSITE_REMOVED,
|
||||
removed.getMinAddress(), removed.getMaxAddress(), null, removed, null));
|
||||
}
|
||||
|
||||
private void dataTypeAdded(long id, DataType oldIsNull, DataType added) {
|
||||
fireEventAllViews(new ProgramChangeRecord(ChangeManager.DOCR_DATA_TYPE_ADDED, null,
|
||||
null, null, oldIsNull, added));
|
||||
fireEventAllViews(new ProgramChangeRecord(ProgramEvent.DATA_TYPE_ADDED, null, null,
|
||||
null, oldIsNull, added));
|
||||
}
|
||||
|
||||
private void dataTypeChanged(long id, DataType oldIsNull, DataType changed) {
|
||||
fireEventAllViews(new ProgramChangeRecord(ChangeManager.DOCR_DATA_TYPE_CHANGED, null,
|
||||
null, null, oldIsNull, changed));
|
||||
fireEventAllViews(new ProgramChangeRecord(ProgramEvent.DATA_TYPE_CHANGED, null, null,
|
||||
null, oldIsNull, changed));
|
||||
}
|
||||
|
||||
private void dataTypeReplaced(long id, DataTypePath oldPath, DataTypePath newPath) {
|
||||
DataType newType = getDataTypeManager().getDataType(id);
|
||||
fireEventAllViews(new ProgramChangeRecord(ChangeManager.DOCR_DATA_TYPE_REPLACED, null,
|
||||
null, null, newPath, newType));
|
||||
fireEventAllViews(new ProgramChangeRecord(ProgramEvent.DATA_TYPE_REPLACED, null, null,
|
||||
null, newPath, newType));
|
||||
}
|
||||
|
||||
private void dataTypeMoved(long id, DataTypePath oldPath, DataTypePath newPath) {
|
||||
Category oldCategory = getDataTypeManager().getCategory(oldPath.getCategoryPath());
|
||||
DataType dataType = getDataTypeManager().getDataType(id);
|
||||
fireEventAllViews(new ProgramChangeRecord(ChangeManager.DOCR_DATA_TYPE_MOVED, null,
|
||||
null, null, oldCategory, dataType));
|
||||
fireEventAllViews(new ProgramChangeRecord(ProgramEvent.DATA_TYPE_MOVED, null, null,
|
||||
null, oldCategory, dataType));
|
||||
}
|
||||
|
||||
private void dataTypeRenamed(long id, String oldName, String newName) {
|
||||
DataType dataType = getDataTypeManager().getDataType(id);
|
||||
fireEventAllViews(new ProgramChangeRecord(ChangeManager.DOCR_DATA_TYPE_RENAMED, null,
|
||||
null, null, oldName, dataType));
|
||||
fireEventAllViews(new ProgramChangeRecord(ProgramEvent.DATA_TYPE_RENAMED, null, null,
|
||||
null, oldName, dataType));
|
||||
}
|
||||
|
||||
private void dataTypeDeleted(long id, DataTypePath oldPath, DataTypePath newIsNull) {
|
||||
fireEventAllViews(new ProgramChangeRecord(ChangeManager.DOCR_DATA_TYPE_REMOVED, null,
|
||||
null, null, oldPath, newIsNull));
|
||||
fireEventAllViews(new ProgramChangeRecord(ProgramEvent.DATA_TYPE_REMOVED, null, null,
|
||||
null, oldPath, newIsNull));
|
||||
}
|
||||
|
||||
private void instructionFlowOverrideChanged(TraceAddressSpace space,
|
||||
|
@ -458,7 +452,7 @@ public class DBTraceProgramView implements TraceProgramView {
|
|||
if (queues == null) {
|
||||
return;
|
||||
}
|
||||
queues.fireEvent(new ProgramChangeRecord(ChangeManager.DOCR_FLOWOVERRIDE_CHANGED,
|
||||
queues.fireEvent(new ProgramChangeRecord(ProgramEvent.FLOW_OVERRIDE_CHANGED,
|
||||
instruction.getMinAddress(), instruction.getMinAddress(), null, null, null));
|
||||
}
|
||||
|
||||
|
@ -468,7 +462,7 @@ public class DBTraceProgramView implements TraceProgramView {
|
|||
if (queues == null) {
|
||||
return;
|
||||
}
|
||||
queues.fireEvent(new ProgramChangeRecord(ChangeManager.DOCR_FALLTHROUGH_CHANGED,
|
||||
queues.fireEvent(new ProgramChangeRecord(ProgramEvent.FALLTHROUGH_CHANGED,
|
||||
instruction.getMinAddress(), instruction.getMinAddress(), null, null, null));
|
||||
}
|
||||
|
||||
|
@ -478,7 +472,7 @@ public class DBTraceProgramView implements TraceProgramView {
|
|||
if (queues == null) {
|
||||
return;
|
||||
}
|
||||
queues.fireEvent(new ProgramChangeRecord(ChangeManager.DOCR_LENGTH_OVERRIDE_CHANGED,
|
||||
queues.fireEvent(new ProgramChangeRecord(ProgramEvent.LENGTH_OVERRIDE_CHANGED,
|
||||
instruction.getMinAddress(), instruction.getMinAddress(), null, null, null));
|
||||
}
|
||||
|
||||
|
@ -493,7 +487,7 @@ public class DBTraceProgramView implements TraceProgramView {
|
|||
|
||||
protected void fireMemoryBytesChanged(DomainObjectEventQueues queues,
|
||||
TraceAddressSnapRange range) {
|
||||
queues.fireEvent(new ProgramChangeRecord(ChangeManager.DOCR_MEMORY_BYTES_CHANGED,
|
||||
queues.fireEvent(new ProgramChangeRecord(ProgramEvent.MEMORY_BYTES_CHANGED,
|
||||
range.getX1(), range.getX2(), null, null, null));
|
||||
}
|
||||
|
||||
|
@ -502,21 +496,21 @@ public class DBTraceProgramView implements TraceProgramView {
|
|||
return;
|
||||
}
|
||||
// NOTE: Register view regions are fixed
|
||||
eventQueues.fireEvent(new ProgramChangeRecord(ChangeManager.DOCR_MEMORY_BLOCK_ADDED,
|
||||
eventQueues.fireEvent(new ProgramChangeRecord(ProgramEvent.MEMORY_BLOCK_ADDED,
|
||||
region.getMinAddress(), region.getMaxAddress(), null, null, null));
|
||||
// NOTE: MemoryMapDB does this, too. Otherwise, CodeBrowserPlugin does not hear.
|
||||
eventQueues.fireEvent(new DomainObjectChangeRecord(DomainObject.DO_OBJECT_RESTORED));
|
||||
eventQueues.fireEvent(new DomainObjectChangeRecord(DomainObjectEvent.RESTORED));
|
||||
}
|
||||
|
||||
private void memoryRegionChanged(TraceAddressSpace space, TraceMemoryRegion region) {
|
||||
if (!isRegionVisible(region)) {
|
||||
return;
|
||||
}
|
||||
eventQueues.fireEvent(new ProgramChangeRecord(ChangeManager.DOCR_MEMORY_BLOCK_CHANGED,
|
||||
eventQueues.fireEvent(new ProgramChangeRecord(ProgramEvent.MEMORY_BLOCK_CHANGED,
|
||||
region.getMinAddress(), region.getMaxAddress(), null, null, null));
|
||||
// TODO: Perhaps a bit heavy-handed here. MemoryMapDB does not do this, too.
|
||||
// TODO: Probably want a separate RANGE_CHANGED or MOVED event
|
||||
eventQueues.fireEvent(new DomainObjectChangeRecord(DomainObject.DO_OBJECT_RESTORED));
|
||||
eventQueues.fireEvent(new DomainObjectChangeRecord(DomainObjectEvent.RESTORED));
|
||||
}
|
||||
|
||||
private void memoryRegionLifespanChanged(TraceAddressSpace space, TraceMemoryRegion region,
|
||||
|
@ -524,19 +518,16 @@ public class DBTraceProgramView implements TraceProgramView {
|
|||
boolean inOld = isRegionVisible(region, oldSpan);
|
||||
boolean inNew = isRegionVisible(region, newSpan);
|
||||
if (inOld && !inNew) {
|
||||
eventQueues
|
||||
.fireEvent(new ProgramChangeRecord(ChangeManager.DOCR_MEMORY_BLOCK_REMOVED,
|
||||
region.getMinAddress(), region.getMaxAddress(), null, null, null));
|
||||
// NOTE: MemoryMapDB does this, too. Otherwise, CodeBrowserPlugin does not hear.
|
||||
eventQueues
|
||||
.fireEvent(new DomainObjectChangeRecord(DomainObject.DO_OBJECT_RESTORED));
|
||||
}
|
||||
if (!inOld && inNew) {
|
||||
eventQueues.fireEvent(new ProgramChangeRecord(ChangeManager.DOCR_MEMORY_BLOCK_ADDED,
|
||||
eventQueues.fireEvent(new ProgramChangeRecord(ProgramEvent.MEMORY_BLOCK_REMOVED,
|
||||
region.getMinAddress(), region.getMaxAddress(), null, null, null));
|
||||
// NOTE: MemoryMapDB does this, too. Otherwise, CodeBrowserPlugin does not hear.
|
||||
eventQueues
|
||||
.fireEvent(new DomainObjectChangeRecord(DomainObject.DO_OBJECT_RESTORED));
|
||||
eventQueues.fireEvent(new DomainObjectChangeRecord(DomainObjectEvent.RESTORED));
|
||||
}
|
||||
if (!inOld && inNew) {
|
||||
eventQueues.fireEvent(new ProgramChangeRecord(ProgramEvent.MEMORY_BLOCK_ADDED,
|
||||
region.getMinAddress(), region.getMaxAddress(), null, null, null));
|
||||
// NOTE: MemoryMapDB does this, too. Otherwise, CodeBrowserPlugin does not hear.
|
||||
eventQueues.fireEvent(new DomainObjectChangeRecord(DomainObjectEvent.RESTORED));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -547,20 +538,20 @@ public class DBTraceProgramView implements TraceProgramView {
|
|||
if (!isRegionVisible(region)) {
|
||||
return;
|
||||
}
|
||||
eventQueues.fireEvent(new ProgramChangeRecord(ChangeManager.DOCR_MEMORY_BLOCK_REMOVED,
|
||||
eventQueues.fireEvent(new ProgramChangeRecord(ProgramEvent.MEMORY_BLOCK_REMOVED,
|
||||
region.getMinAddress(), region.getMaxAddress(), null, null, null));
|
||||
// NOTE: MemoryMapDB does this, too. Otherwise, CodeBrowserPlugin does not hear.
|
||||
eventQueues.fireEvent(new DomainObjectChangeRecord(DomainObject.DO_OBJECT_RESTORED));
|
||||
eventQueues.fireEvent(new DomainObjectChangeRecord(DomainObjectEvent.RESTORED));
|
||||
}
|
||||
|
||||
private void sourceArchiveAdded(UniversalID id) {
|
||||
fireEventAllViews(new ProgramChangeRecord(ChangeManager.DOCR_SOURCE_ARCHIVE_ADDED, null,
|
||||
null, id, null, null));
|
||||
fireEventAllViews(new ProgramChangeRecord(ProgramEvent.SOURCE_ARCHIVE_ADDED, null, null,
|
||||
id, null, null));
|
||||
}
|
||||
|
||||
private void sourceArchiveChanged(UniversalID id) {
|
||||
fireEventAllViews(new ProgramChangeRecord(ChangeManager.DOCR_SOURCE_ARCHIVE_CHANGED,
|
||||
null, null, id, null, null));
|
||||
fireEventAllViews(new ProgramChangeRecord(ProgramEvent.SOURCE_ARCHIVE_CHANGED, null,
|
||||
null, id, null, null));
|
||||
}
|
||||
|
||||
private void symbolAdded(TraceAddressSpace space, TraceSymbol symbol) {
|
||||
|
@ -572,8 +563,8 @@ public class DBTraceProgramView implements TraceProgramView {
|
|||
}
|
||||
|
||||
public void fireSymbolAdded(DomainObjectEventQueues queues, TraceSymbol symbol) {
|
||||
queues.fireEvent(new ProgramChangeRecord(ChangeManager.DOCR_SYMBOL_ADDED,
|
||||
symbol.getAddress(), symbol.getAddress(), null, null, symbol));
|
||||
queues.fireEvent(new ProgramChangeRecord(ProgramEvent.SYMBOL_ADDED, symbol.getAddress(),
|
||||
symbol.getAddress(), null, null, symbol));
|
||||
}
|
||||
|
||||
private void symbolSourceChanged(TraceAddressSpace space, TraceSymbol symbol) {
|
||||
|
@ -581,7 +572,7 @@ public class DBTraceProgramView implements TraceProgramView {
|
|||
if (queues == null) {
|
||||
return;
|
||||
}
|
||||
queues.fireEvent(new ProgramChangeRecord(ChangeManager.DOCR_SYMBOL_SOURCE_CHANGED,
|
||||
queues.fireEvent(new ProgramChangeRecord(ProgramEvent.SYMBOL_SOURCE_CHANGED,
|
||||
symbol.getAddress(), symbol.getAddress(), symbol, null, null));
|
||||
}
|
||||
|
||||
|
@ -597,7 +588,7 @@ public class DBTraceProgramView implements TraceProgramView {
|
|||
oldPrimary = null;
|
||||
}
|
||||
assert oldQueues == newQueues || oldQueues == null;
|
||||
newQueues.fireEvent(new ProgramChangeRecord(ChangeManager.DOCR_SYMBOL_SET_AS_PRIMARY,
|
||||
newQueues.fireEvent(new ProgramChangeRecord(ProgramEvent.SYMBOL_PRIMARY_STATE_CHANGED,
|
||||
symbol.getAddress(), symbol.getAddress(), null, oldPrimary, newPrimary));
|
||||
}
|
||||
|
||||
|
@ -607,7 +598,7 @@ public class DBTraceProgramView implements TraceProgramView {
|
|||
if (queues == null) {
|
||||
return;
|
||||
}
|
||||
queues.fireEvent(new ProgramChangeRecord(ChangeManager.DOCR_SYMBOL_RENAMED,
|
||||
queues.fireEvent(new ProgramChangeRecord(ProgramEvent.SYMBOL_RENAMED,
|
||||
symbol.getAddress(), symbol.getAddress(), symbol, oldName, newName));
|
||||
}
|
||||
|
||||
|
@ -617,7 +608,7 @@ public class DBTraceProgramView implements TraceProgramView {
|
|||
if (queues == null) {
|
||||
return;
|
||||
}
|
||||
queues.fireEvent(new ProgramChangeRecord(ChangeManager.DOCR_SYMBOL_SCOPE_CHANGED,
|
||||
queues.fireEvent(new ProgramChangeRecord(ProgramEvent.SYMBOL_SCOPE_CHANGED,
|
||||
symbol.getAddress(), symbol.getAddress(), symbol, oldParent, newParent));
|
||||
}
|
||||
|
||||
|
@ -628,7 +619,7 @@ public class DBTraceProgramView implements TraceProgramView {
|
|||
return;
|
||||
}
|
||||
// Strange. This is fired as if by the reference rather than the symbol
|
||||
queues.fireEvent(new ProgramChangeRecord(ChangeManager.DOCR_SYMBOL_ASSOCIATION_ADDED,
|
||||
queues.fireEvent(new ProgramChangeRecord(ProgramEvent.SYMBOL_ASSOCIATION_ADDED,
|
||||
newRef.getFromAddress(), newRef.getFromAddress(), newRef, null, symbol));
|
||||
}
|
||||
|
||||
|
@ -639,7 +630,7 @@ public class DBTraceProgramView implements TraceProgramView {
|
|||
return;
|
||||
}
|
||||
// Ditto as ADDED
|
||||
queues.fireEvent(new ProgramChangeRecord(ChangeManager.DOCR_SYMBOL_ASSOCIATION_REMOVED,
|
||||
queues.fireEvent(new ProgramChangeRecord(ProgramEvent.SYMBOL_ASSOCIATION_REMOVED,
|
||||
oldRef.getFromAddress(), oldRef.getFromAddress(), oldRef, symbol, null));
|
||||
}
|
||||
|
||||
|
@ -649,7 +640,7 @@ public class DBTraceProgramView implements TraceProgramView {
|
|||
if (queues == null) {
|
||||
return;
|
||||
}
|
||||
queues.fireEvent(new ProgramChangeRecord(ChangeManager.DOCR_SYMBOL_ADDRESS_CHANGED,
|
||||
queues.fireEvent(new ProgramChangeRecord(ProgramEvent.SYMBOL_ADDRESS_CHANGED,
|
||||
oldAddress, oldAddress, symbol, oldAddress, newAddress));
|
||||
}
|
||||
|
||||
|
@ -679,7 +670,7 @@ public class DBTraceProgramView implements TraceProgramView {
|
|||
|
||||
protected void fireSymbolRemoved(DomainObjectEventQueues queues, TraceSymbol symbol) {
|
||||
queues.fireEvent(
|
||||
new ProgramChangeRecord(ChangeManager.DOCR_SYMBOL_REMOVED, symbol.getAddress(),
|
||||
new ProgramChangeRecord(ProgramEvent.SYMBOL_REMOVED, symbol.getAddress(),
|
||||
symbol.getAddress(), symbol, symbol.getName(), symbol.getID()));
|
||||
}
|
||||
}
|
||||
|
@ -780,7 +771,7 @@ public class DBTraceProgramView implements TraceProgramView {
|
|||
}
|
||||
|
||||
protected void viewportChanged() {
|
||||
eventQueues.fireEvent(new DomainObjectChangeRecord(DomainObject.DO_OBJECT_RESTORED));
|
||||
eventQueues.fireEvent(new DomainObjectChangeRecord(DomainObjectEvent.RESTORED));
|
||||
}
|
||||
|
||||
protected void fireEventAllViews(DomainObjectChangeRecord ev) {
|
||||
|
@ -795,7 +786,7 @@ public class DBTraceProgramView implements TraceProgramView {
|
|||
* Fires object-restored event on this view and all associated register views.
|
||||
*/
|
||||
protected void fireObjectRestored() {
|
||||
fireEventAllViews(new DomainObjectChangeRecord(DomainObject.DO_OBJECT_RESTORED));
|
||||
fireEventAllViews(new DomainObjectChangeRecord(DomainObjectEvent.RESTORED));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -17,9 +17,10 @@ package ghidra.trace.database.stack;
|
|||
|
||||
import java.util.*;
|
||||
|
||||
import ghidra.dbg.target.*;
|
||||
import ghidra.dbg.target.TargetStackFrame;
|
||||
import ghidra.dbg.target.schema.TargetObjectSchema;
|
||||
import ghidra.dbg.util.PathUtils;
|
||||
import ghidra.framework.model.EventType;
|
||||
import ghidra.program.model.address.Address;
|
||||
import ghidra.program.model.listing.CodeUnit;
|
||||
import ghidra.trace.database.target.DBTraceObject;
|
||||
|
@ -52,8 +53,8 @@ public class DBTraceObjectStackFrame implements TraceObjectStackFrame, DBTraceOb
|
|||
|
||||
TargetObjectSchema schema = object.getTargetSchema();
|
||||
synchronized (KEYS_BY_SCHEMA) {
|
||||
keys = KEYS_BY_SCHEMA.computeIfAbsent(schema, s -> Set.of(
|
||||
schema.checkAliasedAttribute(TargetStackFrame.PC_ATTRIBUTE_NAME)));
|
||||
keys = KEYS_BY_SCHEMA.computeIfAbsent(schema,
|
||||
s -> Set.of(schema.checkAliasedAttribute(TargetStackFrame.PC_ATTRIBUTE_NAME)));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -88,8 +89,8 @@ public class DBTraceObjectStackFrame implements TraceObjectStackFrame, DBTraceOb
|
|||
|
||||
@Override
|
||||
public Address getProgramCounter(long snap) {
|
||||
return TraceObjectInterfaceUtils.getValue(object, snap,
|
||||
TargetStackFrame.PC_ATTRIBUTE_NAME, Address.class, null);
|
||||
return TraceObjectInterfaceUtils.getValue(object, snap, TargetStackFrame.PC_ATTRIBUTE_NAME,
|
||||
Address.class, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -128,8 +129,7 @@ public class DBTraceObjectStackFrame implements TraceObjectStackFrame, DBTraceOb
|
|||
public void setComment(long snap, String comment) {
|
||||
/* See rant in getComment */
|
||||
try (LockHold hold = object.getTrace().lockWrite()) {
|
||||
TraceObjectValue pcAttr =
|
||||
object.getValue(snap, TargetStackFrame.PC_ATTRIBUTE_NAME);
|
||||
TraceObjectValue pcAttr = object.getValue(snap, TargetStackFrame.PC_ATTRIBUTE_NAME);
|
||||
object.getTrace()
|
||||
.getCommentAdapter()
|
||||
.setComment(pcAttr.getLifespan(), (Address) pcAttr.getValue(),
|
||||
|
@ -166,7 +166,7 @@ public class DBTraceObjectStackFrame implements TraceObjectStackFrame, DBTraceOb
|
|||
}
|
||||
|
||||
protected long snapFor(TraceChangeRecord<?, ?> rec) {
|
||||
if (rec.getEventType() == TraceObjectChangeType.VALUE_CREATED.getType()) {
|
||||
if (rec.getEventType() == TraceObjectChangeType.VALUE_CREATED.getEventType()) {
|
||||
return TraceObjectChangeType.VALUE_CREATED.cast(rec).getAffectedObject().getMinSnap();
|
||||
}
|
||||
return computeMinSnap();
|
||||
|
@ -179,18 +179,18 @@ public class DBTraceObjectStackFrame implements TraceObjectStackFrame, DBTraceOb
|
|||
|
||||
@Override
|
||||
public TraceChangeRecord<?, ?> translateEvent(TraceChangeRecord<?, ?> rec) {
|
||||
int type = rec.getEventType();
|
||||
if (type == TraceObjectChangeType.LIFE_CHANGED.getType()) {
|
||||
EventType type = rec.getEventType();
|
||||
if (type == TraceObjectChangeType.LIFE_CHANGED.getEventType()) {
|
||||
LifeSet newLife = object.getLife();
|
||||
if (!newLife.isEmpty()) {
|
||||
life = newLife;
|
||||
}
|
||||
return createChangeRecord();
|
||||
}
|
||||
else if (type == TraceObjectChangeType.VALUE_CREATED.getType() && changeApplies(rec)) {
|
||||
else if (type == TraceObjectChangeType.VALUE_CREATED.getEventType() && changeApplies(rec)) {
|
||||
return createChangeRecord();
|
||||
}
|
||||
else if (type == TraceObjectChangeType.DELETED.getType()) {
|
||||
else if (type == TraceObjectChangeType.DELETED.getEventType()) {
|
||||
if (life.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -115,7 +115,7 @@ public interface DBTraceObjectInterface extends TraceObjectInterface, TraceUniqu
|
|||
}
|
||||
|
||||
public TraceChangeRecord<?, ?> translate(TraceChangeRecord<?, ?> rec) {
|
||||
if (rec.getEventType() == TraceObjectChangeType.LIFE_CHANGED.getType()) {
|
||||
if (rec.getEventType() == TraceObjectChangeType.LIFE_CHANGED.getEventType()) {
|
||||
if (object.isDeleted()) {
|
||||
return null;
|
||||
}
|
||||
|
@ -137,7 +137,7 @@ public interface DBTraceObjectInterface extends TraceObjectInterface, TraceUniqu
|
|||
throw new AssertionError("Life changed from empty to empty?");
|
||||
}
|
||||
}
|
||||
if (rec.getEventType() == TraceObjectChangeType.VALUE_CREATED.getType()) {
|
||||
if (rec.getEventType() == TraceObjectChangeType.VALUE_CREATED.getEventType()) {
|
||||
if (object.isDeleted()) {
|
||||
return null;
|
||||
}
|
||||
|
@ -160,7 +160,7 @@ public interface DBTraceObjectInterface extends TraceObjectInterface, TraceUniqu
|
|||
cast.getNewValue());
|
||||
return new TraceChangeRecord<>(type, getSpace(life), iface, null, null);
|
||||
}
|
||||
if (rec.getEventType() == TraceObjectChangeType.DELETED.getType()) {
|
||||
if (rec.getEventType() == TraceObjectChangeType.DELETED.getEventType()) {
|
||||
return translateDeleted(life);
|
||||
}
|
||||
return null;
|
||||
|
|
|
@ -74,8 +74,7 @@ public interface Trace extends DataTypeManagerDomainObject {
|
|||
return trace != null && trace.getObjectManager().getRootSchema() == null;
|
||||
}
|
||||
|
||||
public static final class TraceObjectChangeType<T, U>
|
||||
extends DefaultTraceChangeType<T, U> {
|
||||
public static final class TraceObjectChangeType<T, U> extends DefaultTraceChangeType<T, U> {
|
||||
/**
|
||||
* An object was created, but not yet inserted.
|
||||
*
|
||||
|
|
|
@ -22,9 +22,9 @@ public class TraceDomainObjectListener extends TypedEventDispatcher
|
|||
|
||||
@Override
|
||||
public void domainObjectChanged(DomainObjectChangedEvent ev) {
|
||||
if (restoredHandler != null && ev.containsEvent(DomainObject.DO_OBJECT_RESTORED)) {
|
||||
if (restoredHandler != null && ev.contains(DomainObjectEvent.RESTORED)) {
|
||||
for (DomainObjectChangeRecord rec : ev) {
|
||||
if (rec.getEventType() == DomainObject.DO_OBJECT_RESTORED) {
|
||||
if (rec.getEventType() == DomainObjectEvent.RESTORED) {
|
||||
restoredHandler.accept(rec);
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -19,8 +19,7 @@ import java.util.HashMap;
|
|||
import java.util.Map;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
import ghidra.framework.model.DomainObject;
|
||||
import ghidra.framework.model.DomainObjectChangeRecord;
|
||||
import ghidra.framework.model.*;
|
||||
import ghidra.trace.util.*;
|
||||
|
||||
public class TypedEventDispatcher {
|
||||
|
@ -103,7 +102,7 @@ public class TypedEventDispatcher {
|
|||
}
|
||||
|
||||
private Map<TraceChangeType<?, ?>, EventRecordHandler<?, ?>> typedMap = new HashMap<>();
|
||||
private Map<Integer, Consumer<DomainObjectChangeRecord>> untypedMap = new HashMap<>();
|
||||
private Map<EventType, Consumer<DomainObjectChangeRecord>> untypedMap = new HashMap<>();
|
||||
protected Consumer<DomainObjectChangeRecord> restoredHandler = null;
|
||||
|
||||
protected <T, U> void listenFor(TraceChangeType<T, U> type, EventRecordHandler<T, U> handler) {
|
||||
|
@ -156,8 +155,8 @@ public class TypedEventDispatcher {
|
|||
typedMap.put(type, handler);
|
||||
}
|
||||
|
||||
protected void listenForUntyped(int type, Consumer<DomainObjectChangeRecord> handler) {
|
||||
if (type == DomainObject.DO_OBJECT_RESTORED) {
|
||||
protected void listenForUntyped(EventType type, Consumer<DomainObjectChangeRecord> handler) {
|
||||
if (type == DomainObjectEvent.RESTORED) {
|
||||
restoredHandler = handler;
|
||||
}
|
||||
else {
|
||||
|
@ -168,7 +167,7 @@ public class TypedEventDispatcher {
|
|||
public void handleChangeRecord(DomainObjectChangeRecord rec) {
|
||||
//String typeName = DefaultTraceChangeType.getName(rec.getEventType());
|
||||
//CountsByType.compute(typeName, (k, v) -> v == null ? 1 : v + 1);
|
||||
if (rec.getEventType() == DomainObject.DO_OBJECT_RESTORED && restoredHandler != null) {
|
||||
if (rec.getEventType() == DomainObjectEvent.RESTORED && restoredHandler != null) {
|
||||
restoredHandler.accept(rec);
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -28,10 +28,8 @@ import ghidra.framework.model.DomainObjectChangeRecord;
|
|||
* @param <U> the type of the object's attribute that changed
|
||||
*/
|
||||
public class DefaultTraceChangeType<T, U> implements TraceChangeType<T, U> {
|
||||
private static int nextType = 0x3ACE; // Stay far away from manually-assigned types
|
||||
// But not too far, since it makes the bit set for events gigantic.
|
||||
|
||||
private static final Map<Integer, String> TYPE_NAMES = new HashMap<>();
|
||||
private static final Map<TraceEventType, String> TYPE_NAMES = new HashMap<>();
|
||||
private static final Set<Field> FIELD_BACKLOG = new HashSet<>();
|
||||
|
||||
private static void procType(Field f, TraceChangeType<?, ?> type) {
|
||||
|
@ -42,7 +40,7 @@ public class DefaultTraceChangeType<T, U> implements TraceChangeType<T, U> {
|
|||
if (kind.endsWith("ChangeType")) {
|
||||
kind = kind.substring(0, kind.length() - "ChangeType".length());
|
||||
}
|
||||
TYPE_NAMES.put(type.getType(), kind + "." + f.getName());
|
||||
TYPE_NAMES.put(type.getEventType(), kind + "." + f.getName());
|
||||
}
|
||||
|
||||
private static <C extends TraceChangeType<?, ?>> void procField(Field f, Class<C> cls,
|
||||
|
@ -96,26 +94,17 @@ public class DefaultTraceChangeType<T, U> implements TraceChangeType<T, U> {
|
|||
return "TYPE_0x" + Integer.toHexString(type);
|
||||
}
|
||||
|
||||
private static int nextType() {
|
||||
return nextType++;
|
||||
}
|
||||
|
||||
private final int type;
|
||||
private final TraceEventType eventType;
|
||||
|
||||
public DefaultTraceChangeType() {
|
||||
this.type = nextType();
|
||||
this.eventType = new TraceEventType(getClass().getSimpleName());
|
||||
|
||||
scanTypeNames(getClass());
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSubType() {
|
||||
return 0;
|
||||
public TraceEventType getEventType() {
|
||||
return eventType;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
|
|
|
@ -27,7 +27,7 @@ public class TraceChangeRecord<T, U> extends DomainObjectChangeRecord {
|
|||
|
||||
public TraceChangeRecord(TraceChangeType<T, U> type, TraceAddressSpace space, T affectedObject,
|
||||
U oldValue, U newValue) {
|
||||
super(type.getType(), type.getSubType(), oldValue, newValue);
|
||||
super(type.getEventType(), oldValue, newValue);
|
||||
this.type = type;
|
||||
this.space = space;
|
||||
this.affectedObject = affectedObject;
|
||||
|
@ -36,7 +36,7 @@ public class TraceChangeRecord<T, U> extends DomainObjectChangeRecord {
|
|||
|
||||
public TraceChangeRecord(TraceChangeType<T, U> type, TraceAddressSpace space, T affectedObject,
|
||||
U newValue) {
|
||||
super(type.getType(), type.getSubType(), null, newValue);
|
||||
super(type.getEventType(), null, newValue);
|
||||
this.type = type;
|
||||
this.space = space;
|
||||
this.affectedObject = affectedObject;
|
||||
|
@ -45,7 +45,7 @@ public class TraceChangeRecord<T, U> extends DomainObjectChangeRecord {
|
|||
|
||||
public TraceChangeRecord(TraceChangeType<T, U> type, TraceAddressSpace space,
|
||||
T affectedObject) {
|
||||
super(type.getType(), type.getSubType(), null, null);
|
||||
super(type.getEventType(), null, null);
|
||||
this.type = type;
|
||||
this.space = space;
|
||||
this.affectedObject = affectedObject;
|
||||
|
@ -53,7 +53,7 @@ public class TraceChangeRecord<T, U> extends DomainObjectChangeRecord {
|
|||
}
|
||||
|
||||
public TraceChangeRecord(TraceChangeType<T, U> type, TraceAddressSpace space) {
|
||||
super(type.getType(), type.getSubType(), null, null);
|
||||
super(type.getEventType(), null, null);
|
||||
this.type = type;
|
||||
this.space = space;
|
||||
this.affectedObject = null;
|
||||
|
|
|
@ -16,7 +16,5 @@
|
|||
package ghidra.trace.util;
|
||||
|
||||
public interface TraceChangeType<T, U> {
|
||||
int getType();
|
||||
|
||||
int getSubType();
|
||||
TraceEventType getEventType();
|
||||
}
|
||||
|
|
|
@ -0,0 +1,45 @@
|
|||
/* ###
|
||||
* IP: GHIDRA
|
||||
*
|
||||
* 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.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package ghidra.trace.util;
|
||||
|
||||
import ghidra.framework.model.DomainObjectEventIdGenerator;
|
||||
import ghidra.framework.model.EventType;
|
||||
|
||||
/**
|
||||
* EventTypes for trace events. This implementation exists because trace event types are not
|
||||
* currently structured as enums. This current implementation will not give a very good toString as
|
||||
* its actual event name is unknown, so it uses its event category class + its actual assigned
|
||||
* numerical id.
|
||||
*/
|
||||
public class TraceEventType implements EventType {
|
||||
|
||||
private final int id = DomainObjectEventIdGenerator.next();
|
||||
private String name;
|
||||
|
||||
TraceEventType(String name) {
|
||||
this.name = name + "(" + id + ")";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return name;
|
||||
}
|
||||
}
|
|
@ -23,7 +23,7 @@ import ghidra.framework.model.*;
|
|||
import ghidra.framework.plugintool.ComponentProviderAdapter;
|
||||
import ghidra.program.model.address.AddressSet;
|
||||
import ghidra.program.model.listing.Program;
|
||||
import ghidra.program.util.ChangeManager;
|
||||
import ghidra.program.util.ProgramEvent;
|
||||
import ghidra.util.HelpLocation;
|
||||
import ghidra.util.table.*;
|
||||
|
||||
|
@ -84,26 +84,28 @@ public class FunctionStartTableProvider extends ProgramAssociatedComponentProvid
|
|||
if (!isVisible()) {
|
||||
return;
|
||||
}
|
||||
if (ev.containsEvent(DomainObject.DO_OBJECT_RESTORED)) {
|
||||
if (ev.contains(DomainObjectEvent.RESTORED)) {
|
||||
model.reload();
|
||||
contextChanged();
|
||||
}
|
||||
for (int i = 0; i < ev.numRecords(); ++i) {
|
||||
DomainObjectChangeRecord doRecord = ev.getChangeRecord(i);
|
||||
int eventType = doRecord.getEventType();
|
||||
switch (eventType) {
|
||||
case ChangeManager.DOCR_FUNCTION_ADDED:
|
||||
case ChangeManager.DOCR_FUNCTION_REMOVED:
|
||||
case ChangeManager.DOCR_CODE_ADDED:
|
||||
case ChangeManager.DOCR_CODE_REMOVED:
|
||||
case ChangeManager.DOCR_CODE_REPLACED:
|
||||
case ChangeManager.DOCR_MEM_REF_TYPE_CHANGED:
|
||||
case ChangeManager.DOCR_MEM_REFERENCE_ADDED:
|
||||
case ChangeManager.DOCR_MEM_REFERENCE_REMOVED:
|
||||
model.reload();
|
||||
contextChanged();
|
||||
default:
|
||||
break;
|
||||
EventType eventType = doRecord.getEventType();
|
||||
if (eventType instanceof ProgramEvent type) {
|
||||
switch (type) {
|
||||
case FUNCTION_ADDED:
|
||||
case FUNCTION_REMOVED:
|
||||
case CODE_ADDED:
|
||||
case CODE_REMOVED:
|
||||
case CODE_REPLACED:
|
||||
case REFERENCE_TYPE_CHANGED:
|
||||
case REFERENCE_ADDED:
|
||||
case REFERENCE_REMOVED:
|
||||
model.reload();
|
||||
contextChanged();
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,6 +15,9 @@
|
|||
*/
|
||||
package ghidra.features.bsim.gui.search.results;
|
||||
|
||||
import static ghidra.framework.model.DomainObjectEvent.*;
|
||||
import static ghidra.program.util.ProgramEvent.*;
|
||||
|
||||
import java.awt.*;
|
||||
import java.awt.event.MouseEvent;
|
||||
import java.net.MalformedURLException;
|
||||
|
@ -44,13 +47,13 @@ import ghidra.features.bsim.query.description.*;
|
|||
import ghidra.features.bsim.query.facade.SFQueryInfo;
|
||||
import ghidra.features.bsim.query.facade.SFQueryResult;
|
||||
import ghidra.features.bsim.query.protocol.BSimFilter;
|
||||
import ghidra.framework.model.*;
|
||||
import ghidra.framework.model.DomainObjectChangedEvent;
|
||||
import ghidra.framework.model.DomainObjectListener;
|
||||
import ghidra.framework.plugintool.ComponentProviderAdapter;
|
||||
import ghidra.framework.plugintool.PluginTool;
|
||||
import ghidra.program.database.symbol.FunctionSymbol;
|
||||
import ghidra.program.model.address.Address;
|
||||
import ghidra.program.model.listing.*;
|
||||
import ghidra.program.util.ChangeManager;
|
||||
import ghidra.util.HelpLocation;
|
||||
import ghidra.util.Msg;
|
||||
import ghidra.util.datastruct.Counter;
|
||||
|
@ -582,12 +585,9 @@ public class BSimSearchResultsProvider extends ComponentProviderAdapter {
|
|||
|
||||
@Override
|
||||
public void domainObjectChanged(DomainObjectChangedEvent ev) {
|
||||
if (ev.containsEvent(ChangeManager.DOCR_SYMBOL_RENAMED) ||
|
||||
ev.containsEvent(DomainObject.DO_OBJECT_RESTORED)) {
|
||||
if (ev.contains(SYMBOL_RENAMED, RESTORED)) {
|
||||
matchesModel.fireTableDataChanged();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,21 +15,21 @@
|
|||
*/
|
||||
package ghidra.app.merge;
|
||||
|
||||
import java.rmi.NoSuchObjectException;
|
||||
|
||||
import javax.swing.JComponent;
|
||||
|
||||
import ghidra.framework.main.ProgramaticUseOnly;
|
||||
import ghidra.framework.model.*;
|
||||
import ghidra.framework.plugintool.*;
|
||||
import ghidra.program.model.listing.Program;
|
||||
import ghidra.util.Msg;
|
||||
|
||||
import java.rmi.NoSuchObjectException;
|
||||
|
||||
import javax.swing.JComponent;
|
||||
|
||||
/**
|
||||
* Plugin that provides a merge component provider.
|
||||
*/
|
||||
public abstract class MergeManagerPlugin extends Plugin implements ProgramaticUseOnly,
|
||||
DomainObjectListener {
|
||||
public abstract class MergeManagerPlugin extends Plugin
|
||||
implements ProgramaticUseOnly, DomainObjectListener {
|
||||
|
||||
protected MergeManager mergeManager;
|
||||
protected MergeManagerProvider provider;
|
||||
|
@ -180,21 +180,19 @@ public abstract class MergeManagerPlugin extends Plugin implements ProgramaticUs
|
|||
public void domainObjectChanged(DomainObjectChangedEvent ev) {
|
||||
// Only concerned about error which will be the only change record
|
||||
DomainObjectChangeRecord docr = ev.getChangeRecord(0);
|
||||
if (!domainFileErrorOccurred && docr.getEventType() == DomainObject.DO_OBJECT_ERROR) {
|
||||
if (!domainFileErrorOccurred && docr.getEventType() == DomainObjectEvent.ERROR) {
|
||||
domainFileErrorOccurred = true;
|
||||
String msg;
|
||||
Throwable t = (Throwable) docr.getNewValue();
|
||||
if (t instanceof NoSuchObjectException) {
|
||||
msg =
|
||||
"Merge is closing due to an unrecoverable error!"
|
||||
+ "\nThis error can be caused when your system becomes"
|
||||
+ "\nsuspended or due to a server/network problem.";
|
||||
msg = "Merge is closing due to an unrecoverable error!" +
|
||||
"\nThis error can be caused when your system becomes" +
|
||||
"\nsuspended or due to a server/network problem.";
|
||||
}
|
||||
else {
|
||||
msg =
|
||||
"Merge is closing due to an unrecoverable error!"
|
||||
+ "\n \nSuch failures are generally due to an IO Error caused"
|
||||
+ "\nby the local filesystem or server.";
|
||||
msg = "Merge is closing due to an unrecoverable error!" +
|
||||
"\n \nSuch failures are generally due to an IO Error caused" +
|
||||
"\nby the local filesystem or server.";
|
||||
}
|
||||
|
||||
//abort();
|
||||
|
|
|
@ -346,21 +346,6 @@ public class AutoAnalysisManager implements DomainObjectListener {
|
|||
debugOn = b;
|
||||
}
|
||||
|
||||
private boolean isFunctionModifierChange(ProgramChangeRecord functionChangeRecord) {
|
||||
int subType = functionChangeRecord.getSubEventType();
|
||||
return subType == ChangeManager.FUNCTION_CHANGED_THUNK ||
|
||||
subType == ChangeManager.FUNCTION_CHANGED_INLINE ||
|
||||
subType == ChangeManager.FUNCTION_CHANGED_NORETURN ||
|
||||
subType == ChangeManager.FUNCTION_CHANGED_CALL_FIXUP ||
|
||||
subType == ChangeManager.FUNCTION_CHANGED_PURGE;
|
||||
}
|
||||
|
||||
private boolean isFunctionSignatureChange(ProgramChangeRecord functionChangeRecord) {
|
||||
int subType = functionChangeRecord.getSubEventType();
|
||||
return subType == ChangeManager.FUNCTION_CHANGED_PARAMETERS ||
|
||||
subType == ChangeManager.FUNCTION_CHANGED_RETURN;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void domainObjectChanged(DomainObjectChangedEvent ev) {
|
||||
if (program == null) {
|
||||
|
@ -380,97 +365,97 @@ public class AutoAnalysisManager implements DomainObjectListener {
|
|||
boolean optionsChanged = false;
|
||||
for (int i = 0; i < eventCnt; ++i) {
|
||||
DomainObjectChangeRecord doRecord = ev.getChangeRecord(i);
|
||||
if (doRecord.getEventType() == ChangeManager.DOCR_LANGUAGE_CHANGED) {
|
||||
if (doRecord.getEventType() == ProgramEvent.LANGUAGE_CHANGED) {
|
||||
initializeAnalyzers();
|
||||
}
|
||||
|
||||
int eventType = doRecord.getEventType();
|
||||
ProgramChangeRecord pcr;
|
||||
|
||||
switch (eventType) {
|
||||
case DomainObject.DO_OBJECT_RESTORED:
|
||||
case DomainObject.DO_PROPERTY_CHANGED:
|
||||
if (!optionsChanged) {
|
||||
initializeOptions();
|
||||
Preferences.store();
|
||||
optionsChanged = true;
|
||||
}
|
||||
break;
|
||||
// TODO: Add Symbol analyzer type
|
||||
// case ChangeManager.DOCR_SYMBOL_ADDED:
|
||||
// case ChangeManager.DOCR_SYMBOL_RENAMED:
|
||||
// pcr = (ProgramChangeRecord) doRecord;
|
||||
// // if a function is created using the current name, don't throw symbol added/renamed
|
||||
// // split variable changed/added from SYMBOL added - change record is already different
|
||||
// if (pcr.getObject() != null && pcr.getObject() instanceof VariableSymbolDB) {
|
||||
EventType eventType = doRecord.getEventType();
|
||||
if (eventType == DomainObjectEvent.RESTORED ||
|
||||
eventType == DomainObjectEvent.PROPERTY_CHANGED) {
|
||||
if (!optionsChanged) {
|
||||
initializeOptions();
|
||||
Preferences.store();
|
||||
optionsChanged = true;
|
||||
}
|
||||
}
|
||||
else if (eventType instanceof ProgramEvent pe) {
|
||||
ProgramChangeRecord pcr = (ProgramChangeRecord) doRecord;
|
||||
switch (pe) {
|
||||
case FUNCTION_CHANGED:
|
||||
FunctionChangeRecord fcr = (FunctionChangeRecord) doRecord;
|
||||
Address entry = fcr.getFunction().getEntryPoint();
|
||||
if (fcr.isFunctionSignatureChange()) {
|
||||
functionSignatureChanged(entry);
|
||||
}
|
||||
else if (fcr.isFunctionModifierChange()) {
|
||||
functionModifierChanged(entry);
|
||||
}
|
||||
break;
|
||||
case FUNCTION_ADDED:
|
||||
case FUNCTION_BODY_CHANGED:
|
||||
Function func = (Function) pcr.getObject();
|
||||
if (!func.isExternal()) {
|
||||
functionDefined(func.getEntryPoint());
|
||||
}
|
||||
break;
|
||||
case FUNCTION_REMOVED:
|
||||
Address oldEntry = pcr.getStart();
|
||||
functionTasks.notifyRemoved(oldEntry);
|
||||
break;
|
||||
case FALLTHROUGH_CHANGED:
|
||||
case FLOW_OVERRIDE_CHANGED:
|
||||
case LENGTH_OVERRIDE_CHANGED:
|
||||
// TODO: not sure if this should be done this way or explicitly
|
||||
// via the application commands (this is inconsistent with other
|
||||
// codeDefined cases which do not rely on change events (e.g., disassembly)
|
||||
codeDefined(new AddressSet(pcr.getStart()));
|
||||
break;
|
||||
// FIXME: must resolve cyclic issues before this can be done
|
||||
// case MEM_REFERENCE_ADDED:
|
||||
// // Allow high-priority reference-driven code analyzers a
|
||||
// // shot at processing computed flows determined during
|
||||
// // constant propagation.
|
||||
// pcr = (ProgramChangeRecord) doRecord;
|
||||
// Reference ref = (Reference) pcr.getNewValue();
|
||||
// RefType refType = ref.getReferenceType();
|
||||
// if (refType.isComputed()) {
|
||||
// codeDefined(ref.getFromAddress());
|
||||
// }
|
||||
// break;
|
||||
// }
|
||||
// Symbol sym = null;
|
||||
// Object newValue = pcr.getNewValue();
|
||||
// if (newValue != null && newValue instanceof Symbol) {
|
||||
// sym = (Symbol) newValue;
|
||||
// } else if (pcr.getObject() != null && pcr.getObject() instanceof Symbol) {
|
||||
// sym = (Symbol) pcr.getObject();
|
||||
// }
|
||||
// if (sym == null) {
|
||||
// break;
|
||||
// }
|
||||
// SymbolType symbolType = sym.getSymbolType();
|
||||
// if ((symbolType == SymbolType.CODE || symbolType == SymbolType.FUNCTION) && sym.getSource() != SourceType.DEFAULT) {
|
||||
// symbolTasks.notifyAdded(sym.getAddress());
|
||||
// }
|
||||
// break;
|
||||
case ChangeManager.DOCR_FUNCTION_CHANGED:
|
||||
pcr = (ProgramChangeRecord) doRecord;
|
||||
Function func = (Function) pcr.getObject();
|
||||
if (isFunctionSignatureChange(pcr)) {
|
||||
functionSignatureChanged(func.getEntryPoint());
|
||||
}
|
||||
else if (isFunctionModifierChange(pcr)) {
|
||||
functionModifierChanged(func.getEntryPoint());
|
||||
}
|
||||
break;
|
||||
case ChangeManager.DOCR_FUNCTION_ADDED:
|
||||
case ChangeManager.DOCR_FUNCTION_BODY_CHANGED:
|
||||
pcr = (ProgramChangeRecord) doRecord;
|
||||
func = (Function) pcr.getObject();
|
||||
if (!func.isExternal()) {
|
||||
functionDefined(func.getEntryPoint());
|
||||
}
|
||||
break;
|
||||
case ChangeManager.DOCR_FUNCTION_REMOVED:
|
||||
pcr = (ProgramChangeRecord) doRecord;
|
||||
Address oldEntry = pcr.getStart();
|
||||
functionTasks.notifyRemoved(oldEntry);
|
||||
break;
|
||||
case ChangeManager.DOCR_FALLTHROUGH_CHANGED:
|
||||
case ChangeManager.DOCR_FLOWOVERRIDE_CHANGED:
|
||||
case ChangeManager.DOCR_LENGTH_OVERRIDE_CHANGED:
|
||||
// TODO: not sure if this should be done this way or explicitly
|
||||
// via the application commands (this is inconsistent with other
|
||||
// codeDefined cases which do not rely on change events (e.g., disassembly)
|
||||
pcr = (ProgramChangeRecord) doRecord;
|
||||
codeDefined(new AddressSet(pcr.getStart()));
|
||||
break;
|
||||
// FIXME: must resolve cyclic issues before this can be done
|
||||
// case ChangeManager.DOCR_MEM_REFERENCE_ADDED:
|
||||
// // Allow high-priority reference-driven code analyzers a
|
||||
// // shot at processing computed flows determined during
|
||||
// // constant propagation.
|
||||
// pcr = (ProgramChangeRecord) doRecord;
|
||||
// Reference ref = (Reference) pcr.getNewValue();
|
||||
// RefType refType = ref.getReferenceType();
|
||||
// if (refType.isComputed()) {
|
||||
// codeDefined(ref.getFromAddress());
|
||||
// }
|
||||
// break;
|
||||
case ChangeManager.DOCR_CODE_ADDED:
|
||||
pcr = (ProgramChangeRecord) doRecord;
|
||||
if (pcr.getNewValue() instanceof Data) {
|
||||
AddressSet addressSet = new AddressSet(pcr.getStart(), pcr.getEnd());
|
||||
dataDefined(addressSet);
|
||||
}
|
||||
break;
|
||||
case CODE_ADDED:
|
||||
if (pcr.getNewValue() instanceof Data) {
|
||||
AddressSet addressSet = new AddressSet(pcr.getStart(), pcr.getEnd());
|
||||
dataDefined(addressSet);
|
||||
}
|
||||
break;
|
||||
// TODO: Add Symbol analyzer type
|
||||
// case SYMBOL_ADDED:
|
||||
// case SYMBOL_RENAMED:
|
||||
// pcr = (ProgramChangeRecord) doRecord;
|
||||
// // if a function is created using the current name, don't throw symbol added/renamed
|
||||
// // split variable changed/added from SYMBOL added - change record is already different
|
||||
// if (pcr.getObject() != null &&
|
||||
// pcr.getObject() instanceof VariableSymbolDB) {
|
||||
// break;
|
||||
// }
|
||||
// Symbol sym = null;
|
||||
// Object newValue = pcr.getNewValue();
|
||||
// if (newValue != null && newValue instanceof Symbol) {
|
||||
// sym = (Symbol) newValue;
|
||||
// }
|
||||
// else if (pcr.getObject() != null && pcr.getObject() instanceof Symbol) {
|
||||
// sym = (Symbol) pcr.getObject();
|
||||
// }
|
||||
// if (sym == null) {
|
||||
// break;
|
||||
// }
|
||||
// SymbolType symbolType = sym.getSymbolType();
|
||||
// if ((symbolType == SymbolType.CODE || symbolType == SymbolType.FUNCTION) &&
|
||||
// sym.getSource() != SourceType.DEFAULT) {
|
||||
// symbolTasks.notifyAdded(sym.getAddress());
|
||||
// }
|
||||
// break;
|
||||
default:
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,6 +15,9 @@
|
|||
*/
|
||||
package ghidra.app.plugin.core.bookmark;
|
||||
|
||||
import static ghidra.framework.model.DomainObjectEvent.*;
|
||||
import static ghidra.program.util.ProgramEvent.*;
|
||||
|
||||
import java.awt.event.KeyEvent;
|
||||
import java.util.*;
|
||||
|
||||
|
@ -166,8 +169,8 @@ public class BookmarkPlugin extends ProgramPlugin
|
|||
}
|
||||
};
|
||||
icon = new GIcon("icon.plugin.bookmark.select");
|
||||
selectionAction.setPopupMenuData(
|
||||
new MenuData(new String[] { "Select Bookmark Locations" }, icon));
|
||||
selectionAction
|
||||
.setPopupMenuData(new MenuData(new String[] { "Select Bookmark Locations" }, icon));
|
||||
selectionAction.setToolBarData(new ToolBarData(icon));
|
||||
selectionAction.setEnabled(true);
|
||||
tool.addLocalAction(provider, selectionAction);
|
||||
|
@ -294,57 +297,45 @@ public class BookmarkPlugin extends ProgramPlugin
|
|||
}
|
||||
|
||||
@Override
|
||||
public synchronized void domainObjectChanged(DomainObjectChangedEvent ev) {
|
||||
public synchronized void domainObjectChanged(DomainObjectChangedEvent event) {
|
||||
|
||||
if (ev.containsEvent(DomainObject.DO_OBJECT_RESTORED) ||
|
||||
ev.containsEvent(ChangeManager.DOCR_MEMORY_BLOCK_MOVED) ||
|
||||
ev.containsEvent(ChangeManager.DOCR_MEMORY_BLOCK_REMOVED)) {
|
||||
if (event.contains(RESTORED, MEMORY_BLOCK_MOVED, MEMORY_BLOCK_REMOVED)) {
|
||||
scheduleUpdate(null);
|
||||
provider.reload();
|
||||
return;
|
||||
}
|
||||
if (!event.contains(BOOKMARK_REMOVED, BOOKMARK_ADDED, BOOKMARK_CHANGED, BOOKMARK_TYPE_ADDED,
|
||||
BOOKMARK_TYPE_REMOVED)) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (int i = 0; i < ev.numRecords(); i++) {
|
||||
DomainObjectChangeRecord record = ev.getChangeRecord(i);
|
||||
for (int i = 0; i < event.numRecords(); i++) {
|
||||
DomainObjectChangeRecord record = event.getChangeRecord(i);
|
||||
|
||||
int eventType = record.getEventType();
|
||||
if (!(record instanceof ProgramChangeRecord)) {
|
||||
EventType eventType = record.getEventType();
|
||||
if (!(record instanceof ProgramChangeRecord rec)) {
|
||||
continue;
|
||||
}
|
||||
switch (eventType) {
|
||||
|
||||
case ChangeManager.DOCR_BOOKMARK_REMOVED: {
|
||||
ProgramChangeRecord rec = (ProgramChangeRecord) ev.getChangeRecord(i);
|
||||
Bookmark bookmark = (Bookmark) rec.getObject();
|
||||
bookmarkRemoved(bookmark);
|
||||
break;
|
||||
if (eventType instanceof ProgramEvent ev) {
|
||||
switch (ev) {
|
||||
case BOOKMARK_REMOVED:
|
||||
bookmarkRemoved((Bookmark) rec.getObject());
|
||||
break;
|
||||
case BOOKMARK_ADDED:
|
||||
bookmarkAdded((Bookmark) rec.getObject());
|
||||
break;
|
||||
case BOOKMARK_CHANGED:
|
||||
bookmarkChanged((Bookmark) rec.getObject());
|
||||
break;
|
||||
case BOOKMARK_TYPE_ADDED:
|
||||
BookmarkType bookmarkType = (BookmarkType) rec.getObject();
|
||||
if (bookmarkType != null) {
|
||||
typeAdded(bookmarkType.getTypeString());
|
||||
}
|
||||
break;
|
||||
default:
|
||||
repaintMgr.update();
|
||||
}
|
||||
|
||||
case ChangeManager.DOCR_BOOKMARK_ADDED: {
|
||||
ProgramChangeRecord rec = (ProgramChangeRecord) ev.getChangeRecord(i);
|
||||
Bookmark bookmark = (Bookmark) rec.getObject();
|
||||
bookmarkAdded(bookmark);
|
||||
break;
|
||||
}
|
||||
|
||||
case ChangeManager.DOCR_BOOKMARK_CHANGED: {
|
||||
ProgramChangeRecord rec = (ProgramChangeRecord) ev.getChangeRecord(i);
|
||||
Bookmark bookmark = (Bookmark) rec.getObject();
|
||||
bookmarkChanged(bookmark);
|
||||
break;
|
||||
}
|
||||
|
||||
case ChangeManager.DOCR_BOOKMARK_TYPE_ADDED: {
|
||||
ProgramChangeRecord rec = (ProgramChangeRecord) ev.getChangeRecord(i);
|
||||
BookmarkType bookmarkType = (BookmarkType) rec.getObject();
|
||||
if (bookmarkType != null) {
|
||||
typeAdded(bookmarkType.getTypeString());
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
repaintMgr.update();
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,6 +15,8 @@
|
|||
*/
|
||||
package ghidra.app.plugin.core.calltree;
|
||||
|
||||
import static ghidra.framework.model.DomainObjectEvent.*;
|
||||
|
||||
import java.awt.*;
|
||||
import java.awt.event.*;
|
||||
import java.util.List;
|
||||
|
@ -1052,39 +1054,42 @@ public class CallTreeProvider extends ComponentProviderAdapter implements Domain
|
|||
return; // nothing to update
|
||||
}
|
||||
|
||||
if (event.containsEvent(DomainObject.DO_OBJECT_RESTORED)) {
|
||||
if (event.contains(RESTORED)) {
|
||||
setStale(true);
|
||||
return;
|
||||
}
|
||||
|
||||
for (int i = 0; i < event.numRecords(); i++) {
|
||||
DomainObjectChangeRecord domainObjectRecord = event.getChangeRecord(i);
|
||||
int eventType = domainObjectRecord.getEventType();
|
||||
|
||||
switch (eventType) {
|
||||
case ChangeManager.DOCR_MEMORY_BLOCK_MOVED:
|
||||
case ChangeManager.DOCR_MEMORY_BLOCK_REMOVED:
|
||||
case ChangeManager.DOCR_SYMBOL_ADDED:
|
||||
case ChangeManager.DOCR_SYMBOL_REMOVED:
|
||||
case ChangeManager.DOCR_MEM_REFERENCE_ADDED:
|
||||
case ChangeManager.DOCR_MEM_REFERENCE_REMOVED:
|
||||
setStale(true);
|
||||
break;
|
||||
case ChangeManager.DOCR_SYMBOL_RENAMED:
|
||||
Symbol symbol = (Symbol) ((ProgramChangeRecord) domainObjectRecord).getObject();
|
||||
if (!(symbol instanceof FunctionSymbol)) {
|
||||
EventType eventType = domainObjectRecord.getEventType();
|
||||
if (eventType instanceof ProgramEvent type) {
|
||||
switch (type) {
|
||||
case MEMORY_BLOCK_MOVED:
|
||||
case MEMORY_BLOCK_REMOVED:
|
||||
case SYMBOL_ADDED:
|
||||
case SYMBOL_REMOVED:
|
||||
case REFERENCE_ADDED:
|
||||
case REFERENCE_REMOVED:
|
||||
setStale(true);
|
||||
break;
|
||||
}
|
||||
case SYMBOL_RENAMED:
|
||||
Symbol symbol =
|
||||
(Symbol) ((ProgramChangeRecord) domainObjectRecord).getObject();
|
||||
if (!(symbol instanceof FunctionSymbol)) {
|
||||
break;
|
||||
}
|
||||
|
||||
FunctionSymbol functionSymbol = (FunctionSymbol) symbol;
|
||||
Function function = (Function) functionSymbol.getObject();
|
||||
if (updateRootNodes(function)) {
|
||||
return; // the entire tree will be rebuilt
|
||||
}
|
||||
FunctionSymbol functionSymbol = (FunctionSymbol) symbol;
|
||||
Function function = (Function) functionSymbol.getObject();
|
||||
if (updateRootNodes(function)) {
|
||||
return; // the entire tree will be rebuilt
|
||||
}
|
||||
|
||||
incomingTree.runTask(new UpdateFunctionNodeTask(incomingTree, function));
|
||||
outgoingTree.runTask(new UpdateFunctionNodeTask(outgoingTree, function));
|
||||
break;
|
||||
incomingTree.runTask(new UpdateFunctionNodeTask(incomingTree, function));
|
||||
outgoingTree.runTask(new UpdateFunctionNodeTask(outgoingTree, function));
|
||||
break;
|
||||
default:
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -870,14 +870,14 @@ public abstract class AbstractCodeBrowserPlugin<P extends CodeViewerProvider> ex
|
|||
|
||||
@Override
|
||||
public void domainObjectChanged(DomainObjectChangedEvent ev) {
|
||||
if (ev.containsEvent(DomainObject.DO_DOMAIN_FILE_CHANGED)) {
|
||||
if (ev.contains(DomainObjectEvent.FILE_CHANGED)) {
|
||||
connectedProvider.updateTitle();
|
||||
}
|
||||
|
||||
if (viewManager != null) {
|
||||
return;
|
||||
}
|
||||
if (ev.containsEvent(DomainObject.DO_OBJECT_RESTORED)) {
|
||||
if (ev.contains(DomainObjectEvent.RESTORED)) {
|
||||
viewChanged(currentProgram.getMemory());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,6 +15,8 @@
|
|||
*/
|
||||
package ghidra.app.plugin.core.colorizer;
|
||||
|
||||
import static ghidra.program.util.ProgramEvent.*;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
@ -40,7 +42,6 @@ import ghidra.framework.plugintool.PluginTool;
|
|||
import ghidra.framework.plugintool.util.PluginStatus;
|
||||
import ghidra.program.model.address.*;
|
||||
import ghidra.program.model.listing.Program;
|
||||
import ghidra.program.util.ChangeManager;
|
||||
import ghidra.program.util.ProgramSelection;
|
||||
import ghidra.util.ColorUtils;
|
||||
import ghidra.util.HelpLocation;
|
||||
|
@ -266,8 +267,9 @@ public class ColorizingPlugin extends ProgramPlugin implements DomainObjectListe
|
|||
return !set.isEmpty();
|
||||
}
|
||||
};
|
||||
clearAllAction.setPopupMenuData(new MenuData(new String[] { MENU_PULLRIGHT,
|
||||
"Clear All Colors" }, null, group, MenuData.NO_MNEMONIC, Integer.toString(subgroup++)));
|
||||
clearAllAction
|
||||
.setPopupMenuData(new MenuData(new String[] { MENU_PULLRIGHT, "Clear All Colors" },
|
||||
null, group, MenuData.NO_MNEMONIC, Integer.toString(subgroup++)));
|
||||
clearAllAction.setHelpLocation(helpLocation);
|
||||
|
||||
//
|
||||
|
@ -299,9 +301,8 @@ public class ColorizingPlugin extends ProgramPlugin implements DomainObjectListe
|
|||
|
||||
@Override
|
||||
public void domainObjectChanged(DomainObjectChangedEvent ev) {
|
||||
if (ev.containsEvent(ChangeManager.DOCR_INT_ADDRESS_SET_PROPERTY_MAP_ADDED) ||
|
||||
ev.containsEvent(ChangeManager.DOCR_INT_ADDRESS_SET_PROPERTY_MAP_REMOVED) ||
|
||||
ev.containsEvent(ChangeManager.DOCR_INT_ADDRESS_SET_PROPERTY_MAP_CHANGED)) {
|
||||
if (ev.contains(INT_PROPERTY_MAP_ADDED, INT_PROPERTY_MAP_REMOVED,
|
||||
INT_PROPERTY_MAP_CHANGED)) {
|
||||
updateManager.update();
|
||||
}
|
||||
}
|
||||
|
@ -340,9 +341,8 @@ public class ColorizingPlugin extends ProgramPlugin implements DomainObjectListe
|
|||
color = MARKER_COLOR;
|
||||
}
|
||||
|
||||
markerSet =
|
||||
markerService.createPointMarker(MARKER_NAME, MARKER_DESCRIPTION, currentProgram,
|
||||
PRIORITY, false, true, false, color, null);
|
||||
markerSet = markerService.createPointMarker(MARKER_NAME, MARKER_DESCRIPTION,
|
||||
currentProgram, PRIORITY, false, true, false, color, null);
|
||||
}
|
||||
else {
|
||||
markerSet.clearAll();
|
||||
|
|
|
@ -15,20 +15,24 @@
|
|||
*/
|
||||
package ghidra.app.plugin.core.commentwindow;
|
||||
|
||||
import static ghidra.framework.model.DomainObjectEvent.*;
|
||||
import static ghidra.program.util.ProgramEvent.*;
|
||||
|
||||
import docking.action.DockingAction;
|
||||
import ghidra.app.CorePluginPackage;
|
||||
import ghidra.app.events.ProgramSelectionPluginEvent;
|
||||
import ghidra.app.plugin.PluginCategoryNames;
|
||||
import ghidra.app.plugin.ProgramPlugin;
|
||||
import ghidra.app.services.GoToService;
|
||||
import ghidra.framework.model.*;
|
||||
import ghidra.framework.model.DomainObjectChangedEvent;
|
||||
import ghidra.framework.model.DomainObjectListener;
|
||||
import ghidra.framework.plugintool.PluginInfo;
|
||||
import ghidra.framework.plugintool.PluginTool;
|
||||
import ghidra.framework.plugintool.util.PluginStatus;
|
||||
import ghidra.program.model.address.Address;
|
||||
import ghidra.program.model.listing.CodeUnit;
|
||||
import ghidra.program.model.listing.Program;
|
||||
import ghidra.program.util.*;
|
||||
import ghidra.program.util.CommentChangeRecord;
|
||||
import ghidra.program.util.ProgramSelection;
|
||||
import ghidra.util.table.SelectionNavigationAction;
|
||||
import ghidra.util.table.actions.MakeProgramSelectionAction;
|
||||
import ghidra.util.task.SwingUpdateManager;
|
||||
|
@ -78,81 +82,38 @@ public class CommentWindowPlugin extends ProgramPlugin implements DomainObjectLi
|
|||
super.dispose();
|
||||
}
|
||||
|
||||
private int getCommentType(int type) {
|
||||
if (type == ChangeManager.DOCR_PRE_COMMENT_CHANGED) {
|
||||
return CodeUnit.PRE_COMMENT;
|
||||
}
|
||||
if (type == ChangeManager.DOCR_POST_COMMENT_CHANGED) {
|
||||
return CodeUnit.POST_COMMENT;
|
||||
}
|
||||
if (type == ChangeManager.DOCR_EOL_COMMENT_CHANGED) {
|
||||
return CodeUnit.EOL_COMMENT;
|
||||
}
|
||||
if (type == ChangeManager.DOCR_PLATE_COMMENT_CHANGED) {
|
||||
return CodeUnit.PLATE_COMMENT;
|
||||
}
|
||||
if ((type == ChangeManager.DOCR_REPEATABLE_COMMENT_CHANGED) ||
|
||||
(type == ChangeManager.DOCR_REPEATABLE_COMMENT_ADDED) ||
|
||||
(type == ChangeManager.DOCR_REPEATABLE_COMMENT_REMOVED) ||
|
||||
(type == ChangeManager.DOCR_REPEATABLE_COMMENT_CREATED) ||
|
||||
(type == ChangeManager.DOCR_REPEATABLE_COMMENT_DELETED)) {
|
||||
return CodeUnit.REPEATABLE_COMMENT;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void domainObjectChanged(DomainObjectChangedEvent ev) {
|
||||
|
||||
// reload the table if an undo/redo or clear code with options event happens (it isn't the
|
||||
// same as a delete comment)
|
||||
if (ev.containsEvent(DomainObject.DO_OBJECT_RESTORED) ||
|
||||
ev.containsEvent(ChangeManager.DOCR_CODE_REMOVED)) {
|
||||
if (ev.contains(RESTORED, CODE_REMOVED)) {
|
||||
reload();
|
||||
return;
|
||||
}
|
||||
|
||||
// check for and handle commend added, comment deleted, and comment changed events
|
||||
if (ev.containsEvent(ChangeManager.DOCR_PRE_COMMENT_CHANGED) ||
|
||||
ev.containsEvent(ChangeManager.DOCR_POST_COMMENT_CHANGED) ||
|
||||
ev.containsEvent(ChangeManager.DOCR_EOL_COMMENT_CHANGED) ||
|
||||
ev.containsEvent(ChangeManager.DOCR_PLATE_COMMENT_CHANGED) ||
|
||||
ev.containsEvent(ChangeManager.DOCR_REPEATABLE_COMMENT_CHANGED) ||
|
||||
ev.containsEvent(ChangeManager.DOCR_REPEATABLE_COMMENT_ADDED) ||
|
||||
ev.containsEvent(ChangeManager.DOCR_REPEATABLE_COMMENT_REMOVED) ||
|
||||
ev.containsEvent(ChangeManager.DOCR_REPEATABLE_COMMENT_CREATED) ||
|
||||
ev.containsEvent(ChangeManager.DOCR_REPEATABLE_COMMENT_ADDED) ||
|
||||
ev.containsEvent(ChangeManager.DOCR_REPEATABLE_COMMENT_DELETED)) {
|
||||
ev.forEach(COMMENT_CHANGED, r -> {
|
||||
CommentChangeRecord ccr = (CommentChangeRecord) r;
|
||||
int commentType = ccr.getCommentType();
|
||||
String oldComment = ccr.getOldComment();
|
||||
String newComment = ccr.getNewComment();
|
||||
Address commentAddress = ccr.getStart();
|
||||
|
||||
for (DomainObjectChangeRecord record : ev) {
|
||||
|
||||
int type = record.getEventType();
|
||||
int commentType = getCommentType(type);
|
||||
if (commentType == -1) {
|
||||
continue;
|
||||
}
|
||||
|
||||
ProgramChangeRecord pRec = (ProgramChangeRecord) record;
|
||||
|
||||
String oldComment = (String) pRec.getOldValue();
|
||||
String newComment = (String) pRec.getNewValue();
|
||||
Address commentAddress = pRec.getStart();
|
||||
|
||||
// if old comment is null then the change is an add comment so add the comment to the table
|
||||
if (oldComment == null) {
|
||||
provider.commentAdded(commentAddress, getCommentType(type));
|
||||
}
|
||||
|
||||
// if the new comment is null then the change is a delete comment so remove the comment from the table
|
||||
else if (newComment == null) {
|
||||
provider.commentRemoved(commentAddress, getCommentType(type));
|
||||
}
|
||||
// otherwise, the comment is changed so repaint the table
|
||||
else {
|
||||
provider.getComponent().repaint();
|
||||
}
|
||||
// if old comment is null then the change is an add comment so add the comment to the table
|
||||
if (oldComment == null) {
|
||||
provider.commentAdded(commentAddress, commentType);
|
||||
}
|
||||
}
|
||||
|
||||
// if the new comment is null then the change is a delete comment so remove the comment from the table
|
||||
else if (newComment == null) {
|
||||
provider.commentRemoved(commentAddress, commentType);
|
||||
}
|
||||
// otherwise, the comment is changed so repaint the table
|
||||
else {
|
||||
provider.getComponent().repaint();
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
private void reload() {
|
||||
|
|
|
@ -83,9 +83,8 @@ import ghidra.util.task.TaskMonitor;
|
|||
servicesProvided = { DataTypeManagerService.class, DataTypeArchiveService.class }
|
||||
)
|
||||
//@formatter:on
|
||||
public class DataTypeManagerPlugin extends ProgramPlugin
|
||||
implements DomainObjectListener, DataTypeManagerService, DataTypeArchiveService,
|
||||
PopupActionProvider {
|
||||
public class DataTypeManagerPlugin extends ProgramPlugin implements DomainObjectListener,
|
||||
DataTypeManagerService, DataTypeArchiveService, PopupActionProvider {
|
||||
|
||||
private static final String EXTENSIONS_PATH_PREFIX = Path.GHIDRA_HOME + "/Extensions";
|
||||
|
||||
|
@ -281,7 +280,7 @@ public class DataTypeManagerPlugin extends ProgramPlugin
|
|||
|
||||
@Override
|
||||
public void domainObjectChanged(DomainObjectChangedEvent event) {
|
||||
if (event.containsEvent(DomainObject.DO_OBJECT_RESTORED)) {
|
||||
if (event.contains(DomainObjectEvent.RESTORED)) {
|
||||
Object source = event.getSource();
|
||||
if (source instanceof DataTypeManagerDomainObject) {
|
||||
DataTypeManagerDomainObject domainObject = (DataTypeManagerDomainObject) source;
|
||||
|
@ -290,7 +289,7 @@ public class DataTypeManagerPlugin extends ProgramPlugin
|
|||
editorManager.domainObjectRestored(domainObject);
|
||||
}
|
||||
}
|
||||
else if (event.containsEvent(DomainObject.DO_OBJECT_RENAMED)) {
|
||||
else if (event.contains(DomainObjectEvent.RENAMED)) {
|
||||
provider.programRenamed();
|
||||
}
|
||||
}
|
||||
|
@ -580,9 +579,8 @@ public class DataTypeManagerPlugin extends ProgramPlugin
|
|||
|
||||
public void openProjectDataTypeArchive() {
|
||||
|
||||
OpenVersionedFileDialog<DataTypeArchive> dialog =
|
||||
new OpenVersionedFileDialog<>(tool, "Open Project Data Type Archive",
|
||||
DataTypeArchive.class);
|
||||
OpenVersionedFileDialog<DataTypeArchive> dialog = new OpenVersionedFileDialog<>(tool,
|
||||
"Open Project Data Type Archive", DataTypeArchive.class);
|
||||
dialog.setHelpLocation(new HelpLocation(HelpTopics.PROGRAM, "Open_File_Dialog"));
|
||||
dialog.addOkActionListener(ev -> {
|
||||
DomainFile domainFile = dialog.getDomainFile();
|
||||
|
|
|
@ -15,6 +15,9 @@
|
|||
*/
|
||||
package ghidra.app.plugin.core.datawindow;
|
||||
|
||||
import static ghidra.framework.model.DomainObjectEvent.*;
|
||||
import static ghidra.program.util.ProgramEvent.*;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
|
||||
|
@ -26,7 +29,8 @@ import ghidra.app.plugin.PluginCategoryNames;
|
|||
import ghidra.app.plugin.ProgramPlugin;
|
||||
import ghidra.app.services.GoToService;
|
||||
import ghidra.app.services.ProgramTreeService;
|
||||
import ghidra.framework.model.*;
|
||||
import ghidra.framework.model.DomainObjectChangedEvent;
|
||||
import ghidra.framework.model.DomainObjectListener;
|
||||
import ghidra.framework.options.SaveState;
|
||||
import ghidra.framework.plugintool.*;
|
||||
import ghidra.framework.plugintool.util.PluginStatus;
|
||||
|
@ -36,7 +40,8 @@ import ghidra.program.model.data.DataType;
|
|||
import ghidra.program.model.data.DataTypeManager;
|
||||
import ghidra.program.model.listing.Data;
|
||||
import ghidra.program.model.listing.Program;
|
||||
import ghidra.program.util.*;
|
||||
import ghidra.program.util.ProgramChangeRecord;
|
||||
import ghidra.program.util.ProgramSelection;
|
||||
import ghidra.util.table.SelectionNavigationAction;
|
||||
import ghidra.util.table.actions.MakeProgramSelectionAction;
|
||||
import ghidra.util.task.SwingUpdateManager;
|
||||
|
@ -93,37 +98,27 @@ public class DataWindowPlugin extends ProgramPlugin implements DomainObjectListe
|
|||
|
||||
@Override
|
||||
public void domainObjectChanged(DomainObjectChangedEvent ev) {
|
||||
if (ev.containsEvent(DomainObject.DO_OBJECT_RESTORED)) {
|
||||
if (ev.contains(RESTORED)) {
|
||||
resetTypes();
|
||||
reload();
|
||||
return;
|
||||
}
|
||||
if (ev.containsEvent(ChangeManager.DOCR_DATA_TYPE_ADDED) ||
|
||||
ev.containsEvent(ChangeManager.DOCR_DATA_TYPE_CHANGED) ||
|
||||
ev.containsEvent(ChangeManager.DOCR_DATA_TYPE_MOVED) ||
|
||||
ev.containsEvent(ChangeManager.DOCR_DATA_TYPE_RENAMED) ||
|
||||
ev.containsEvent(ChangeManager.DOCR_DATA_TYPE_REPLACED) ||
|
||||
ev.containsEvent(ChangeManager.DOCR_DATA_TYPE_SETTING_CHANGED)) {
|
||||
|
||||
if (ev.contains(DATA_TYPE_ADDED, DATA_TYPE_CHANGED, DATA_TYPE_MOVED, DATA_TYPE_RENAMED,
|
||||
DATA_TYPE_REPLACED, DATA_TYPE_SETTING_CHANGED)) {
|
||||
resetTypes();
|
||||
}
|
||||
if (ev.containsEvent(ChangeManager.DOCR_MEMORY_BLOCK_MOVED) ||
|
||||
ev.containsEvent(ChangeManager.DOCR_MEMORY_BLOCK_REMOVED) ||
|
||||
ev.containsEvent(ChangeManager.DOCR_CODE_REMOVED)) {
|
||||
|
||||
if (ev.contains(MEMORY_BLOCK_MOVED, MEMORY_BLOCK_REMOVED, CODE_REMOVED)) {
|
||||
reload();
|
||||
return; // if we are going to reload, no need to check for data additions.
|
||||
}
|
||||
if (ev.containsEvent(ChangeManager.DOCR_CODE_ADDED)) {
|
||||
for (int i = 0; i < ev.numRecords(); ++i) {
|
||||
DomainObjectChangeRecord doRecord = ev.getChangeRecord(i);
|
||||
int eventType = doRecord.getEventType();
|
||||
if (eventType == ChangeManager.DOCR_CODE_ADDED) {
|
||||
ProgramChangeRecord rec = (ProgramChangeRecord) doRecord;
|
||||
if (rec.getNewValue() instanceof Data) {
|
||||
provider.dataAdded(rec.getStart());
|
||||
}
|
||||
}
|
||||
|
||||
ev.forEach(CODE_ADDED, rec -> {
|
||||
if (rec.getNewValue() instanceof Data) {
|
||||
provider.dataAdded(((ProgramChangeRecord) rec).getStart());
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
void reload() {
|
||||
|
|
|
@ -15,6 +15,9 @@
|
|||
*/
|
||||
package ghidra.app.plugin.core.equate;
|
||||
|
||||
import static ghidra.framework.model.DomainObjectEvent.*;
|
||||
import static ghidra.program.util.ProgramEvent.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import docking.widgets.OptionDialog;
|
||||
|
@ -23,7 +26,8 @@ import ghidra.app.plugin.PluginCategoryNames;
|
|||
import ghidra.app.plugin.ProgramPlugin;
|
||||
import ghidra.app.services.GoToService;
|
||||
import ghidra.framework.cmd.Command;
|
||||
import ghidra.framework.model.*;
|
||||
import ghidra.framework.model.DomainObjectChangedEvent;
|
||||
import ghidra.framework.model.DomainObjectListener;
|
||||
import ghidra.framework.plugintool.PluginInfo;
|
||||
import ghidra.framework.plugintool.PluginTool;
|
||||
import ghidra.framework.plugintool.util.PluginStatus;
|
||||
|
@ -31,7 +35,6 @@ import ghidra.program.model.address.Address;
|
|||
import ghidra.program.model.listing.Program;
|
||||
import ghidra.program.model.symbol.Equate;
|
||||
import ghidra.program.model.symbol.EquateTable;
|
||||
import ghidra.program.util.ChangeManager;
|
||||
import ghidra.program.util.OperandFieldLocation;
|
||||
import ghidra.util.Msg;
|
||||
import ghidra.util.task.SwingUpdateManager;
|
||||
|
@ -88,36 +91,33 @@ public class EquateTablePlugin extends ProgramPlugin implements DomainObjectList
|
|||
return;
|
||||
}
|
||||
|
||||
if (ev.containsEvent(DomainObject.DO_OBJECT_RESTORED)) {
|
||||
if (ev.contains(RESTORED)) {
|
||||
updateMgr.updateNow();
|
||||
return;
|
||||
}
|
||||
if (ev.containsEvent(ChangeManager.DOCR_EQUATE_ADDED) ||
|
||||
ev.containsEvent(ChangeManager.DOCR_EQUATE_REFERENCE_ADDED) ||
|
||||
ev.containsEvent(ChangeManager.DOCR_EQUATE_REFERENCE_REMOVED) ||
|
||||
ev.containsEvent(ChangeManager.DOCR_EQUATE_REMOVED) ||
|
||||
ev.containsEvent(ChangeManager.DOCR_EQUATE_RENAMED) ||
|
||||
|
||||
ev.containsEvent(ChangeManager.DOCR_SYMBOL_ADDED) ||
|
||||
ev.containsEvent(ChangeManager.DOCR_SYMBOL_REMOVED) ||
|
||||
ev.containsEvent(ChangeManager.DOCR_SYMBOL_RENAMED) ||
|
||||
|
||||
ev.containsEvent(ChangeManager.DOCR_MEMORY_BLOCK_ADDED) ||
|
||||
ev.containsEvent(ChangeManager.DOCR_MEMORY_BLOCK_MOVED) ||
|
||||
ev.containsEvent(ChangeManager.DOCR_MEMORY_BLOCK_REMOVED) ||
|
||||
|
||||
ev.containsEvent(ChangeManager.DOCR_FUNCTION_ADDED) ||
|
||||
ev.containsEvent(ChangeManager.DOCR_FUNCTION_CHANGED) ||
|
||||
ev.containsEvent(ChangeManager.DOCR_FUNCTION_REMOVED) ||
|
||||
|
||||
ev.containsEvent(ChangeManager.DOCR_CODE_ADDED) ||
|
||||
ev.containsEvent(ChangeManager.DOCR_CODE_MOVED) ||
|
||||
ev.containsEvent(ChangeManager.DOCR_CODE_REMOVED) ||
|
||||
|
||||
ev.containsEvent(ChangeManager.DOCR_DATA_TYPE_CHANGED)) {
|
||||
// @formatter:off
|
||||
if (ev.contains(EQUATE_ADDED,
|
||||
EQUATE_REFERENCE_ADDED,
|
||||
EQUATE_REFERENCE_REMOVED,
|
||||
EQUATE_REMOVED,
|
||||
EQUATE_RENAMED,
|
||||
SYMBOL_ADDED,
|
||||
SYMBOL_REMOVED,
|
||||
SYMBOL_RENAMED,
|
||||
MEMORY_BLOCK_ADDED,
|
||||
MEMORY_BLOCK_MOVED,
|
||||
MEMORY_BLOCK_REMOVED,
|
||||
FUNCTION_ADDED,
|
||||
FUNCTION_CHANGED,
|
||||
FUNCTION_REMOVED,
|
||||
CODE_ADDED,
|
||||
FRAGMENT_CHANGED,
|
||||
CODE_REMOVED,
|
||||
DATA_TYPE_CHANGED)) {
|
||||
|
||||
updateMgr.update();
|
||||
}
|
||||
// @formatter:on
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -15,6 +15,9 @@
|
|||
*/
|
||||
package ghidra.app.plugin.core.function.tags;
|
||||
|
||||
import static ghidra.framework.model.DomainObjectEvent.*;
|
||||
import static ghidra.program.util.ProgramEvent.*;
|
||||
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.Dimension;
|
||||
import java.util.*;
|
||||
|
@ -31,12 +34,14 @@ import generic.theme.GThemeDefaults.Colors;
|
|||
import ghidra.app.cmd.function.CreateFunctionTagCmd;
|
||||
import ghidra.app.context.ProgramActionContext;
|
||||
import ghidra.framework.cmd.Command;
|
||||
import ghidra.framework.model.*;
|
||||
import ghidra.framework.model.DomainObjectChangedEvent;
|
||||
import ghidra.framework.model.DomainObjectListener;
|
||||
import ghidra.framework.plugintool.ComponentProviderAdapter;
|
||||
import ghidra.program.database.function.FunctionManagerDB;
|
||||
import ghidra.program.model.address.Address;
|
||||
import ghidra.program.model.listing.*;
|
||||
import ghidra.program.util.*;
|
||||
import ghidra.program.util.FunctionLocation;
|
||||
import ghidra.program.util.ProgramLocation;
|
||||
import ghidra.util.*;
|
||||
import ghidra.util.task.SwingUpdateManager;
|
||||
import resources.ResourceManager;
|
||||
|
@ -160,16 +165,13 @@ public class FunctionTagProvider extends ComponentProviderAdapter implements Dom
|
|||
return;
|
||||
}
|
||||
|
||||
if (ev.containsEvent(DomainObject.DO_OBJECT_RESTORED) ||
|
||||
ev.containsEvent(ChangeManager.DOCR_FUNCTION_TAG_CREATED) ||
|
||||
ev.containsEvent(ChangeManager.DOCR_FUNCTION_TAG_DELETED) ||
|
||||
ev.containsEvent(ChangeManager.DOCR_TAG_REMOVED_FROM_FUNCTION) ||
|
||||
ev.containsEvent(ChangeManager.DOCR_TAG_ADDED_TO_FUNCTION)) {
|
||||
if (ev.contains(RESTORED, FUNCTION_TAG_CREATED, FUNCTION_TAG_DELETED, FUNCTION_TAG_APPLIED,
|
||||
FUNCTION_TAG_UNAPPLIED)) {
|
||||
updater.updateLater();
|
||||
return;
|
||||
}
|
||||
|
||||
if (ev.containsEvent(ChangeManager.DOCR_FUNCTION_TAG_CHANGED)) {
|
||||
if (ev.contains(FUNCTION_TAG_CHANGED)) {
|
||||
repaint();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,25 +19,20 @@ import java.util.Set;
|
|||
import java.util.function.Supplier;
|
||||
|
||||
import ghidra.app.CorePluginPackage;
|
||||
import ghidra.app.events.ProgramActivatedPluginEvent;
|
||||
import ghidra.app.events.ProgramClosedPluginEvent;
|
||||
import ghidra.app.events.ProgramSelectionPluginEvent;
|
||||
import ghidra.app.events.*;
|
||||
import ghidra.app.plugin.PluginCategoryNames;
|
||||
import ghidra.app.plugin.ProgramPlugin;
|
||||
import ghidra.app.plugin.core.functioncompare.actions.CompareFunctionsAction;
|
||||
import ghidra.app.plugin.core.functioncompare.actions.CompareFunctionsFromListingAction;
|
||||
import ghidra.app.services.FunctionComparisonService;
|
||||
import ghidra.framework.model.DomainObject;
|
||||
import ghidra.framework.model.DomainObjectChangeRecord;
|
||||
import ghidra.framework.model.DomainObjectChangedEvent;
|
||||
import ghidra.framework.model.DomainObjectListener;
|
||||
import ghidra.framework.model.*;
|
||||
import ghidra.framework.plugintool.PluginInfo;
|
||||
import ghidra.framework.plugintool.PluginTool;
|
||||
import ghidra.framework.plugintool.util.PluginStatus;
|
||||
import ghidra.program.model.listing.Function;
|
||||
import ghidra.program.model.listing.Program;
|
||||
import ghidra.program.util.ChangeManager;
|
||||
import ghidra.program.util.ProgramChangeRecord;
|
||||
import ghidra.program.util.ProgramEvent;
|
||||
import ghidra.util.Swing;
|
||||
|
||||
/**
|
||||
|
@ -114,19 +109,16 @@ public class FunctionComparisonPlugin extends ProgramPlugin
|
|||
for (int i = 0; i < ev.numRecords(); ++i) {
|
||||
DomainObjectChangeRecord doRecord = ev.getChangeRecord(i);
|
||||
|
||||
int eventType = doRecord.getEventType();
|
||||
|
||||
switch (eventType) {
|
||||
case DomainObject.DO_OBJECT_RESTORED:
|
||||
functionComparisonManager.domainObjectRestored(ev);
|
||||
break;
|
||||
case ChangeManager.DOCR_FUNCTION_REMOVED:
|
||||
ProgramChangeRecord rec = (ProgramChangeRecord) ev.getChangeRecord(i);
|
||||
Function function = (Function) rec.getObject();
|
||||
if (function != null) {
|
||||
removeFunction(function);
|
||||
}
|
||||
break;
|
||||
EventType eventType = doRecord.getEventType();
|
||||
if (eventType == DomainObjectEvent.RESTORED) {
|
||||
functionComparisonManager.domainObjectRestored(ev);
|
||||
}
|
||||
else if (eventType == ProgramEvent.FUNCTION_REMOVED) {
|
||||
ProgramChangeRecord rec = (ProgramChangeRecord) ev.getChangeRecord(i);
|
||||
Function function = (Function) rec.getObject();
|
||||
if (function != null) {
|
||||
removeFunction(function);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -168,8 +160,7 @@ public class FunctionComparisonPlugin extends ProgramPlugin
|
|||
}
|
||||
|
||||
@Override
|
||||
public FunctionComparisonProvider compareFunctions(Function source,
|
||||
Function target) {
|
||||
public FunctionComparisonProvider compareFunctions(Function source, Function target) {
|
||||
return getFromSwingBlocking(
|
||||
() -> functionComparisonManager.compareFunctions(source, target));
|
||||
}
|
||||
|
|
|
@ -21,7 +21,6 @@ import java.util.concurrent.CopyOnWriteArraySet;
|
|||
|
||||
import docking.ComponentProviderActivationListener;
|
||||
import ghidra.framework.model.*;
|
||||
import ghidra.framework.plugintool.Plugin;
|
||||
import ghidra.program.model.listing.Function;
|
||||
import ghidra.program.model.listing.Program;
|
||||
|
||||
|
@ -89,8 +88,7 @@ public class FunctionComparisonProviderManager implements FunctionComparisonProv
|
|||
* @param target the target function
|
||||
* @return the new comparison provider
|
||||
*/
|
||||
public FunctionComparisonProvider compareFunctions(Function source,
|
||||
Function target) {
|
||||
public FunctionComparisonProvider compareFunctions(Function source, Function target) {
|
||||
FunctionComparisonProvider provider = new MultiFunctionComparisonProvider(plugin);
|
||||
provider.addToTool();
|
||||
provider.getModel().compareFunctions(source, target);
|
||||
|
@ -123,7 +121,7 @@ public class FunctionComparisonProviderManager implements FunctionComparisonProv
|
|||
* @param provider the provider to add the functions to
|
||||
*/
|
||||
public void compareFunctions(Function source, Function target,
|
||||
FunctionComparisonProvider provider) {
|
||||
FunctionComparisonProvider provider) {
|
||||
if (provider == null) {
|
||||
return;
|
||||
}
|
||||
|
@ -215,8 +213,8 @@ public class FunctionComparisonProviderManager implements FunctionComparisonProv
|
|||
*/
|
||||
public void domainObjectRestored(DomainObjectChangedEvent ev) {
|
||||
for (DomainObjectChangeRecord domainObjectChangeRecord : ev) {
|
||||
int eventType = domainObjectChangeRecord.getEventType();
|
||||
if (eventType != DomainObject.DO_OBJECT_RESTORED) {
|
||||
EventType eventType = domainObjectChangeRecord.getEventType();
|
||||
if (eventType != DomainObjectEvent.RESTORED) {
|
||||
return;
|
||||
}
|
||||
Object source = ev.getSource();
|
||||
|
|
|
@ -15,6 +15,9 @@
|
|||
*/
|
||||
package ghidra.app.plugin.core.functionwindow;
|
||||
|
||||
import static ghidra.framework.model.DomainObjectEvent.*;
|
||||
import static ghidra.program.util.ProgramEvent.*;
|
||||
|
||||
import docking.action.DockingAction;
|
||||
import ghidra.app.CorePluginPackage;
|
||||
import ghidra.app.events.ProgramClosedPluginEvent;
|
||||
|
@ -30,8 +33,8 @@ import ghidra.program.model.address.Address;
|
|||
import ghidra.program.model.listing.Function;
|
||||
import ghidra.program.model.listing.Program;
|
||||
import ghidra.program.model.symbol.Symbol;
|
||||
import ghidra.program.util.ChangeManager;
|
||||
import ghidra.program.util.ProgramChangeRecord;
|
||||
import ghidra.program.util.ProgramEvent;
|
||||
import ghidra.util.table.SelectionNavigationAction;
|
||||
import ghidra.util.table.actions.MakeProgramSelectionAction;
|
||||
import ghidra.util.task.SwingUpdateManager;
|
||||
|
@ -110,9 +113,7 @@ public class FunctionWindowPlugin extends ProgramPlugin implements DomainObjectL
|
|||
return;
|
||||
}
|
||||
|
||||
if (ev.containsEvent(DomainObject.DO_OBJECT_RESTORED) ||
|
||||
ev.containsEvent(ChangeManager.DOCR_MEMORY_BLOCK_MOVED) ||
|
||||
ev.containsEvent(ChangeManager.DOCR_MEMORY_BLOCK_REMOVED)) {
|
||||
if (ev.contains(RESTORED, MEMORY_BLOCK_MOVED, MEMORY_BLOCK_REMOVED)) {
|
||||
provider.reload();
|
||||
return;
|
||||
}
|
||||
|
@ -120,58 +121,60 @@ public class FunctionWindowPlugin extends ProgramPlugin implements DomainObjectL
|
|||
for (int i = 0; i < ev.numRecords(); ++i) {
|
||||
DomainObjectChangeRecord doRecord = ev.getChangeRecord(i);
|
||||
|
||||
int eventType = doRecord.getEventType();
|
||||
EventType eventType = doRecord.getEventType();
|
||||
|
||||
switch (eventType) {
|
||||
case ChangeManager.DOCR_CODE_ADDED:
|
||||
case ChangeManager.DOCR_CODE_REMOVED:
|
||||
swingMgr.update();
|
||||
break;
|
||||
if (eventType instanceof ProgramEvent type) {
|
||||
switch (type) {
|
||||
case CODE_ADDED:
|
||||
case CODE_REMOVED:
|
||||
swingMgr.update();
|
||||
break;
|
||||
|
||||
case ChangeManager.DOCR_FUNCTION_ADDED:
|
||||
ProgramChangeRecord rec = (ProgramChangeRecord) ev.getChangeRecord(i);
|
||||
Function function = (Function) rec.getObject();
|
||||
provider.functionAdded(function);
|
||||
break;
|
||||
case ChangeManager.DOCR_FUNCTION_REMOVED:
|
||||
rec = (ProgramChangeRecord) ev.getChangeRecord(i);
|
||||
function = (Function) rec.getObject();
|
||||
if (function != null) {
|
||||
provider.functionRemoved(function);
|
||||
}
|
||||
break;
|
||||
case ChangeManager.DOCR_FUNCTION_CHANGED:
|
||||
rec = (ProgramChangeRecord) ev.getChangeRecord(i);
|
||||
function = (Function) rec.getObject();
|
||||
provider.update(function);
|
||||
break;
|
||||
case ChangeManager.DOCR_SYMBOL_ADDED:
|
||||
case ChangeManager.DOCR_SYMBOL_SET_AS_PRIMARY:
|
||||
rec = (ProgramChangeRecord) ev.getChangeRecord(i);
|
||||
Symbol sym = (Symbol) rec.getNewValue();
|
||||
Address addr = sym.getAddress();
|
||||
function = currentProgram.getListing().getFunctionAt(addr);
|
||||
if (function != null) {
|
||||
case FUNCTION_ADDED:
|
||||
ProgramChangeRecord rec = (ProgramChangeRecord) ev.getChangeRecord(i);
|
||||
Function function = (Function) rec.getObject();
|
||||
provider.functionAdded(function);
|
||||
break;
|
||||
case FUNCTION_REMOVED:
|
||||
rec = (ProgramChangeRecord) ev.getChangeRecord(i);
|
||||
function = (Function) rec.getObject();
|
||||
if (function != null) {
|
||||
provider.functionRemoved(function);
|
||||
}
|
||||
break;
|
||||
case FUNCTION_CHANGED:
|
||||
rec = (ProgramChangeRecord) ev.getChangeRecord(i);
|
||||
function = (Function) rec.getObject();
|
||||
provider.update(function);
|
||||
}
|
||||
break;
|
||||
case ChangeManager.DOCR_SYMBOL_RENAMED:
|
||||
rec = (ProgramChangeRecord) ev.getChangeRecord(i);
|
||||
sym = (Symbol) rec.getObject();
|
||||
addr = sym.getAddress();
|
||||
function = currentProgram.getListing().getFunctionAt(addr);
|
||||
if (function != null) {
|
||||
provider.update(function);
|
||||
}
|
||||
break;
|
||||
/*case ChangeManager.DOCR_SYMBOL_REMOVED:
|
||||
rec = (ProgramChangeRecord)ev.getChangeRecord(i);
|
||||
addr = (Address)rec.getObject();
|
||||
function = currentProgram.getListing().getFunctionAt(addr);
|
||||
if (function != null) {
|
||||
provider.functionChanged(function);
|
||||
}
|
||||
break;*/
|
||||
break;
|
||||
case SYMBOL_ADDED:
|
||||
case SYMBOL_PRIMARY_STATE_CHANGED:
|
||||
rec = (ProgramChangeRecord) ev.getChangeRecord(i);
|
||||
Symbol sym = (Symbol) rec.getNewValue();
|
||||
Address addr = sym.getAddress();
|
||||
function = currentProgram.getListing().getFunctionAt(addr);
|
||||
if (function != null) {
|
||||
provider.update(function);
|
||||
}
|
||||
break;
|
||||
case SYMBOL_RENAMED:
|
||||
rec = (ProgramChangeRecord) ev.getChangeRecord(i);
|
||||
sym = (Symbol) rec.getObject();
|
||||
addr = sym.getAddress();
|
||||
function = currentProgram.getListing().getFunctionAt(addr);
|
||||
if (function != null) {
|
||||
provider.update(function);
|
||||
}
|
||||
break;
|
||||
/*case SYMBOL_REMOVED:
|
||||
rec = (ProgramChangeRecord)ev.getChangeRecord(i);
|
||||
addr = (Address)rec.getObject();
|
||||
function = currentProgram.getListing().getFunctionAt(addr);
|
||||
if (function != null) {
|
||||
provider.functionChanged(function);
|
||||
}
|
||||
break;*/
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,6 +15,8 @@
|
|||
*/
|
||||
package ghidra.app.plugin.core.graph;
|
||||
|
||||
import static ghidra.program.util.ProgramEvent.*;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
|
@ -189,9 +191,7 @@ public abstract class AddressBasedGraphDisplayListener
|
|||
|
||||
@Override
|
||||
public void domainObjectChanged(DomainObjectChangedEvent ev) {
|
||||
if (!(ev.containsEvent(ChangeManager.DOCR_SYMBOL_ADDED) ||
|
||||
ev.containsEvent(ChangeManager.DOCR_SYMBOL_RENAMED) ||
|
||||
ev.containsEvent(ChangeManager.DOCR_SYMBOL_REMOVED))) {
|
||||
if (!(ev.contains(SYMBOL_ADDED, SYMBOL_RENAMED, SYMBOL_REMOVED))) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -200,13 +200,13 @@ public abstract class AddressBasedGraphDisplayListener
|
|||
ProgramChangeRecord programRecord = (ProgramChangeRecord) record;
|
||||
Address address = programRecord.getStart();
|
||||
|
||||
if (record.getEventType() == ChangeManager.DOCR_SYMBOL_RENAMED) {
|
||||
if (record.getEventType() == ProgramEvent.SYMBOL_RENAMED) {
|
||||
handleSymbolAddedOrRenamed(address, (Symbol) programRecord.getObject());
|
||||
}
|
||||
else if (record.getEventType() == ChangeManager.DOCR_SYMBOL_ADDED) {
|
||||
else if (record.getEventType() == ProgramEvent.SYMBOL_ADDED) {
|
||||
handleSymbolAddedOrRenamed(address, (Symbol) programRecord.getNewValue());
|
||||
}
|
||||
else if (record.getEventType() == ChangeManager.DOCR_SYMBOL_REMOVED) {
|
||||
else if (record.getEventType() == ProgramEvent.SYMBOL_REMOVED) {
|
||||
handleSymbolRemoved(address);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -49,7 +49,7 @@ abstract class ExpandBlockModel implements DomainObjectListener {
|
|||
|
||||
@Override
|
||||
public void domainObjectChanged(DomainObjectChangedEvent ev) {
|
||||
if (!ev.containsEvent(DomainObject.DO_OBJECT_RESTORED)) {
|
||||
if (!ev.contains(DomainObjectEvent.RESTORED)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -15,12 +15,16 @@
|
|||
*/
|
||||
package ghidra.app.plugin.core.memory;
|
||||
|
||||
import static ghidra.framework.model.DomainObjectEvent.*;
|
||||
import static ghidra.program.util.ProgramEvent.*;
|
||||
|
||||
import ghidra.app.CorePluginPackage;
|
||||
import ghidra.app.events.ProgramLocationPluginEvent;
|
||||
import ghidra.app.plugin.PluginCategoryNames;
|
||||
import ghidra.app.plugin.ProgramPlugin;
|
||||
import ghidra.app.services.GoToService;
|
||||
import ghidra.framework.model.*;
|
||||
import ghidra.framework.model.DomainObjectChangedEvent;
|
||||
import ghidra.framework.model.DomainObjectListener;
|
||||
import ghidra.framework.plugintool.PluginInfo;
|
||||
import ghidra.framework.plugintool.PluginTool;
|
||||
import ghidra.framework.plugintool.util.PluginStatus;
|
||||
|
@ -28,7 +32,7 @@ import ghidra.program.model.address.Address;
|
|||
import ghidra.program.model.listing.Program;
|
||||
import ghidra.program.model.mem.Memory;
|
||||
import ghidra.program.model.mem.MemoryBlock;
|
||||
import ghidra.program.util.ChangeManager;
|
||||
import ghidra.program.util.ProgramEvent;
|
||||
import ghidra.program.util.ProgramLocation;
|
||||
|
||||
/**
|
||||
|
@ -86,15 +90,11 @@ public class MemoryMapPlugin extends ProgramPlugin implements DomainObjectListen
|
|||
if (provider == null || !provider.isVisible()) {
|
||||
return;
|
||||
}
|
||||
if (ev.containsEvent(ChangeManager.DOCR_MEMORY_BLOCK_ADDED) ||
|
||||
ev.containsEvent(ChangeManager.DOCR_MEMORY_BLOCK_REMOVED) ||
|
||||
ev.containsEvent(ChangeManager.DOCR_MEMORY_BLOCK_MOVED) ||
|
||||
ev.containsEvent(ChangeManager.DOCR_MEMORY_BLOCK_SPLIT) ||
|
||||
ev.containsEvent(ChangeManager.DOCR_MEMORY_BLOCKS_JOINED) ||
|
||||
ev.containsEvent(DomainObject.DO_OBJECT_RESTORED)) {
|
||||
if (ev.contains(MEMORY_BLOCK_ADDED, MEMORY_BLOCK_REMOVED, MEMORY_BLOCK_MOVED,
|
||||
MEMORY_BLOCK_SPLIT, MEMORY_BLOCKS_JOINED, RESTORED)) {
|
||||
this.provider.updateMap();
|
||||
}
|
||||
else if (ev.containsEvent(ChangeManager.DOCR_MEMORY_BLOCK_CHANGED)) {
|
||||
else if (ev.contains(ProgramEvent.MEMORY_BLOCK_CHANGED)) {
|
||||
this.provider.updateData();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -56,7 +56,7 @@ class MoveBlockModel implements DomainObjectListener {
|
|||
*/
|
||||
@Override
|
||||
public void domainObjectChanged(DomainObjectChangedEvent ev) {
|
||||
if (ev.containsEvent(DomainObject.DO_OBJECT_RESTORED)) {
|
||||
if (ev.contains(DomainObjectEvent.RESTORED)) {
|
||||
block = program.getMemory().getBlock(blockStart);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -141,8 +141,7 @@ public class MyProgramChangesDisplayPlugin extends ProgramPlugin implements Doma
|
|||
checkInAction = new DockingAction("CheckIn", getName()) {
|
||||
@Override
|
||||
public void actionPerformed(ActionContext context) {
|
||||
AppInfo.getFrontEndTool()
|
||||
.checkIn(tool, currentProgram.getDomainFile());
|
||||
AppInfo.getFrontEndTool().checkIn(tool, currentProgram.getDomainFile());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -266,8 +265,7 @@ public class MyProgramChangesDisplayPlugin extends ProgramPlugin implements Doma
|
|||
*/
|
||||
private void updateChangeMarkers() {
|
||||
|
||||
Swing.assertSwingThread(
|
||||
"Change markers must be manipulated on the Swing thread");
|
||||
Swing.assertSwingThread("Change markers must be manipulated on the Swing thread");
|
||||
|
||||
if (currentProgram == null) {
|
||||
return;
|
||||
|
@ -276,30 +274,28 @@ public class MyProgramChangesDisplayPlugin extends ProgramPlugin implements Doma
|
|||
ProgramChangeSet changeSet = currentProgram.getChanges();
|
||||
|
||||
if (programChangedLocally) {
|
||||
currentMyChangeMarks.setAddressSetCollection(
|
||||
changeSet.getAddressSetCollectionSinceLastSave());
|
||||
currentMyChangeMarks
|
||||
.setAddressSetCollection(changeSet.getAddressSetCollectionSinceLastSave());
|
||||
}
|
||||
|
||||
if (isTrackingServerChanges()) {
|
||||
if (programSaved) {
|
||||
currentChangesSinceCheckoutMarks.setAddressSetCollection(
|
||||
changeSet.getAddressSetCollectionSinceCheckout());
|
||||
currentChangesSinceCheckoutMarks
|
||||
.setAddressSetCollection(changeSet.getAddressSetCollectionSinceCheckout());
|
||||
}
|
||||
|
||||
if (programChangedRemotely) {
|
||||
currentOtherChangeMarks.setAddressSetCollection(
|
||||
new SingleAddressSetCollection(otherChangeSet));
|
||||
currentOtherChangeMarks
|
||||
.setAddressSetCollection(new SingleAddressSetCollection(otherChangeSet));
|
||||
}
|
||||
|
||||
// only update conflict markers when server changeSet changes or we end a transaction
|
||||
if (programChangedRemotely || updateConflicts) {
|
||||
AddressSet intersect =
|
||||
changeSet.getAddressSetCollectionSinceCheckout()
|
||||
.getCombinedAddressSet()
|
||||
.intersect(
|
||||
otherChangeSet);
|
||||
currentConflictChangeMarks.setAddressSetCollection(
|
||||
new SingleAddressSetCollection(intersect));
|
||||
AddressSet intersect = changeSet.getAddressSetCollectionSinceCheckout()
|
||||
.getCombinedAddressSet()
|
||||
.intersect(otherChangeSet);
|
||||
currentConflictChangeMarks
|
||||
.setAddressSetCollection(new SingleAddressSetCollection(intersect));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -355,7 +351,7 @@ public class MyProgramChangesDisplayPlugin extends ProgramPlugin implements Doma
|
|||
@Override
|
||||
public void domainObjectChanged(DomainObjectChangedEvent ev) {
|
||||
programChangedLocally = true;
|
||||
if (ev.containsEvent(DomainObject.DO_OBJECT_SAVED)) {
|
||||
if (ev.contains(DomainObjectEvent.SAVED)) {
|
||||
programSaved = true;
|
||||
}
|
||||
|
||||
|
|
|
@ -139,43 +139,47 @@ abstract class DataTypeLocationDescriptor extends LocationDescriptor {
|
|||
|
||||
for (int i = 0; i < changeEvent.numRecords(); i++) {
|
||||
DomainObjectChangeRecord domainObjectRecord = changeEvent.getChangeRecord(i);
|
||||
int eventType = domainObjectRecord.getEventType();
|
||||
// int eventType = domainObjectRecord.getEventType();
|
||||
EventType eventType = domainObjectRecord.getEventType();
|
||||
if (eventType == DomainObjectEvent.RESTORED) {
|
||||
return checkForAddressChange(domainObjectRecord);
|
||||
}
|
||||
if (eventType instanceof ProgramEvent type) {
|
||||
switch (type) {
|
||||
case FUNCTION_CHANGED:
|
||||
ProgramChangeRecord changeRecord = (ProgramChangeRecord) domainObjectRecord;
|
||||
Address functionAddress = changeRecord.getStart();
|
||||
if (referencesContain(functionAddress) &&
|
||||
functionContainsDataType(functionAddress)) {
|
||||
return checkForAddressChange(changeRecord);
|
||||
}
|
||||
break;
|
||||
|
||||
switch (eventType) {
|
||||
case ChangeManager.DOCR_FUNCTION_CHANGED:
|
||||
ProgramChangeRecord changeRecord = (ProgramChangeRecord) domainObjectRecord;
|
||||
Address functionAddress = changeRecord.getStart();
|
||||
if (referencesContain(functionAddress) &&
|
||||
functionContainsDataType(functionAddress)) {
|
||||
return checkForAddressChange(changeRecord);
|
||||
}
|
||||
break;
|
||||
|
||||
case ChangeManager.DOCR_MEMORY_BLOCK_MOVED:
|
||||
case ChangeManager.DOCR_MEMORY_BLOCK_REMOVED:
|
||||
case ChangeManager.DOCR_SYMBOL_REMOVED:
|
||||
case ChangeManager.DOCR_MEM_REFERENCE_REMOVED:
|
||||
case ChangeManager.DOCR_CODE_REMOVED:
|
||||
case ChangeManager.DOCR_FUNCTION_REMOVED:
|
||||
case ChangeManager.DOCR_VARIABLE_REFERENCE_REMOVED:
|
||||
case DomainObject.DO_OBJECT_RESTORED:
|
||||
return checkForAddressChange(domainObjectRecord);
|
||||
case ChangeManager.DOCR_CODE_ADDED:
|
||||
case ChangeManager.DOCR_MEMORY_BLOCK_ADDED:
|
||||
case ChangeManager.DOCR_SYMBOL_ADDED:
|
||||
case ChangeManager.DOCR_MEM_REFERENCE_ADDED:
|
||||
case ChangeManager.DOCR_FUNCTION_ADDED:
|
||||
case ChangeManager.DOCR_VARIABLE_REFERENCE_ADDED:
|
||||
case ChangeManager.DOCR_DATA_TYPE_RENAMED:
|
||||
case ChangeManager.DOCR_DATA_TYPE_REPLACED:
|
||||
// signal that the reference addresses may be out-of-date
|
||||
if (modelFreshnessListener != null) {
|
||||
modelFreshnessListener.stateChanged(new ChangeEvent(this));
|
||||
}
|
||||
return true;
|
||||
case MEMORY_BLOCK_MOVED:
|
||||
case MEMORY_BLOCK_REMOVED:
|
||||
case SYMBOL_REMOVED:
|
||||
case REFERENCE_REMOVED:
|
||||
case CODE_REMOVED:
|
||||
case FUNCTION_REMOVED:
|
||||
case VARIABLE_REFERENCE_REMOVED:
|
||||
return checkForAddressChange(domainObjectRecord);
|
||||
case CODE_ADDED:
|
||||
case MEMORY_BLOCK_ADDED:
|
||||
case SYMBOL_ADDED:
|
||||
case REFERENCE_ADDED:
|
||||
case FUNCTION_ADDED:
|
||||
case VARIABLE_REFERENCE_ADDED:
|
||||
case DATA_TYPE_RENAMED:
|
||||
case DATA_TYPE_REPLACED:
|
||||
// signal that the reference addresses may be out-of-date
|
||||
if (modelFreshnessListener != null) {
|
||||
modelFreshnessListener.stateChanged(new ChangeEvent(this));
|
||||
}
|
||||
return true;
|
||||
default:
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -20,8 +20,7 @@ import java.awt.Color;
|
|||
import docking.widgets.fieldpanel.support.Highlight;
|
||||
import ghidra.app.plugin.core.navigation.FunctionUtils;
|
||||
import ghidra.app.util.viewer.field.*;
|
||||
import ghidra.framework.model.DomainObjectChangeRecord;
|
||||
import ghidra.framework.model.DomainObjectChangedEvent;
|
||||
import ghidra.framework.model.*;
|
||||
import ghidra.program.model.address.Address;
|
||||
import ghidra.program.model.listing.*;
|
||||
import ghidra.program.util.*;
|
||||
|
@ -76,18 +75,18 @@ class FunctionSignatureFieldLocationDescriptor extends LocationDescriptor {
|
|||
|
||||
for (int i = 0; i < changeEvent.numRecords(); i++) {
|
||||
DomainObjectChangeRecord domainObjectRecord = changeEvent.getChangeRecord(i);
|
||||
int eventType = domainObjectRecord.getEventType();
|
||||
EventType eventType = domainObjectRecord.getEventType();
|
||||
|
||||
if (domainObjectRecord instanceof ProgramChangeRecord) {
|
||||
ProgramChangeRecord programChangeRecord = (ProgramChangeRecord) domainObjectRecord;
|
||||
if (eventType == ChangeManager.DOCR_FUNCTION_REMOVED) {
|
||||
if (eventType == ProgramEvent.FUNCTION_REMOVED) {
|
||||
Address effectedEntryPoint = programChangeRecord.getStart();
|
||||
if (effectedEntryPoint.equals(function.getEntryPoint())) {
|
||||
checkForAddressChange(domainObjectRecord);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else if (eventType == ChangeManager.DOCR_MEM_REFERENCE_REMOVED) {
|
||||
else if (eventType == ProgramEvent.REFERENCE_REMOVED) {
|
||||
Address addr = programChangeRecord.getStart();
|
||||
Function functionContaining =
|
||||
program.getFunctionManager().getFunctionContaining(addr);
|
||||
|
|
|
@ -108,49 +108,52 @@ public abstract class LocationDescriptor {
|
|||
|
||||
for (int i = 0; i < changeEvent.numRecords(); i++) {
|
||||
DomainObjectChangeRecord domainObjectRecord = changeEvent.getChangeRecord(i);
|
||||
int eventType = domainObjectRecord.getEventType();
|
||||
|
||||
switch (eventType) {
|
||||
case ChangeManager.DOCR_MEMORY_BLOCK_MOVED:
|
||||
case ChangeManager.DOCR_MEMORY_BLOCK_REMOVED:
|
||||
if (program.getMemory().contains(getHomeAddress())) {
|
||||
EventType eventType = domainObjectRecord.getEventType();
|
||||
if (eventType == DomainObjectEvent.RESTORED) {
|
||||
checkForAddressChange(domainObjectRecord);
|
||||
return true;
|
||||
}
|
||||
if (eventType instanceof ProgramEvent type) {
|
||||
switch (type) {
|
||||
case MEMORY_BLOCK_MOVED:
|
||||
case MEMORY_BLOCK_REMOVED:
|
||||
if (program.getMemory().contains(getHomeAddress())) {
|
||||
checkForAddressChange(domainObjectRecord);
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
case SYMBOL_ADDED:
|
||||
case SYMBOL_RENAMED:
|
||||
case SYMBOL_REMOVED:
|
||||
checkForAddressChange(domainObjectRecord);
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
case ChangeManager.DOCR_SYMBOL_ADDED:
|
||||
case ChangeManager.DOCR_SYMBOL_RENAMED:
|
||||
case ChangeManager.DOCR_SYMBOL_REMOVED:
|
||||
checkForAddressChange(domainObjectRecord);
|
||||
return true;
|
||||
case ChangeManager.DOCR_MEM_REFERENCE_ADDED:
|
||||
ProgramChangeRecord changeRecord = (ProgramChangeRecord) domainObjectRecord;
|
||||
Reference ref = (Reference) changeRecord.getNewValue();
|
||||
if (refersToAddress(ref, getHomeAddress())) {
|
||||
checkForAddressChange(domainObjectRecord);
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
case ChangeManager.DOCR_MEM_REFERENCE_REMOVED:
|
||||
changeRecord = (ProgramChangeRecord) domainObjectRecord;
|
||||
ref = (Reference) changeRecord.getOldValue();
|
||||
if (refersToAddress(ref, getHomeAddress())) {
|
||||
checkForAddressChange(domainObjectRecord);
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
case ChangeManager.DOCR_SYMBOL_ASSOCIATION_ADDED:
|
||||
case ChangeManager.DOCR_SYMBOL_ASSOCIATION_REMOVED:
|
||||
changeRecord = (ProgramChangeRecord) domainObjectRecord;
|
||||
ref = (Reference) changeRecord.getObject();
|
||||
if (refersToAddress(ref, getHomeAddress())) {
|
||||
checkForAddressChange(domainObjectRecord);
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
case DomainObject.DO_OBJECT_RESTORED:
|
||||
checkForAddressChange(domainObjectRecord);
|
||||
return true;
|
||||
case REFERENCE_ADDED:
|
||||
ProgramChangeRecord changeRecord = (ProgramChangeRecord) domainObjectRecord;
|
||||
Reference ref = (Reference) changeRecord.getNewValue();
|
||||
if (refersToAddress(ref, getHomeAddress())) {
|
||||
checkForAddressChange(domainObjectRecord);
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
case REFERENCE_REMOVED:
|
||||
changeRecord = (ProgramChangeRecord) domainObjectRecord;
|
||||
ref = (Reference) changeRecord.getOldValue();
|
||||
if (refersToAddress(ref, getHomeAddress())) {
|
||||
checkForAddressChange(domainObjectRecord);
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
case SYMBOL_ASSOCIATION_ADDED:
|
||||
case SYMBOL_ASSOCIATION_REMOVED:
|
||||
changeRecord = (ProgramChangeRecord) domainObjectRecord;
|
||||
ref = (Reference) changeRecord.getObject();
|
||||
if (refersToAddress(ref, getHomeAddress())) {
|
||||
checkForAddressChange(domainObjectRecord);
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -173,8 +176,7 @@ public abstract class LocationDescriptor {
|
|||
return removed;
|
||||
}
|
||||
|
||||
int eventType = changeRecord.getEventType();
|
||||
if (eventType == DomainObject.DO_OBJECT_RESTORED) {
|
||||
if (changeRecord.getEventType() == DomainObjectEvent.RESTORED) {
|
||||
// we cannot tell which addresses were effected, so the data *may* be stale
|
||||
if (modelFreshnessListener != null) {
|
||||
modelFreshnessListener.stateChanged(new ChangeEvent(this));
|
||||
|
|
|
@ -33,8 +33,8 @@ import ghidra.program.model.address.AddressSetView;
|
|||
import ghidra.program.model.listing.*;
|
||||
import ghidra.program.model.mem.MemoryBlock;
|
||||
import ghidra.program.model.symbol.Reference;
|
||||
import ghidra.program.util.ChangeManager;
|
||||
import ghidra.program.util.ProgramChangeRecord;
|
||||
import ghidra.program.util.ProgramEvent;
|
||||
import ghidra.util.HTMLUtilities;
|
||||
import ghidra.util.HelpLocation;
|
||||
|
||||
|
@ -280,8 +280,7 @@ public class AddressTypeOverviewColorService
|
|||
HelpLocation help = new HelpLocation(OverviewColorPlugin.HELP_TOPIC, "OverviewOptions");
|
||||
|
||||
options.registerThemeColorBinding("Instruction Color", DEFAULT_INSTRUCTION_COLOR.getId(),
|
||||
help,
|
||||
"Color for instructions");
|
||||
help, "Color for instructions");
|
||||
options.registerThemeColorBinding("Data Color", DEFAULT_DATA_COLOR.getId(), help,
|
||||
"Color for data");
|
||||
options.registerThemeColorBinding("Function Color", DEFAULT_FUNCTION_COLOR.getId(), help,
|
||||
|
@ -289,11 +288,9 @@ public class AddressTypeOverviewColorService
|
|||
options.registerThemeColorBinding("Undefined Color", DEFAULT_UNDEFINED_COLOR.getId(), help,
|
||||
"Color for undefined bytes");
|
||||
options.registerThemeColorBinding("Uninitialized Color",
|
||||
DEFAULT_UNINITIALIZED_COLOR.getId(), help,
|
||||
"Color for uninitialize memory");
|
||||
DEFAULT_UNINITIALIZED_COLOR.getId(), help, "Color for uninitialize memory");
|
||||
options.registerThemeColorBinding("External Reference Color",
|
||||
DEFAULT_EXTERNAL_REF_COLOR.getId(), help,
|
||||
"Color for external references");
|
||||
DEFAULT_EXTERNAL_REF_COLOR.getId(), help, "Color for external references");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -312,16 +309,16 @@ public class AddressTypeOverviewColorService
|
|||
public void domainObjectChanged(DomainObjectChangedEvent ev) {
|
||||
for (int i = 0; i < ev.numRecords(); i++) {
|
||||
DomainObjectChangeRecord doRecord = ev.getChangeRecord(i);
|
||||
int eventType = doRecord.getEventType();
|
||||
EventType eventType = doRecord.getEventType();
|
||||
|
||||
if (eventType == ChangeManager.DOCR_FUNCTION_ADDED) {
|
||||
if (eventType == ProgramEvent.FUNCTION_ADDED) {
|
||||
ProgramChangeRecord record = (ProgramChangeRecord) doRecord;
|
||||
Function function = (Function) record.getObject();
|
||||
AddressSetView addresses = function.getBody();
|
||||
overviewComponent.refresh(addresses.getMinAddress(), addresses.getMaxAddress());
|
||||
}
|
||||
|
||||
else if (eventType == ChangeManager.DOCR_FUNCTION_REMOVED) {
|
||||
else if (eventType == ProgramEvent.FUNCTION_REMOVED) {
|
||||
AddressSetView addresses = (AddressSetView) doRecord.getOldValue();
|
||||
overviewComponent.refresh(addresses.getMinAddress(), addresses.getMaxAddress());
|
||||
}
|
||||
|
|
|
@ -289,50 +289,46 @@ class MultiProgramManager implements DomainObjectListener, TransactionListener {
|
|||
|
||||
@Override
|
||||
public void domainObjectChanged(DomainObjectChangedEvent ev) {
|
||||
if (!(ev.getSource() instanceof Program)) {
|
||||
if (!(ev.getSource() instanceof Program program)) {
|
||||
return;
|
||||
}
|
||||
|
||||
Program program = (Program) ev.getSource();
|
||||
if (ev.containsEvent(DomainObject.DO_DOMAIN_FILE_CHANGED) ||
|
||||
ev.containsEvent(DomainObject.DO_OBJECT_ERROR)) {
|
||||
for (int i = 0; i < ev.numRecords(); i++) {
|
||||
DomainObjectChangeRecord docr = ev.getChangeRecord(i);
|
||||
int eventType = docr.getEventType();
|
||||
if (eventType == DomainObject.DO_DOMAIN_FILE_CHANGED) {
|
||||
ProgramInfo info = getInfo(program);
|
||||
if (info != null) {
|
||||
info.programSavedAs(); // updates info to new domain file
|
||||
}
|
||||
if (currentInfo != null && currentInfo.program == program) {
|
||||
String name = program.getDomainFile().toString();
|
||||
tool.setSubTitle(name);
|
||||
}
|
||||
}
|
||||
else if (eventType == DomainObject.DO_OBJECT_ERROR) {
|
||||
String msg;
|
||||
Throwable t = (Throwable) docr.getNewValue();
|
||||
if (t instanceof NoSuchObjectException) {
|
||||
msg = program.getName() + " was closed due to an unrecoverable error!" +
|
||||
"\nThis error could be the result of your computer becoming suspended" +
|
||||
"\nor sleeping allowing the network connection with the Ghidra Server" +
|
||||
"\nto fail.";
|
||||
}
|
||||
else {
|
||||
msg = program.getName() + " was closed due to an unrecoverable error!" +
|
||||
"\n \nSuch failures are generally due to an IO Error caused" +
|
||||
"\nby the local filesystem or server.";
|
||||
}
|
||||
ev.forEach(DomainObjectEvent.FILE_CHANGED, r -> {
|
||||
ProgramInfo info = getInfo(program);
|
||||
if (info != null) {
|
||||
info.programSavedAs(); // updates info to new domain file
|
||||
}
|
||||
if (currentInfo != null && currentInfo.program == program) {
|
||||
String name = program.getDomainFile().toString();
|
||||
tool.setSubTitle(name);
|
||||
}
|
||||
});
|
||||
|
||||
if (ev.contains(DomainObjectEvent.ERROR)) {
|
||||
for (DomainObjectChangeRecord docr : ev) {
|
||||
EventType eventType = docr.getEventType();
|
||||
if (eventType == DomainObjectEvent.ERROR) {
|
||||
String msg = getErrorMessage(program, (Throwable) docr.getNewValue());
|
||||
Msg.showError(this, tool.getToolFrame(), "Severe Error Condition", msg);
|
||||
removeProgram(program);
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private String getErrorMessage(Program program, Throwable t) {
|
||||
if (t instanceof NoSuchObjectException) {
|
||||
return program.getName() + " was closed due to an unrecoverable error!" +
|
||||
"\nThis error could be the result of your computer becoming suspended" +
|
||||
"\nor sleeping allowing the network connection with the Ghidra Server" +
|
||||
"\nto fail.";
|
||||
}
|
||||
return program.getName() + " was closed due to an unrecoverable error!" +
|
||||
"\n \nSuch failures are generally due to an IO Error caused" +
|
||||
"\nby the local filesystem or server.";
|
||||
}
|
||||
|
||||
public boolean isEmpty() {
|
||||
return programMap.isEmpty();
|
||||
}
|
||||
|
|
|
@ -15,6 +15,9 @@
|
|||
*/
|
||||
package ghidra.app.plugin.core.programtree;
|
||||
|
||||
import static ghidra.framework.model.DomainObjectEvent.*;
|
||||
import static ghidra.program.util.ProgramEvent.*;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import javax.swing.tree.TreePath;
|
||||
|
@ -22,8 +25,8 @@ import javax.swing.tree.TreePath;
|
|||
import ghidra.framework.model.*;
|
||||
import ghidra.program.model.address.Address;
|
||||
import ghidra.program.model.listing.*;
|
||||
import ghidra.program.util.ChangeManager;
|
||||
import ghidra.program.util.ProgramChangeRecord;
|
||||
import ghidra.program.util.ProgramEvent;
|
||||
import ghidra.util.Msg;
|
||||
import ghidra.util.datastruct.StringKeyIndexer;
|
||||
import ghidra.util.task.SwingUpdateManager;
|
||||
|
@ -74,30 +77,30 @@ class ProgramListener implements DomainObjectListener {
|
|||
continue;
|
||||
}
|
||||
ProgramChangeRecord record = (ProgramChangeRecord) rec;
|
||||
int eventType = rec.getEventType();
|
||||
EventType eventType = rec.getEventType();
|
||||
|
||||
if (eventType == ChangeManager.DOCR_TREE_RENAMED) {
|
||||
if (eventType == ProgramEvent.PROGRAM_TREE_RENAMED) {
|
||||
plugin.treeRenamed((String) record.getOldValue(), (String) record.getNewValue());
|
||||
}
|
||||
else if (eventType == ChangeManager.DOCR_GROUP_ADDED) {
|
||||
else if (eventType == ProgramEvent.GROUP_ADDED) {
|
||||
processGroupAdded(record);
|
||||
}
|
||||
else if (eventType == ChangeManager.DOCR_GROUP_REMOVED) {
|
||||
else if (eventType == ProgramEvent.GROUP_REMOVED) {
|
||||
processGroupRemoved(record);
|
||||
}
|
||||
else if (eventType == ChangeManager.DOCR_GROUP_RENAMED) {
|
||||
else if (eventType == ProgramEvent.GROUP_RENAMED) {
|
||||
processGroupRenamed(record);
|
||||
}
|
||||
else if (eventType == ChangeManager.DOCR_MODULE_REORDERED) {
|
||||
else if (eventType == ProgramEvent.MODULE_REORDERED) {
|
||||
processModuleReordered(record);
|
||||
}
|
||||
else if (eventType == ChangeManager.DOCR_GROUP_REPARENTED) {
|
||||
else if (eventType == ProgramEvent.GROUP_REPARENTED) {
|
||||
processGroupReparented(record);
|
||||
}
|
||||
else if (eventType == ChangeManager.DOCR_FRAGMENT_MOVED) {
|
||||
else if (eventType == ProgramEvent.FRAGMENT_MOVED) {
|
||||
plugin.fragmentMoved();
|
||||
}
|
||||
else if (eventType == ChangeManager.DOCR_MEMORY_BLOCKS_JOINED) {
|
||||
else if (eventType == ProgramEvent.MEMORY_BLOCKS_JOINED) {
|
||||
viewChanged |= processBlockJoined(record);
|
||||
}
|
||||
|
||||
|
@ -359,24 +362,23 @@ class ProgramListener implements DomainObjectListener {
|
|||
int recordCount = event.numRecords();
|
||||
for (int i = 0; i < recordCount; i++) {
|
||||
DomainObjectChangeRecord rec = event.getChangeRecord(i);
|
||||
int eventType = rec.getEventType();
|
||||
if (eventType == DomainObject.DO_OBJECT_RESTORED ||
|
||||
eventType == ChangeManager.DOCR_MEMORY_BLOCK_REMOVED) {
|
||||
EventType eventType = rec.getEventType();
|
||||
if (eventType == DomainObjectEvent.RESTORED ||
|
||||
eventType == ProgramEvent.MEMORY_BLOCK_REMOVED) {
|
||||
// for object restored, check the root node to see if it is invalid;
|
||||
// otherwise for memory block removed, rebuild the tree
|
||||
plugin.reloadProgram(eventType == DomainObject.DO_OBJECT_RESTORED);
|
||||
plugin.reloadProgram(eventType == DomainObjectEvent.RESTORED);
|
||||
return true;
|
||||
}
|
||||
if (eventType == ChangeManager.DOCR_GROUP_ADDED ||
|
||||
eventType == ChangeManager.DOCR_GROUP_REMOVED ||
|
||||
eventType == ChangeManager.DOCR_FRAGMENT_MOVED ||
|
||||
eventType == ChangeManager.DOCR_MODULE_REORDERED) {
|
||||
if (eventType == ProgramEvent.GROUP_ADDED || eventType == ProgramEvent.GROUP_REMOVED ||
|
||||
eventType == ProgramEvent.FRAGMENT_MOVED ||
|
||||
eventType == ProgramEvent.MODULE_REORDERED) {
|
||||
changeCnt++;
|
||||
}
|
||||
else if (eventType == ChangeManager.DOCR_TREE_REMOVED) {
|
||||
else if (eventType == ProgramEvent.PROGRAM_TREE_REMOVED) {
|
||||
plugin.treeRemoved((String) rec.getOldValue());
|
||||
}
|
||||
else if (eventType == ChangeManager.DOCR_TREE_CREATED) {
|
||||
else if (eventType == ProgramEvent.PROGRAM_TREE_CREATED) {
|
||||
plugin.treeViewAdded((String) rec.getNewValue());
|
||||
}
|
||||
}
|
||||
|
@ -396,8 +398,7 @@ class ProgramListener implements DomainObjectListener {
|
|||
return false;
|
||||
}
|
||||
|
||||
return event.containsEvent(ChangeManager.DOCR_TREE_RENAMED) ||
|
||||
event.containsEvent(DomainObject.DO_OBJECT_RENAMED);
|
||||
return event.contains(PROGRAM_TREE_RENAMED, RENAMED);
|
||||
}
|
||||
|
||||
private int[] findViewedIndexes(String oldParentName, String childName) {
|
||||
|
|
|
@ -15,6 +15,9 @@
|
|||
*/
|
||||
package ghidra.app.plugin.core.register;
|
||||
|
||||
import static ghidra.framework.model.DomainObjectEvent.*;
|
||||
import static ghidra.program.util.ProgramEvent.*;
|
||||
|
||||
import java.awt.event.MouseEvent;
|
||||
|
||||
import javax.swing.*;
|
||||
|
@ -24,13 +27,13 @@ import docking.WindowPosition;
|
|||
import docking.action.*;
|
||||
import generic.theme.GIcon;
|
||||
import ghidra.app.context.ProgramActionContext;
|
||||
import ghidra.framework.model.*;
|
||||
import ghidra.framework.model.DomainObjectChangedEvent;
|
||||
import ghidra.framework.model.DomainObjectListener;
|
||||
import ghidra.framework.plugintool.ComponentProviderAdapter;
|
||||
import ghidra.framework.plugintool.PluginTool;
|
||||
import ghidra.program.model.address.Address;
|
||||
import ghidra.program.model.lang.Register;
|
||||
import ghidra.program.model.listing.Program;
|
||||
import ghidra.program.util.ChangeManager;
|
||||
import ghidra.util.HelpLocation;
|
||||
import ghidra.util.task.SwingUpdateManager;
|
||||
import resources.Icons;
|
||||
|
@ -100,8 +103,8 @@ public class RegisterManagerProvider extends ComponentProviderAdapter {
|
|||
};
|
||||
deleteRegisterValuesAction.setEnabled(false);
|
||||
deleteRegisterValuesAction.setToolBarData(new ToolBarData(DELETE_REGISTER_VALUES_ICON));
|
||||
deleteRegisterValuesAction.setPopupMenuData(
|
||||
new MenuData(new String[] { "Delete Register Value Ranges" }));
|
||||
deleteRegisterValuesAction
|
||||
.setPopupMenuData(new MenuData(new String[] { "Delete Register Value Ranges" }));
|
||||
deleteRegisterValuesAction.setDescription("Delete Register Value Ranges");
|
||||
deleteRegisterValuesAction.setHelpLocation(helpLocation);
|
||||
tool.addLocalAction(this, deleteRegisterValuesAction);
|
||||
|
@ -114,8 +117,8 @@ public class RegisterManagerProvider extends ComponentProviderAdapter {
|
|||
};
|
||||
selectRegisterValuesAction.setEnabled(false);
|
||||
selectRegisterValuesAction.setToolBarData(new ToolBarData(SELECT_REGISTER_VALUES_ICON));
|
||||
selectRegisterValuesAction.setPopupMenuData(
|
||||
new MenuData(new String[] { "Select Register Value Ranges" }));
|
||||
selectRegisterValuesAction
|
||||
.setPopupMenuData(new MenuData(new String[] { "Select Register Value Ranges" }));
|
||||
selectRegisterValuesAction.setDescription("Select Register Value Ranges");
|
||||
selectRegisterValuesAction.setHelpLocation(helpLocation);
|
||||
tool.addLocalAction(this, selectRegisterValuesAction);
|
||||
|
@ -128,12 +131,12 @@ public class RegisterManagerProvider extends ComponentProviderAdapter {
|
|||
}
|
||||
};
|
||||
showDefaultRegisterValuesAction.setSelected(false);
|
||||
showDefaultRegisterValuesAction.setDescription(
|
||||
"Toggles showing of default register values");
|
||||
showDefaultRegisterValuesAction.setMenuBarData(
|
||||
new MenuData(new String[] { "Show Default Values" }));
|
||||
showDefaultRegisterValuesAction.setHelpLocation(
|
||||
new HelpLocation("RegisterPlugin", "menu_actions"));
|
||||
showDefaultRegisterValuesAction
|
||||
.setDescription("Toggles showing of default register values");
|
||||
showDefaultRegisterValuesAction
|
||||
.setMenuBarData(new MenuData(new String[] { "Show Default Values" }));
|
||||
showDefaultRegisterValuesAction
|
||||
.setHelpLocation(new HelpLocation("RegisterPlugin", "menu_actions"));
|
||||
tool.addLocalAction(this, showDefaultRegisterValuesAction);
|
||||
|
||||
filterRegistersAction = new ToggleDockingAction("Filter Registers", getName()) {
|
||||
|
@ -221,10 +224,8 @@ public class RegisterManagerProvider extends ComponentProviderAdapter {
|
|||
class MyDomainObjectListener implements DomainObjectListener {
|
||||
@Override
|
||||
public void domainObjectChanged(DomainObjectChangedEvent ev) {
|
||||
if (ev.containsEvent(ChangeManager.DOCR_REGISTER_VALUES_CHANGED) ||
|
||||
ev.containsEvent(DomainObject.DO_OBJECT_RESTORED)) {
|
||||
if (ev.contains(REGISTER_VALUES_CHANGED, RESTORED)) {
|
||||
updateMgr.update();
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,13 +21,14 @@ import java.util.List;
|
|||
import ghidra.app.CorePluginPackage;
|
||||
import ghidra.app.plugin.PluginCategoryNames;
|
||||
import ghidra.app.plugin.ProgramPlugin;
|
||||
import ghidra.framework.model.*;
|
||||
import ghidra.framework.model.DomainObjectChangedEvent;
|
||||
import ghidra.framework.model.DomainObjectListener;
|
||||
import ghidra.framework.plugintool.PluginInfo;
|
||||
import ghidra.framework.plugintool.PluginTool;
|
||||
import ghidra.framework.plugintool.util.PluginStatus;
|
||||
import ghidra.program.model.address.Address;
|
||||
import ghidra.program.model.listing.Program;
|
||||
import ghidra.program.util.ChangeManager;
|
||||
import ghidra.program.util.ProgramEvent;
|
||||
import ghidra.util.classfinder.ClassSearcher;
|
||||
|
||||
//@formatter:off
|
||||
|
@ -67,16 +68,11 @@ public class RelocationFixupPlugin extends ProgramPlugin implements DomainObject
|
|||
|
||||
@Override
|
||||
public void domainObjectChanged(DomainObjectChangedEvent ev) {
|
||||
if (!ev.containsEvent(ChangeManager.DOCR_IMAGE_BASE_CHANGED)) {
|
||||
return;
|
||||
}
|
||||
for (DomainObjectChangeRecord record : ev) {
|
||||
if (record.getEventType() == ChangeManager.DOCR_IMAGE_BASE_CHANGED) {
|
||||
Address oldImageBase = (Address) record.getOldValue();
|
||||
Address newImageBase = (Address) record.getNewValue();
|
||||
imageBaseChanged(oldImageBase, newImageBase);
|
||||
}
|
||||
}
|
||||
ev.forEach(ProgramEvent.IMAGE_BASE_CHANGED, r -> {
|
||||
Address oldImageBase = (Address) r.getOldValue();
|
||||
Address newImageBase = (Address) r.getNewValue();
|
||||
imageBaseChanged(oldImageBase, newImageBase);
|
||||
});
|
||||
}
|
||||
|
||||
private void imageBaseChanged(Address oldImageBase, Address newImageBase) {
|
||||
|
|
|
@ -15,17 +15,20 @@
|
|||
*/
|
||||
package ghidra.app.plugin.core.reloc;
|
||||
|
||||
import static ghidra.framework.model.DomainObjectEvent.*;
|
||||
import static ghidra.program.util.ProgramEvent.*;
|
||||
|
||||
import docking.action.DockingAction;
|
||||
import ghidra.app.CorePluginPackage;
|
||||
import ghidra.app.events.ProgramActivatedPluginEvent;
|
||||
import ghidra.app.events.ProgramLocationPluginEvent;
|
||||
import ghidra.app.plugin.PluginCategoryNames;
|
||||
import ghidra.app.services.GoToService;
|
||||
import ghidra.framework.model.*;
|
||||
import ghidra.framework.model.DomainObjectChangedEvent;
|
||||
import ghidra.framework.model.DomainObjectListener;
|
||||
import ghidra.framework.plugintool.*;
|
||||
import ghidra.framework.plugintool.util.PluginStatus;
|
||||
import ghidra.program.model.listing.Program;
|
||||
import ghidra.program.util.ChangeManager;
|
||||
import ghidra.util.table.SelectionNavigationAction;
|
||||
import ghidra.util.table.actions.MakeProgramSelectionAction;
|
||||
|
||||
|
@ -102,12 +105,8 @@ public class RelocationTablePlugin extends Plugin implements DomainObjectListene
|
|||
|
||||
@Override
|
||||
public void domainObjectChanged(DomainObjectChangedEvent ev) {
|
||||
if (ev.containsEvent(ChangeManager.DOCR_IMAGE_BASE_CHANGED) ||
|
||||
ev.containsEvent(ChangeManager.DOCR_RELOCATION_ADDED) ||
|
||||
ev.containsEvent(DomainObject.DO_OBJECT_RESTORED)) {
|
||||
if (ev.contains(IMAGE_BASE_CHANGED, RELOCATION_ADDED, RESTORED)) {
|
||||
provider.setProgram(currentProgram);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -15,6 +15,9 @@
|
|||
*/
|
||||
package ghidra.app.plugin.core.scalartable;
|
||||
|
||||
import static ghidra.framework.model.DomainObjectEvent.*;
|
||||
import static ghidra.program.util.ProgramEvent.*;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import docking.action.DockingAction;
|
||||
|
@ -27,12 +30,12 @@ import ghidra.app.events.ViewChangedPluginEvent;
|
|||
import ghidra.app.plugin.PluginCategoryNames;
|
||||
import ghidra.app.plugin.ProgramPlugin;
|
||||
import ghidra.app.services.GoToService;
|
||||
import ghidra.framework.model.*;
|
||||
import ghidra.framework.model.DomainObjectChangedEvent;
|
||||
import ghidra.framework.model.DomainObjectListener;
|
||||
import ghidra.framework.plugintool.PluginInfo;
|
||||
import ghidra.framework.plugintool.PluginTool;
|
||||
import ghidra.framework.plugintool.util.PluginStatus;
|
||||
import ghidra.program.model.listing.Program;
|
||||
import ghidra.program.util.ChangeManager;
|
||||
import ghidra.util.HelpLocation;
|
||||
import ghidra.util.table.actions.DeleteTableRowAction;
|
||||
import ghidra.util.task.SwingUpdateManager;
|
||||
|
@ -98,9 +101,7 @@ public class ScalarSearchPlugin extends ProgramPlugin implements DomainObjectLis
|
|||
*/
|
||||
@Override
|
||||
public void domainObjectChanged(DomainObjectChangedEvent ev) {
|
||||
if (ev.containsEvent(DomainObject.DO_OBJECT_RESTORED) ||
|
||||
ev.containsEvent(ChangeManager.DOCR_CODE_ADDED) ||
|
||||
ev.containsEvent(ChangeManager.DOCR_CODE_REMOVED)) {
|
||||
if (ev.contains(RESTORED, CODE_ADDED, CODE_REMOVED)) {
|
||||
reloadUpdateMgr.update();
|
||||
}
|
||||
}
|
||||
|
@ -147,9 +148,9 @@ public class ScalarSearchPlugin extends ProgramPlugin implements DomainObjectLis
|
|||
};
|
||||
|
||||
searchAction.setHelpLocation(new HelpLocation(this.getName(), "Scalar_Search"));
|
||||
searchAction.setMenuBarData(new MenuData(
|
||||
new String[] { ToolConstants.MENU_SEARCH, "For Scalars..." }, null, "search for", -1,
|
||||
"Scalars"));
|
||||
searchAction.setMenuBarData(
|
||||
new MenuData(new String[] { ToolConstants.MENU_SEARCH, "For Scalars..." }, null,
|
||||
"search for", -1, "Scalars"));
|
||||
searchAction.setDescription("Search program for scalars");
|
||||
searchAction.addToWindowWhen(NavigatableActionContext.class);
|
||||
tool.addAction(searchAction);
|
||||
|
|
|
@ -28,8 +28,8 @@ import ghidra.program.model.listing.Function;
|
|||
import ghidra.program.model.listing.Program;
|
||||
import ghidra.program.model.symbol.Symbol;
|
||||
import ghidra.program.model.symbol.SymbolType;
|
||||
import ghidra.program.util.ChangeManager;
|
||||
import ghidra.program.util.ProgramChangeRecord;
|
||||
import ghidra.program.util.ProgramEvent;
|
||||
import ghidra.util.InvalidNameException;
|
||||
import ghidra.util.Msg;
|
||||
|
||||
|
@ -185,50 +185,55 @@ public class StackEditorProvider extends CompositeEditorProvider implements Doma
|
|||
int recordCount = event.numRecords();
|
||||
for (int i = 0; i < recordCount; i++) {
|
||||
DomainObjectChangeRecord rec = event.getChangeRecord(i);
|
||||
int eventType = rec.getEventType();
|
||||
switch (eventType) {
|
||||
case DomainObject.DO_OBJECT_RESTORED:
|
||||
Object source = event.getSource();
|
||||
if (source instanceof Program) {
|
||||
Program restoredProgram = (Program) source;
|
||||
domainObjectRestored(restoredProgram);
|
||||
}
|
||||
return;
|
||||
case ChangeManager.DOCR_FUNCTION_REMOVED:
|
||||
Function func = (Function) ((ProgramChangeRecord) rec).getObject();
|
||||
if (func == function) {
|
||||
this.dispose();
|
||||
tool.setStatusInfo("Stack Editor was closed for " + getName());
|
||||
}
|
||||
return;
|
||||
case ChangeManager.DOCR_SYMBOL_RENAMED:
|
||||
case ChangeManager.DOCR_SYMBOL_DATA_CHANGED:
|
||||
Symbol sym = (Symbol) ((ProgramChangeRecord) rec).getObject();
|
||||
SymbolType symType = sym.getSymbolType();
|
||||
if (symType == SymbolType.LABEL) {
|
||||
if (sym.isPrimary() && sym.getAddress().equals(function.getEntryPoint())) {
|
||||
EventType eventType = rec.getEventType();
|
||||
if (eventType == DomainObjectEvent.RESTORED) {
|
||||
Object source = event.getSource();
|
||||
if (source instanceof Program) {
|
||||
Program restoredProgram = (Program) source;
|
||||
domainObjectRestored(restoredProgram);
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (eventType instanceof ProgramEvent type) {
|
||||
switch (type) {
|
||||
case FUNCTION_REMOVED:
|
||||
Function func = (Function) ((ProgramChangeRecord) rec).getObject();
|
||||
if (func == function) {
|
||||
this.dispose();
|
||||
tool.setStatusInfo("Stack Editor was closed for " + getName());
|
||||
}
|
||||
return;
|
||||
case SYMBOL_RENAMED:
|
||||
case SYMBOL_DATA_CHANGED:
|
||||
Symbol sym = (Symbol) ((ProgramChangeRecord) rec).getObject();
|
||||
SymbolType symType = sym.getSymbolType();
|
||||
if (symType == SymbolType.LABEL) {
|
||||
if (sym.isPrimary() &&
|
||||
sym.getAddress().equals(function.getEntryPoint())) {
|
||||
refreshName();
|
||||
}
|
||||
}
|
||||
else if (inCurrentFunction(rec)) {
|
||||
reloadFunction();
|
||||
}
|
||||
break;
|
||||
case FUNCTION_CHANGED:
|
||||
case SYMBOL_ADDED:
|
||||
case SYMBOL_REMOVED:
|
||||
case SYMBOL_ADDRESS_CHANGED:
|
||||
if (inCurrentFunction(rec)) {
|
||||
reloadFunction();
|
||||
}
|
||||
break;
|
||||
case SYMBOL_PRIMARY_STATE_CHANGED:
|
||||
sym = (Symbol) ((ProgramChangeRecord) rec).getObject();
|
||||
symType = sym.getSymbolType();
|
||||
if (symType == SymbolType.LABEL &&
|
||||
sym.getAddress().equals(function.getEntryPoint())) {
|
||||
refreshName();
|
||||
}
|
||||
}
|
||||
else if (inCurrentFunction(rec)) {
|
||||
reloadFunction();
|
||||
}
|
||||
break;
|
||||
case ChangeManager.DOCR_FUNCTION_CHANGED:
|
||||
case ChangeManager.DOCR_SYMBOL_ADDED:
|
||||
case ChangeManager.DOCR_SYMBOL_REMOVED:
|
||||
case ChangeManager.DOCR_SYMBOL_ADDRESS_CHANGED:
|
||||
if (inCurrentFunction(rec)) {
|
||||
reloadFunction();
|
||||
}
|
||||
break;
|
||||
case ChangeManager.DOCR_SYMBOL_SET_AS_PRIMARY:
|
||||
sym = (Symbol) ((ProgramChangeRecord) rec).getObject();
|
||||
symType = sym.getSymbolType();
|
||||
if (symType == SymbolType.LABEL &&
|
||||
sym.getAddress().equals(function.getEntryPoint())) {
|
||||
refreshName();
|
||||
}
|
||||
default:
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,6 +15,9 @@
|
|||
*/
|
||||
package ghidra.app.plugin.core.strings;
|
||||
|
||||
import static ghidra.framework.model.DomainObjectEvent.*;
|
||||
import static ghidra.program.util.ProgramEvent.*;
|
||||
|
||||
import javax.swing.Icon;
|
||||
|
||||
import docking.action.DockingAction;
|
||||
|
@ -112,9 +115,10 @@ public class ViewStringsPlugin extends ProgramPlugin implements DomainObjectList
|
|||
.enabledWhen(vsac -> vsac.getCount() > 0)
|
||||
.onAction(vsac -> {
|
||||
try {
|
||||
DataSettingsDialog dialog = vsac.getCount() == 1
|
||||
? new DataSettingsDialog(vsac.getSelectedData())
|
||||
: new DataSettingsDialog(vsac.getProgram(), vsac.getProgramSelection());
|
||||
DataSettingsDialog dialog =
|
||||
vsac.getCount() == 1 ? new DataSettingsDialog(vsac.getSelectedData())
|
||||
: new DataSettingsDialog(vsac.getProgram(),
|
||||
vsac.getProgramSelection());
|
||||
|
||||
tool.showDialog(dialog);
|
||||
dialog.dispose();
|
||||
|
@ -187,10 +191,7 @@ public class ViewStringsPlugin extends ProgramPlugin implements DomainObjectList
|
|||
@Override
|
||||
public void domainObjectChanged(DomainObjectChangedEvent ev) {
|
||||
|
||||
if (ev.containsEvent(DomainObject.DO_OBJECT_RESTORED) ||
|
||||
ev.containsEvent(ChangeManager.DOCR_MEMORY_BLOCK_MOVED) ||
|
||||
ev.containsEvent(ChangeManager.DOCR_MEMORY_BLOCK_REMOVED) ||
|
||||
ev.containsEvent(ChangeManager.DOCR_DATA_TYPE_CHANGED)) {
|
||||
if (ev.contains(RESTORED, MEMORY_BLOCK_MOVED, MEMORY_BLOCK_REMOVED, DATA_TYPE_CHANGED)) {
|
||||
markDataAsStale();
|
||||
return;
|
||||
}
|
||||
|
@ -199,23 +200,26 @@ public class ViewStringsPlugin extends ProgramPlugin implements DomainObjectList
|
|||
|
||||
DomainObjectChangeRecord doRecord = ev.getChangeRecord(i);
|
||||
Object newValue = doRecord.getNewValue();
|
||||
switch (doRecord.getEventType()) {
|
||||
case ChangeManager.DOCR_CODE_REMOVED:
|
||||
ProgramChangeRecord pcRec = (ProgramChangeRecord) doRecord;
|
||||
provider.remove(pcRec.getStart(), pcRec.getEnd());
|
||||
break;
|
||||
case ChangeManager.DOCR_CODE_ADDED:
|
||||
if (newValue instanceof Data) {
|
||||
provider.add((Data) newValue);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
//Msg.info(this, "Unhandled event type: " + doRecord.getEventType());
|
||||
break;
|
||||
EventType eventType = doRecord.getEventType();
|
||||
if (eventType instanceof ProgramEvent type) {
|
||||
switch (type) {
|
||||
case CODE_REMOVED:
|
||||
ProgramChangeRecord pcRec = (ProgramChangeRecord) doRecord;
|
||||
provider.remove(pcRec.getStart(), pcRec.getEnd());
|
||||
break;
|
||||
case CODE_ADDED:
|
||||
if (newValue instanceof Data) {
|
||||
provider.add((Data) newValue);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
//Msg.info(this, "Unhandled event type: " + doRecord.getEventType());
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (ev.containsEvent(ChangeManager.DOCR_DATA_TYPE_SETTING_CHANGED)) {
|
||||
if (ev.contains(ProgramEvent.DATA_TYPE_SETTING_CHANGED)) {
|
||||
// Unusual code: because the table model goes directly to the settings values
|
||||
// during each repaint, we don't need to figure out which row was changed.
|
||||
provider.getComponent().repaint();
|
||||
|
|
|
@ -15,6 +15,8 @@
|
|||
*/
|
||||
package ghidra.app.plugin.core.symboltree;
|
||||
|
||||
import static ghidra.program.util.ProgramEvent.*;
|
||||
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.datatransfer.Clipboard;
|
||||
import java.awt.datatransfer.ClipboardOwner;
|
||||
|
@ -672,49 +674,52 @@ public class SymbolTreeProvider extends ComponentProviderAdapter {
|
|||
return;
|
||||
}
|
||||
|
||||
if (event.containsEvent(DomainObject.DO_OBJECT_RESTORED)) {
|
||||
if (event.contains(DomainObjectEvent.RESTORED)) {
|
||||
rebuildTree();
|
||||
return;
|
||||
}
|
||||
if (!event.contains(SYMBOL_RENAMED, SYMBOL_DATA_CHANGED, SYMBOL_SCOPE_CHANGED,
|
||||
FUNCTION_CHANGED, SYMBOL_ADDED, SYMBOL_REMOVED, EXTERNAL_ENTRY_ADDED,
|
||||
EXTERNAL_ENTRY_REMOVED)) {
|
||||
return;
|
||||
}
|
||||
|
||||
int recordCount = event.numRecords();
|
||||
for (int i = 0; i < recordCount; i++) {
|
||||
DomainObjectChangeRecord rec = event.getChangeRecord(i);
|
||||
int eventType = rec.getEventType();
|
||||
EventType eventType = rec.getEventType();
|
||||
|
||||
Object object = null;
|
||||
Object affectedObject = null;
|
||||
if (rec instanceof ProgramChangeRecord) {
|
||||
object = ((ProgramChangeRecord) rec).getObject();
|
||||
affectedObject = ((ProgramChangeRecord) rec).getObject();
|
||||
}
|
||||
|
||||
if (eventType == ChangeManager.DOCR_SYMBOL_RENAMED) {
|
||||
Symbol symbol = (Symbol) object;
|
||||
if (eventType == SYMBOL_RENAMED) {
|
||||
Symbol symbol = (Symbol) affectedObject;
|
||||
symbolChanged(symbol, (String) rec.getOldValue());
|
||||
}
|
||||
else if (eventType == ChangeManager.DOCR_SYMBOL_DATA_CHANGED ||
|
||||
eventType == ChangeManager.DOCR_SYMBOL_SCOPE_CHANGED ||
|
||||
eventType == ChangeManager.DOCR_FUNCTION_CHANGED) {
|
||||
else if (eventType == SYMBOL_DATA_CHANGED || eventType == SYMBOL_SCOPE_CHANGED ||
|
||||
eventType == FUNCTION_CHANGED) {
|
||||
|
||||
Symbol symbol = null;
|
||||
if (object instanceof Symbol) {
|
||||
symbol = (Symbol) object;
|
||||
if (affectedObject instanceof Symbol) {
|
||||
symbol = (Symbol) affectedObject;
|
||||
}
|
||||
else if (object instanceof Namespace) {
|
||||
symbol = ((Namespace) object).getSymbol();
|
||||
else if (affectedObject instanceof Namespace) {
|
||||
symbol = ((Namespace) affectedObject).getSymbol();
|
||||
}
|
||||
|
||||
symbolChanged(symbol, symbol.getName());
|
||||
}
|
||||
else if (eventType == ChangeManager.DOCR_SYMBOL_ADDED) {
|
||||
else if (eventType == SYMBOL_ADDED) {
|
||||
Symbol symbol = (Symbol) rec.getNewValue();
|
||||
symbolAdded(symbol);
|
||||
}
|
||||
else if (eventType == ChangeManager.DOCR_SYMBOL_REMOVED) {
|
||||
Symbol symbol = (Symbol) object;
|
||||
else if (eventType == SYMBOL_REMOVED) {
|
||||
Symbol symbol = (Symbol) affectedObject;
|
||||
symbolRemoved(symbol);
|
||||
}
|
||||
else if (eventType == ChangeManager.DOCR_EXTERNAL_ENTRY_POINT_ADDED ||
|
||||
eventType == ChangeManager.DOCR_EXTERNAL_ENTRY_POINT_REMOVED) {
|
||||
else if (eventType == EXTERNAL_ENTRY_ADDED || eventType == EXTERNAL_ENTRY_REMOVED) {
|
||||
ProgramChangeRecord programChangeRecord = (ProgramChangeRecord) rec;
|
||||
Address address = programChangeRecord.getStart();
|
||||
SymbolTable symbolTable = program.getSymbolTable();
|
||||
|
|
|
@ -15,6 +15,9 @@
|
|||
*/
|
||||
package ghidra.app.plugin.core.symtable;
|
||||
|
||||
import static ghidra.framework.model.DomainObjectEvent.*;
|
||||
import static ghidra.program.util.ProgramEvent.*;
|
||||
|
||||
import java.awt.Cursor;
|
||||
import java.awt.event.KeyEvent;
|
||||
|
||||
|
@ -39,8 +42,8 @@ import ghidra.program.model.address.Address;
|
|||
import ghidra.program.model.listing.Data;
|
||||
import ghidra.program.model.listing.Program;
|
||||
import ghidra.program.model.symbol.*;
|
||||
import ghidra.program.util.ChangeManager;
|
||||
import ghidra.program.util.ProgramChangeRecord;
|
||||
import ghidra.program.util.ProgramEvent;
|
||||
import ghidra.util.table.GhidraTable;
|
||||
import ghidra.util.table.SelectionNavigationAction;
|
||||
import ghidra.util.table.actions.MakeProgramSelectionAction;
|
||||
|
@ -209,10 +212,7 @@ public class SymbolTablePlugin extends Plugin implements DomainObjectListener {
|
|||
return;
|
||||
}
|
||||
|
||||
if (ev.containsEvent(DomainObject.DO_OBJECT_RESTORED) ||
|
||||
ev.containsEvent(ChangeManager.DOCR_MEMORY_BLOCK_ADDED) ||
|
||||
ev.containsEvent(ChangeManager.DOCR_MEMORY_BLOCK_REMOVED)) {
|
||||
|
||||
if (ev.contains(RESTORED, MEMORY_BLOCK_ADDED, MEMORY_BLOCK_REMOVED)) {
|
||||
reload();
|
||||
return;
|
||||
}
|
||||
|
@ -221,81 +221,82 @@ public class SymbolTablePlugin extends Plugin implements DomainObjectListener {
|
|||
for (int i = 0; i < eventCnt; ++i) {
|
||||
DomainObjectChangeRecord doRecord = ev.getChangeRecord(i);
|
||||
|
||||
int eventType = doRecord.getEventType();
|
||||
if (!(doRecord instanceof ProgramChangeRecord)) {
|
||||
EventType eventType = doRecord.getEventType();
|
||||
if (!(doRecord instanceof ProgramChangeRecord rec)) {
|
||||
continue;
|
||||
}
|
||||
if (eventType instanceof ProgramEvent type) {
|
||||
switch (type) {
|
||||
case CODE_ADDED:
|
||||
case CODE_REMOVED:
|
||||
if (rec.getNewValue() instanceof Data) {
|
||||
domainObjectWorker.schedule(
|
||||
new CodeAddedRemoveJob(currentProgram, rec.getStart()));
|
||||
}
|
||||
break;
|
||||
|
||||
ProgramChangeRecord rec = (ProgramChangeRecord) doRecord;
|
||||
switch (eventType) {
|
||||
case ChangeManager.DOCR_CODE_ADDED:
|
||||
case ChangeManager.DOCR_CODE_REMOVED:
|
||||
if (rec.getNewValue() instanceof Data) {
|
||||
case SYMBOL_ADDED:
|
||||
// NOTE: DOCR_SYMBOL_ADDED events are never generated for reference-based
|
||||
// dynamic label symbols. Reference events must be used to check for existence
|
||||
// of a dynamic label symbol.
|
||||
Symbol symbol = (Symbol) rec.getNewValue();
|
||||
domainObjectWorker.schedule(new SymbolAddedJob(currentProgram, symbol));
|
||||
break;
|
||||
|
||||
case SYMBOL_REMOVED:
|
||||
|
||||
Address removeAddr = rec.getStart();
|
||||
Long symbolID = (Long) rec.getNewValue();
|
||||
domainObjectWorker.schedule(
|
||||
new SymbolRemovedJob(currentProgram, removeAddr, symbolID));
|
||||
break;
|
||||
|
||||
case SYMBOL_RENAMED:
|
||||
case SYMBOL_SCOPE_CHANGED:
|
||||
case SYMBOL_DATA_CHANGED:
|
||||
|
||||
symbol = (Symbol) rec.getObject();
|
||||
domainObjectWorker.schedule(new SymbolChangedJob(currentProgram, symbol));
|
||||
break;
|
||||
|
||||
case SYMBOL_SOURCE_CHANGED:
|
||||
|
||||
symbol = (Symbol) rec.getObject();
|
||||
domainObjectWorker
|
||||
.schedule(new CodeAddedRemoveJob(currentProgram, rec.getStart()));
|
||||
}
|
||||
break;
|
||||
.schedule(new SymbolSourceChangedJob(currentProgram, symbol));
|
||||
break;
|
||||
|
||||
case ChangeManager.DOCR_SYMBOL_ADDED:
|
||||
// NOTE: DOCR_SYMBOL_ADDED events are never generated for reference-based
|
||||
// dynamic label symbols. Reference events must be used to check for existence
|
||||
// of a dynamic label symbol.
|
||||
Symbol symbol = (Symbol) rec.getNewValue();
|
||||
domainObjectWorker.schedule(new SymbolAddedJob(currentProgram, symbol));
|
||||
break;
|
||||
case SYMBOL_PRIMARY_STATE_CHANGED:
|
||||
|
||||
case ChangeManager.DOCR_SYMBOL_REMOVED:
|
||||
symbol = (Symbol) rec.getNewValue();
|
||||
Symbol oldPrimarySymbol = (Symbol) rec.getOldValue();
|
||||
domainObjectWorker.schedule(
|
||||
new SymbolSetAsPrimaryJob(currentProgram, symbol, oldPrimarySymbol));
|
||||
break;
|
||||
|
||||
Address removeAddr = rec.getStart();
|
||||
Long symbolID = (Long) rec.getNewValue();
|
||||
domainObjectWorker
|
||||
.schedule(new SymbolRemovedJob(currentProgram, removeAddr, symbolID));
|
||||
break;
|
||||
case SYMBOL_ASSOCIATION_ADDED:
|
||||
case SYMBOL_ASSOCIATION_REMOVED:
|
||||
break;
|
||||
case REFERENCE_ADDED:
|
||||
|
||||
case ChangeManager.DOCR_SYMBOL_RENAMED:
|
||||
case ChangeManager.DOCR_SYMBOL_SCOPE_CHANGED:
|
||||
case ChangeManager.DOCR_SYMBOL_DATA_CHANGED:
|
||||
Reference ref = (Reference) rec.getObject();
|
||||
domainObjectWorker.schedule(new ReferenceAddedJob(currentProgram, ref));
|
||||
break;
|
||||
|
||||
symbol = (Symbol) rec.getObject();
|
||||
domainObjectWorker.schedule(new SymbolChangedJob(currentProgram, symbol));
|
||||
break;
|
||||
case REFERENCE_REMOVED:
|
||||
|
||||
case ChangeManager.DOCR_SYMBOL_SOURCE_CHANGED:
|
||||
ref = (Reference) rec.getObject();
|
||||
domainObjectWorker.schedule(new ReferenceRemovedJob(currentProgram, ref));
|
||||
break;
|
||||
|
||||
symbol = (Symbol) rec.getObject();
|
||||
domainObjectWorker.schedule(new SymbolSourceChangedJob(currentProgram, symbol));
|
||||
break;
|
||||
case EXTERNAL_ENTRY_ADDED:
|
||||
case EXTERNAL_ENTRY_REMOVED:
|
||||
|
||||
case ChangeManager.DOCR_SYMBOL_SET_AS_PRIMARY:
|
||||
|
||||
symbol = (Symbol) rec.getNewValue();
|
||||
Symbol oldPrimarySymbol = (Symbol) rec.getOldValue();
|
||||
domainObjectWorker.schedule(
|
||||
new SymbolSetAsPrimaryJob(currentProgram, symbol, oldPrimarySymbol));
|
||||
break;
|
||||
|
||||
case ChangeManager.DOCR_SYMBOL_ASSOCIATION_ADDED:
|
||||
case ChangeManager.DOCR_SYMBOL_ASSOCIATION_REMOVED:
|
||||
break;
|
||||
case ChangeManager.DOCR_MEM_REFERENCE_ADDED:
|
||||
|
||||
Reference ref = (Reference) rec.getObject();
|
||||
domainObjectWorker.schedule(new ReferenceAddedJob(currentProgram, ref));
|
||||
break;
|
||||
|
||||
case ChangeManager.DOCR_MEM_REFERENCE_REMOVED:
|
||||
|
||||
ref = (Reference) rec.getObject();
|
||||
domainObjectWorker.schedule(new ReferenceRemovedJob(currentProgram, ref));
|
||||
break;
|
||||
|
||||
case ChangeManager.DOCR_EXTERNAL_ENTRY_POINT_ADDED:
|
||||
case ChangeManager.DOCR_EXTERNAL_ENTRY_POINT_REMOVED:
|
||||
|
||||
Address address = rec.getStart();
|
||||
domainObjectWorker
|
||||
.schedule(new ExternalEntryChangedJob(currentProgram, address));
|
||||
break;
|
||||
Address address = rec.getStart();
|
||||
domainObjectWorker
|
||||
.schedule(new ExternalEntryChangedJob(currentProgram, address));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -466,9 +467,8 @@ public class SymbolTablePlugin extends Plugin implements DomainObjectListener {
|
|||
};
|
||||
instructionsFromAction.setDescription("Instructions From");
|
||||
instructionsFromAction.setSelected(false);
|
||||
instructionsFromAction
|
||||
.setToolBarData(
|
||||
new ToolBarData(new GIcon("icon.plugin.symboltable.instructions.from"), null));
|
||||
instructionsFromAction.setToolBarData(
|
||||
new ToolBarData(new GIcon("icon.plugin.symboltable.instructions.from"), null));
|
||||
|
||||
tool.addLocalAction(refProvider, instructionsFromAction);
|
||||
|
||||
|
@ -490,9 +490,8 @@ public class SymbolTablePlugin extends Plugin implements DomainObjectListener {
|
|||
};
|
||||
dataFromAction.setDescription("Data From");
|
||||
dataFromAction.setSelected(false);
|
||||
dataFromAction
|
||||
.setToolBarData(
|
||||
new ToolBarData(new GIcon("icon.plugin.symboltable.data.from"), null));
|
||||
dataFromAction.setToolBarData(
|
||||
new ToolBarData(new GIcon("icon.plugin.symboltable.data.from"), null));
|
||||
|
||||
tool.addLocalAction(refProvider, dataFromAction);
|
||||
}
|
||||
|
|
|
@ -16,7 +16,6 @@
|
|||
package ghidra.app.plugin.debug;
|
||||
|
||||
import java.awt.Font;
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.Date;
|
||||
|
||||
import ghidra.app.DeveloperPluginPackage;
|
||||
|
@ -26,8 +25,6 @@ import ghidra.framework.model.*;
|
|||
import ghidra.framework.plugintool.*;
|
||||
import ghidra.framework.plugintool.util.PluginStatus;
|
||||
import ghidra.program.model.listing.Program;
|
||||
import ghidra.program.util.*;
|
||||
import ghidra.util.datastruct.IntObjectHashtable;
|
||||
import help.Help;
|
||||
import help.HelpService;
|
||||
|
||||
|
@ -50,7 +47,6 @@ public class DomainEventDisplayPlugin extends Plugin implements DomainObjectList
|
|||
|
||||
private Program currentProgram;
|
||||
private DomainEventComponentProvider provider;
|
||||
private IntObjectHashtable<String> eventHt;
|
||||
private String padString;
|
||||
|
||||
/**
|
||||
|
@ -60,7 +56,6 @@ public class DomainEventDisplayPlugin extends Plugin implements DomainObjectList
|
|||
|
||||
super(tool);
|
||||
|
||||
eventHt = new IntObjectHashtable<>();
|
||||
String dateStr = new Date() + ": ";
|
||||
padString = dateStr.replaceAll(".", " ");
|
||||
|
||||
|
@ -105,7 +100,7 @@ public class DomainEventDisplayPlugin extends Plugin implements DomainObjectList
|
|||
@Override
|
||||
public void domainObjectChanged(DomainObjectChangedEvent ev) {
|
||||
if (tool != null && provider.isVisible()) {
|
||||
update(ev);
|
||||
outputEvent(ev);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -128,99 +123,13 @@ public class DomainEventDisplayPlugin extends Plugin implements DomainObjectList
|
|||
}
|
||||
|
||||
/**
|
||||
* Apply the updates that are in the change event.
|
||||
* Display the change event.
|
||||
*/
|
||||
private void update(DomainObjectChangedEvent event) {
|
||||
private void outputEvent(DomainObjectChangedEvent event) {
|
||||
for (int i = 0; i < event.numRecords(); i++) {
|
||||
String s = null;
|
||||
String start = null;
|
||||
String end = null;
|
||||
String oldValue = null;
|
||||
String newValue = null;
|
||||
String affectedObj = null;
|
||||
DomainObjectChangeRecord changeRecord = event.getChangeRecord(i);
|
||||
String dateStr = new Date() + ": ";
|
||||
int eventType = 0;
|
||||
|
||||
DomainObjectChangeRecord docr = event.getChangeRecord(i);
|
||||
eventType = docr.getEventType();
|
||||
if (docr instanceof ProgramChangeRecord) {
|
||||
ProgramChangeRecord record = (ProgramChangeRecord) docr;
|
||||
|
||||
try {
|
||||
start = "" + record.getStart();
|
||||
end = "" + record.getEnd();
|
||||
oldValue = "" + record.getOldValue();
|
||||
newValue = "" + record.getNewValue();
|
||||
affectedObj = "" + record.getObject();
|
||||
}
|
||||
catch (Exception e) {
|
||||
s = dateStr + getEventName(eventType) + " (" + eventType +
|
||||
") => *** Event data is not available ***\n";
|
||||
}
|
||||
}
|
||||
else if (docr instanceof CodeUnitPropertyChangeRecord) {
|
||||
CodeUnitPropertyChangeRecord record = (CodeUnitPropertyChangeRecord) docr;
|
||||
s = dateStr + getEventName(eventType) + " (" + eventType + ") ==> propertyName = " +
|
||||
record.getPropertyName() + ", code unit address = " + record.getAddress() +
|
||||
" old value = " + record.getOldValue() + ", new value = " +
|
||||
record.getNewValue() + "\n";
|
||||
}
|
||||
else {
|
||||
s = getEventName(eventType, DomainObject.class);
|
||||
if (s != null) {
|
||||
s = dateStr + "DomainObject Event (" + eventType + "): " + s + "\n";
|
||||
}
|
||||
}
|
||||
if (s == null) {
|
||||
s = dateStr + getEventName(eventType) + " (" + eventType + ") => start param = " +
|
||||
start + ", end param = " + end + "\n" + padString + "old value = " + oldValue +
|
||||
", new value = " + newValue + ", affected object = " + affectedObj +
|
||||
", (source=" + event.getSource() + ")\n";
|
||||
}
|
||||
provider.displayEvent(s);
|
||||
provider.displayEvent(dateStr + changeRecord + "\n");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Use reflection to get the name of the given eventType.
|
||||
*/
|
||||
private String getEventName(int eventType) {
|
||||
|
||||
String eventName = eventHt.get(eventType);
|
||||
if (eventName != null) {
|
||||
return eventName;
|
||||
}
|
||||
eventName = getEventName(eventType, ChangeManager.class);
|
||||
|
||||
if (eventName == null) {
|
||||
// could be from the DomainObject class...
|
||||
eventName = getEventName(eventType, DomainObject.class);
|
||||
}
|
||||
|
||||
eventHt.put(eventType, eventName);
|
||||
return eventName;
|
||||
}
|
||||
|
||||
private String getEventName(int eventType, Class<?> c) {
|
||||
String eventName = null;
|
||||
Field[] fields = c.getFields();
|
||||
for (Field field : fields) {
|
||||
try {
|
||||
Object obj = field.get(null);
|
||||
int value = field.getInt(obj);
|
||||
if (eventType == value) {
|
||||
eventName = field.getName();
|
||||
break;
|
||||
}
|
||||
}
|
||||
catch (IllegalArgumentException e) {
|
||||
//ignore
|
||||
}
|
||||
catch (IllegalAccessException e) {
|
||||
//ignore
|
||||
}
|
||||
}
|
||||
return eventName;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -92,11 +92,11 @@ public class PropertyManagerPlugin extends ProgramPlugin implements DomainObject
|
|||
|
||||
DomainObjectChangeRecord record = ev.getChangeRecord(i);
|
||||
|
||||
int eventType = record.getEventType();
|
||||
if (eventType == DomainObject.DO_OBJECT_RESTORED ||
|
||||
eventType == ChangeManager.DOCR_MEMORY_BLOCK_MOVED ||
|
||||
eventType == ChangeManager.DOCR_MEMORY_BLOCK_REMOVED ||
|
||||
eventType == ChangeManager.DOCR_CODE_UNIT_PROPERTY_ALL_REMOVED) {
|
||||
EventType eventType = record.getEventType();
|
||||
if (eventType == DomainObjectEvent.RESTORED ||
|
||||
eventType == ProgramEvent.MEMORY_BLOCK_MOVED ||
|
||||
eventType == ProgramEvent.MEMORY_BLOCK_REMOVED ||
|
||||
eventType == ProgramEvent.CODE_UNIT_PROPERTY_ALL_REMOVED) {
|
||||
affectedByChange = true;
|
||||
break;
|
||||
}
|
||||
|
@ -110,20 +110,11 @@ public class PropertyManagerPlugin extends ProgramPlugin implements DomainObject
|
|||
}
|
||||
|
||||
CodeUnitPropertyChangeRecord pcr = (CodeUnitPropertyChangeRecord) record;
|
||||
Address addr = pcr.getAddress();
|
||||
if (addr != null) {
|
||||
if (currentSelection.contains(addr)) {
|
||||
affectedByChange = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else {
|
||||
addr = pcr.getStartAddress();
|
||||
Address endAddr = pcr.getEndAddress();
|
||||
if (addr != null && endAddr != null && currentSelection.intersects(addr, endAddr)) {
|
||||
affectedByChange = true;
|
||||
break;
|
||||
}
|
||||
Address start = pcr.getStart();
|
||||
Address end = pcr.getEnd();
|
||||
if (start != null && end != null && currentSelection.intersects(start, end)) {
|
||||
affectedByChange = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -15,6 +15,8 @@
|
|||
*/
|
||||
package ghidra.app.util.viewer.listingpanel;
|
||||
|
||||
import static ghidra.program.util.ProgramEvent.*;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.math.BigInteger;
|
||||
import java.util.HashMap;
|
||||
|
@ -28,7 +30,6 @@ import ghidra.framework.model.DomainObjectListener;
|
|||
import ghidra.program.database.IntRangeMap;
|
||||
import ghidra.program.model.address.Address;
|
||||
import ghidra.program.model.listing.Program;
|
||||
import ghidra.program.util.ChangeManager;
|
||||
import ghidra.util.ColorUtils;
|
||||
|
||||
/**
|
||||
|
@ -113,10 +114,8 @@ public class PropertyBasedBackgroundColorModel
|
|||
|
||||
@Override
|
||||
public void domainObjectChanged(DomainObjectChangedEvent ev) {
|
||||
if (ev.containsEvent(ChangeManager.DOCR_INT_ADDRESS_SET_PROPERTY_MAP_ADDED) ||
|
||||
ev.containsEvent(ChangeManager.DOCR_INT_ADDRESS_SET_PROPERTY_MAP_REMOVED)) {
|
||||
if (ev.contains(INT_PROPERTY_MAP_ADDED, INT_PROPERTY_MAP_REMOVED)) {
|
||||
colorMap = program.getIntRangeMap(COLOR_PROPERTY_NAME);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -486,7 +486,7 @@ public abstract class AbstractEditorTest extends AbstractGhidraHeadedIntegration
|
|||
protected class RestoreListener implements DomainObjectListener {
|
||||
@Override
|
||||
public void domainObjectChanged(DomainObjectChangedEvent event) {
|
||||
if (event.containsEvent(DomainObject.DO_OBJECT_RESTORED)) {
|
||||
if (event.contains(DomainObjectEvent.RESTORED)) {
|
||||
Object source = event.getSource();
|
||||
if (source instanceof DataTypeManagerDomainObject) {
|
||||
DataTypeManagerDomainObject restoredDomainObject =
|
||||
|
|
|
@ -389,7 +389,7 @@ public class MultiTabPluginTest extends AbstractGhidraHeadedIntegrationTest {
|
|||
renameProgramFile(p, newName);
|
||||
ArrayList<DomainObjectChangeRecord> changeRecs = new ArrayList<>();
|
||||
changeRecs.add(
|
||||
new DomainObjectChangeRecord(DomainObject.DO_OBJECT_RENAMED, oldName, p.getName()));
|
||||
new DomainObjectChangeRecord(DomainObjectEvent.RENAMED, oldName, p.getName()));
|
||||
DomainObjectChangedEvent ev = new DomainObjectChangedEvent(p, changeRecs);
|
||||
runSwing(() -> env.getPlugin(MultiTabPlugin.class).domainObjectChanged(ev));
|
||||
|
||||
|
|
|
@ -137,7 +137,7 @@ public class PositiveStackEditorProviderTest extends AbstractStackEditorTest {
|
|||
*/
|
||||
@Override
|
||||
public void domainObjectChanged(DomainObjectChangedEvent event) {
|
||||
if (event.containsEvent(DomainObject.DO_OBJECT_RESTORED)) {
|
||||
if (event.contains(DomainObjectEvent.RESTORED)) {
|
||||
Object source = event.getSource();
|
||||
if (source instanceof DataTypeManagerDomainObject) {
|
||||
DataTypeManagerDomainObject restoredDomainObject =
|
||||
|
|
|
@ -27,7 +27,7 @@ import ghidra.program.database.ProgramDB;
|
|||
import ghidra.program.model.data.Category;
|
||||
import ghidra.program.model.data.Enum;
|
||||
import ghidra.program.model.data.EnumDataType;
|
||||
import ghidra.program.util.ChangeManager;
|
||||
import ghidra.program.util.ProgramEvent;
|
||||
import ghidra.test.AbstractGhidraHeadedIntegrationTest;
|
||||
import ghidra.util.task.TaskMonitor;
|
||||
|
||||
|
@ -386,7 +386,7 @@ public class EnumTest extends AbstractGhidraHeadedIntegrationTest {
|
|||
public void domainObjectChanged(DomainObjectChangedEvent ev) {
|
||||
for (int i = 0; i < ev.numRecords(); i++) {
|
||||
DomainObjectChangeRecord rec = ev.getChangeRecord(i);
|
||||
if (rec.getEventType() == ChangeManager.DOCR_DATA_TYPE_CHANGED) {
|
||||
if (rec.getEventType() == ProgramEvent.DATA_TYPE_CHANGED) {
|
||||
++count;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,6 +15,8 @@
|
|||
*/
|
||||
package ghidra.program.database.function;
|
||||
|
||||
import static ghidra.program.util.FunctionChangeRecord.FunctionChangeType.*;
|
||||
import static ghidra.program.util.ProgramEvent.*;
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
@ -37,10 +39,9 @@ import ghidra.program.model.listing.*;
|
|||
import ghidra.program.model.listing.Function.FunctionUpdateType;
|
||||
import ghidra.program.model.mem.MemoryBlock;
|
||||
import ghidra.program.model.symbol.*;
|
||||
import ghidra.program.util.ChangeManager;
|
||||
import ghidra.program.util.ProgramChangeRecord;
|
||||
import ghidra.program.util.*;
|
||||
import ghidra.program.util.FunctionChangeRecord.FunctionChangeType;
|
||||
import ghidra.test.AbstractGhidraHeadedIntegrationTest;
|
||||
import ghidra.util.exception.DuplicateNameException;
|
||||
import ghidra.util.exception.InvalidInputException;
|
||||
import ghidra.util.task.TaskMonitor;
|
||||
|
||||
|
@ -59,8 +60,8 @@ public class FunctionDBTest extends AbstractGhidraHeadedIntegrationTest
|
|||
private ArrayList<ProgramChangeRecord> captureRecords = new ArrayList<>();
|
||||
|
||||
private String captureFuncName;
|
||||
private int captureEventType;
|
||||
private int captureSubEvent;// not used if -1
|
||||
private EventType captureEventType;
|
||||
private FunctionChangeType captureChangeType;
|
||||
|
||||
public FunctionDBTest() {
|
||||
super();
|
||||
|
@ -75,8 +76,7 @@ public class FunctionDBTest extends AbstractGhidraHeadedIntegrationTest
|
|||
space = program.getAddressFactory().getDefaultAddressSpace();
|
||||
transactionID = program.startTransaction("Test");
|
||||
program.getMemory()
|
||||
.createInitializedBlock("test", addr(100), 500, (byte) 0,
|
||||
TaskMonitor.DUMMY, false);
|
||||
.createInitializedBlock("test", addr(100), 500, (byte) 0, TaskMonitor.DUMMY, false);
|
||||
functionManager = program.getFunctionManager();
|
||||
}
|
||||
|
||||
|
@ -94,31 +94,38 @@ public class FunctionDBTest extends AbstractGhidraHeadedIntegrationTest
|
|||
public void domainObjectChanged(DomainObjectChangedEvent ev) {
|
||||
for (int i = 0; i < ev.numRecords(); i++) {
|
||||
DomainObjectChangeRecord rec = ev.getChangeRecord(i);
|
||||
if (!(rec instanceof ProgramChangeRecord)) {
|
||||
if (!(rec instanceof ProgramChangeRecord pcRec)) {
|
||||
continue;
|
||||
}
|
||||
ProgramChangeRecord pcRec = (ProgramChangeRecord) rec;
|
||||
if (captureFuncName != null &&
|
||||
rec.getEventType() == ChangeManager.DOCR_FUNCTION_CHANGED &&
|
||||
!captureFuncName.equals(((Function) pcRec.getObject()).getName())) {
|
||||
EventType eventType = rec.getEventType();
|
||||
if (eventType != captureEventType) {
|
||||
continue;
|
||||
}
|
||||
if (rec.getEventType() == captureEventType &&
|
||||
(captureSubEvent == -1 || rec.getSubEventType() == captureSubEvent)) {
|
||||
captureRecords.add(pcRec);
|
||||
lastCaptureRecord = pcRec;
|
||||
|
||||
if (eventType == FUNCTION_CHANGED) {
|
||||
FunctionChangeRecord funRecord = (FunctionChangeRecord) rec;
|
||||
Function function = funRecord.getFunction();
|
||||
if (captureChangeType != null &&
|
||||
funRecord.getSpecificChangeType() != captureChangeType) {
|
||||
continue;
|
||||
}
|
||||
if (captureFuncName != null && !captureFuncName.equals(function.getName())) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
captureRecords.add(pcRec);
|
||||
lastCaptureRecord = pcRec;
|
||||
}
|
||||
}
|
||||
|
||||
private void captureFunctionChangeEvent(String funcName, int subEvent) {
|
||||
captureChangeEvent(ChangeManager.DOCR_FUNCTION_CHANGED, subEvent);
|
||||
private void captureFunctionChangeEvent(String funcName, FunctionChangeType changeType) {
|
||||
captureChangeEvent(FUNCTION_CHANGED, changeType);
|
||||
captureFuncName = funcName;
|
||||
}
|
||||
|
||||
private void captureChangeEvent(int eventType, int subEvent) {
|
||||
private void captureChangeEvent(EventType eventType, FunctionChangeType changeType) {
|
||||
captureEventType = eventType;
|
||||
captureSubEvent = subEvent;
|
||||
captureChangeType = changeType;
|
||||
program.flushEvents();
|
||||
captureRecords.clear();
|
||||
lastCaptureRecord = null;
|
||||
|
@ -130,7 +137,7 @@ public class FunctionDBTest extends AbstractGhidraHeadedIntegrationTest
|
|||
}
|
||||
|
||||
private Function createFunction(String name, Address entryPt, AddressSetView body)
|
||||
throws DuplicateNameException, InvalidInputException, OverlappingFunctionException {
|
||||
throws InvalidInputException, OverlappingFunctionException {
|
||||
|
||||
Function f = functionManager.createFunction(name, entryPt, body, SourceType.USER_DEFINED);
|
||||
assertNotNull(f);
|
||||
|
@ -141,8 +148,7 @@ public class FunctionDBTest extends AbstractGhidraHeadedIntegrationTest
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testCreateFunctionBodyRestrictions() throws Exception
|
||||
{
|
||||
public void testCreateFunctionBodyRestrictions() throws Exception {
|
||||
MemoryBlock ovBlock =
|
||||
program.getMemory().createUninitializedBlock("OV", addr(200), 100, true);
|
||||
try {
|
||||
|
@ -175,7 +181,7 @@ public class FunctionDBTest extends AbstractGhidraHeadedIntegrationTest
|
|||
public void testSetNameUser() throws Exception {
|
||||
Function f = createFunction("foo", addr(100), new AddressSet(addr(100), addr(200)));
|
||||
|
||||
captureChangeEvent(ChangeManager.DOCR_SYMBOL_RENAMED, -1);
|
||||
captureChangeEvent(ProgramEvent.SYMBOL_RENAMED, null);
|
||||
|
||||
String name = "MyFunction";
|
||||
f.setName(name, SourceType.USER_DEFINED);
|
||||
|
@ -257,7 +263,7 @@ public class FunctionDBTest extends AbstractGhidraHeadedIntegrationTest
|
|||
asv.addRange(addr(400), addr(450));
|
||||
asv.addRange(addr(500), addr(550));
|
||||
|
||||
captureChangeEvent(ChangeManager.DOCR_FUNCTION_ADDED, -1);
|
||||
captureChangeEvent(ProgramEvent.FUNCTION_ADDED, null);
|
||||
|
||||
Function f = createFunction("foo", addr(100), asv);
|
||||
|
||||
|
@ -289,7 +295,7 @@ public class FunctionDBTest extends AbstractGhidraHeadedIntegrationTest
|
|||
asv.addRange(addr(300), addr(400));
|
||||
asv.addRange(addr(10), addr(20));
|
||||
|
||||
captureChangeEvent(ChangeManager.DOCR_FUNCTION_BODY_CHANGED, -1);
|
||||
captureChangeEvent(ProgramEvent.FUNCTION_BODY_CHANGED, null);
|
||||
|
||||
f.setBody(asv);
|
||||
functionManager.invalidateCache(false);
|
||||
|
@ -597,8 +603,7 @@ public class FunctionDBTest extends AbstractGhidraHeadedIntegrationTest
|
|||
assertTrue(return1 instanceof ReturnParameterDB);
|
||||
assertTrue(Undefined.isUndefined(return1.getDataType()));
|
||||
|
||||
captureChangeEvent(ChangeManager.DOCR_FUNCTION_CHANGED,
|
||||
ChangeManager.FUNCTION_CHANGED_RETURN);
|
||||
captureChangeEvent(FUNCTION_CHANGED, RETURN_TYPE_CHANGED);
|
||||
|
||||
f.setReturnType(dt, SourceType.ANALYSIS);
|
||||
|
||||
|
@ -1263,18 +1268,15 @@ public class FunctionDBTest extends AbstractGhidraHeadedIntegrationTest
|
|||
ByteDataType bdt = new ByteDataType();
|
||||
TypeDef td = null;
|
||||
|
||||
captureChangeEvent(ChangeManager.DOCR_FUNCTION_CHANGED,
|
||||
ChangeManager.FUNCTION_CHANGED_PARAMETERS);
|
||||
captureChangeEvent(FUNCTION_CHANGED, PARAMETERS_CHANGED);
|
||||
|
||||
int localTransactionID = program.startTransaction("test");
|
||||
try {
|
||||
bdt = (ByteDataType) program.getDataTypeManager()
|
||||
.addDataType(bdt,
|
||||
DataTypeConflictHandler.DEFAULT_HANDLER);
|
||||
.addDataType(bdt, DataTypeConflictHandler.DEFAULT_HANDLER);
|
||||
td = new TypedefDataType("byteTD", bdt);
|
||||
td = (TypeDef) program.getDataTypeManager()
|
||||
.addDataType(td,
|
||||
DataTypeConflictHandler.DEFAULT_HANDLER);
|
||||
.addDataType(td, DataTypeConflictHandler.DEFAULT_HANDLER);
|
||||
AddRegisterParameterCommand cmd = new AddRegisterParameterCommand(f, reg, "reg_param_0",
|
||||
td, 0, SourceType.USER_DEFINED);
|
||||
cmd.applyTo(program);
|
||||
|
@ -1314,7 +1316,7 @@ public class FunctionDBTest extends AbstractGhidraHeadedIntegrationTest
|
|||
public void testSetStackDepthChange() throws Exception {
|
||||
Function f = createFunction("foo", addr(100), new AddressSet(addr(100), addr(200)));
|
||||
|
||||
captureChangeEvent(ChangeManager.DOCR_FUNCTION_CHANGED, -1);// TODO: no sub-event
|
||||
captureChangeEvent(FUNCTION_CHANGED, null);
|
||||
|
||||
f.setStackPurgeSize(20);
|
||||
functionManager.invalidateCache(false);
|
||||
|
@ -1338,8 +1340,7 @@ public class FunctionDBTest extends AbstractGhidraHeadedIntegrationTest
|
|||
LocalVariableImpl stackVar = new LocalVariableImpl("TestStack0", dt[0], 4, program);
|
||||
stackVar.setComment("My Comment0");
|
||||
|
||||
captureChangeEvent(ChangeManager.DOCR_FUNCTION_CHANGED,
|
||||
ChangeManager.FUNCTION_CHANGED_PARAMETERS);
|
||||
captureChangeEvent(FUNCTION_CHANGED, PARAMETERS_CHANGED);
|
||||
|
||||
assertTrue(f.addParameter(stackVar, SourceType.USER_DEFINED) instanceof ParameterDB);// causes both symbol created and function change events
|
||||
|
||||
|
@ -1350,7 +1351,7 @@ public class FunctionDBTest extends AbstractGhidraHeadedIntegrationTest
|
|||
stackVar = new LocalVariableImpl("TestStack1", dt[1], 8, program);
|
||||
stackVar.setComment("My Comment1");
|
||||
|
||||
captureChangeEvent(ChangeManager.DOCR_SYMBOL_ADDED, -1);
|
||||
captureChangeEvent(ProgramEvent.SYMBOL_ADDED, null);
|
||||
|
||||
assertTrue(f.addParameter(stackVar, SourceType.USER_DEFINED) instanceof ParameterDB);// causes both symbol created and function change events
|
||||
|
||||
|
@ -1822,8 +1823,7 @@ public class FunctionDBTest extends AbstractGhidraHeadedIntegrationTest
|
|||
Function f = createFunction("foo", addr(100), new AddressSet(addr(100), addr(200)));
|
||||
assertTrue(!f.isInline());
|
||||
|
||||
captureChangeEvent(ChangeManager.DOCR_FUNCTION_CHANGED,
|
||||
ChangeManager.FUNCTION_CHANGED_INLINE);
|
||||
captureChangeEvent(FUNCTION_CHANGED, INLINE_CHANGED);
|
||||
|
||||
f.setInline(true);
|
||||
|
||||
|
@ -1855,8 +1855,7 @@ public class FunctionDBTest extends AbstractGhidraHeadedIntegrationTest
|
|||
Function f = createFunction("foo", addr(100), new AddressSet(addr(100), addr(200)));
|
||||
assertTrue(!f.hasNoReturn());
|
||||
|
||||
captureChangeEvent(ChangeManager.DOCR_FUNCTION_CHANGED,
|
||||
ChangeManager.FUNCTION_CHANGED_NORETURN);
|
||||
captureChangeEvent(FUNCTION_CHANGED, NO_RETURN_CHANGED);
|
||||
|
||||
f.setNoReturn(true);
|
||||
|
||||
|
@ -1887,8 +1886,7 @@ public class FunctionDBTest extends AbstractGhidraHeadedIntegrationTest
|
|||
Function f = createFunction("foo", addr(100), new AddressSet(addr(100), addr(200)));
|
||||
assertNull(f.getCallFixup());
|
||||
|
||||
captureChangeEvent(ChangeManager.DOCR_FUNCTION_CHANGED,
|
||||
ChangeManager.FUNCTION_CHANGED_CALL_FIXUP);
|
||||
captureChangeEvent(FUNCTION_CHANGED, CALL_FIXUP_CHANGED);
|
||||
|
||||
f.setCallFixup("TEST");
|
||||
|
||||
|
@ -1932,7 +1930,7 @@ public class FunctionDBTest extends AbstractGhidraHeadedIntegrationTest
|
|||
f1.setReturn(ByteDataType.dataType, VariableStorage.UNASSIGNED_STORAGE,
|
||||
SourceType.USER_DEFINED);
|
||||
|
||||
captureFunctionChangeEvent("foo1", ChangeManager.FUNCTION_CHANGED_PARAMETERS);
|
||||
captureFunctionChangeEvent("foo1", PARAMETERS_CHANGED);
|
||||
|
||||
f1.addParameter(new ParameterImpl("p1", IntegerDataType.dataType, program),
|
||||
SourceType.USER_DEFINED);
|
||||
|
@ -1942,7 +1940,7 @@ public class FunctionDBTest extends AbstractGhidraHeadedIntegrationTest
|
|||
assertNotNull(lastCaptureRecord);
|
||||
assertEquals(1, captureRecords.size());
|
||||
|
||||
captureFunctionChangeEvent("FUN_00000300", -1);
|
||||
captureFunctionChangeEvent("FUN_00000300", null);
|
||||
|
||||
f1.addParameter(new ParameterImpl("p2", IntegerDataType.dataType, program),
|
||||
SourceType.USER_DEFINED);
|
||||
|
@ -1957,7 +1955,7 @@ public class FunctionDBTest extends AbstractGhidraHeadedIntegrationTest
|
|||
assertEquals("byte foo1(int p1, int p2)", f1.getPrototypeString(false, false));
|
||||
assertEquals("undefined FUN_00000300()", f2.getPrototypeString(false, false));
|
||||
|
||||
captureFunctionChangeEvent("foo1", ChangeManager.FUNCTION_CHANGED_THUNK);
|
||||
captureFunctionChangeEvent("foo1", THUNK_CHANGED);
|
||||
|
||||
f2.setThunkedFunction(f1);
|
||||
|
||||
|
@ -1980,7 +1978,7 @@ public class FunctionDBTest extends AbstractGhidraHeadedIntegrationTest
|
|||
assertEquals("byte foo1(int p1, int p2)", f1.getPrototypeString(false, false));
|
||||
assertEquals("byte foo1(int p1, int p2)", f2.getPrototypeString(false, false));// TODO: Not sure what the correct behavior should be?
|
||||
|
||||
captureChangeEvent(ChangeManager.DOCR_SYMBOL_RENAMED, -1);// two events (both functions)
|
||||
captureChangeEvent(ProgramEvent.SYMBOL_RENAMED, null);// two events (both functions)
|
||||
|
||||
f1.setName("fum", SourceType.USER_DEFINED);
|
||||
|
||||
|
@ -2001,8 +1999,7 @@ public class FunctionDBTest extends AbstractGhidraHeadedIntegrationTest
|
|||
assertEquals("foo1", pcRec.getOldValue());
|
||||
assertEquals("fum", pcRec.getNewValue());
|
||||
|
||||
captureChangeEvent(ChangeManager.DOCR_FUNCTION_CHANGED,
|
||||
ChangeManager.FUNCTION_CHANGED_PARAMETERS);// two events (both functions)
|
||||
captureChangeEvent(FUNCTION_CHANGED, PARAMETERS_CHANGED);
|
||||
|
||||
f1.addParameter(new ParameterImpl("p3", IntegerDataType.dataType, program),
|
||||
SourceType.USER_DEFINED);// add to "thunked" func
|
||||
|
@ -2023,8 +2020,7 @@ public class FunctionDBTest extends AbstractGhidraHeadedIntegrationTest
|
|||
assertEquals("fum", f.getName());
|
||||
assertEquals(addr(0x300), f.getEntryPoint());
|
||||
|
||||
captureChangeEvent(ChangeManager.DOCR_FUNCTION_CHANGED,
|
||||
ChangeManager.FUNCTION_CHANGED_PARAMETERS);// two events (both functions)
|
||||
captureChangeEvent(FUNCTION_CHANGED, PARAMETERS_CHANGED);
|
||||
|
||||
f2.addParameter(new ParameterImpl("p4", IntegerDataType.dataType, program),
|
||||
SourceType.USER_DEFINED);// add to thunk
|
||||
|
@ -2045,7 +2041,7 @@ public class FunctionDBTest extends AbstractGhidraHeadedIntegrationTest
|
|||
assertEquals("fum", f.getName());
|
||||
assertEquals(addr(0x300), f.getEntryPoint());
|
||||
|
||||
captureChangeEvent(ChangeManager.DOCR_SYMBOL_RENAMED, -1);
|
||||
captureChangeEvent(ProgramEvent.SYMBOL_RENAMED, null);
|
||||
|
||||
// Change thunk name (hides thunked function name)
|
||||
f2.setName("test", SourceType.USER_DEFINED);
|
||||
|
@ -2154,8 +2150,7 @@ public class FunctionDBTest extends AbstractGhidraHeadedIntegrationTest
|
|||
assertNotNull(symbolTable.getGlobalSymbol("LAB_Test", addr(224)));
|
||||
|
||||
assertTrue(program.getSymbolTable()
|
||||
.getPrimarySymbol(
|
||||
addr(201))
|
||||
.getPrimarySymbol(addr(201))
|
||||
.getSymbolType() != SymbolType.FUNCTION);
|
||||
}
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@ import ghidra.program.model.listing.Program;
|
|||
import ghidra.program.model.mem.Memory;
|
||||
import ghidra.program.model.mem.MemoryBlock;
|
||||
import ghidra.program.model.util.AddressSetPropertyMap;
|
||||
import ghidra.program.util.ChangeManager;
|
||||
import ghidra.program.util.ProgramEvent;
|
||||
import ghidra.test.AbstractGhidraHeadedIntegrationTest;
|
||||
import ghidra.test.TestEnv;
|
||||
import ghidra.util.exception.DuplicateNameException;
|
||||
|
@ -40,7 +40,7 @@ public class AddressSetPropertyMapTest extends AbstractGhidraHeadedIntegrationTe
|
|||
private Program program;
|
||||
private AddressFactory addrFactory;
|
||||
private int transactionID;
|
||||
private int eventType;
|
||||
private EventType eventType;
|
||||
private String mapName;
|
||||
|
||||
public AddressSetPropertyMapTest() {
|
||||
|
@ -53,36 +53,36 @@ public class AddressSetPropertyMapTest extends AbstractGhidraHeadedIntegrationTe
|
|||
return builder.getProgram();
|
||||
}
|
||||
|
||||
@Before
|
||||
public void setUp() throws Exception {
|
||||
@Before
|
||||
public void setUp() throws Exception {
|
||||
env = new TestEnv();
|
||||
program = buildProgram("notepad");
|
||||
addrFactory = program.getAddressFactory();
|
||||
transactionID = program.startTransaction("test");
|
||||
}
|
||||
|
||||
@After
|
||||
public void tearDown() throws Exception {
|
||||
@After
|
||||
public void tearDown() throws Exception {
|
||||
if (transactionID >= 0) {
|
||||
program.endTransaction(transactionID, true);
|
||||
}
|
||||
env.dispose();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetNonExistentMap() throws Exception {
|
||||
@Test
|
||||
public void testGetNonExistentMap() throws Exception {
|
||||
AddressSetPropertyMap pm = program.getAddressSetPropertyMap("MyMap");
|
||||
assertNull(pm);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCreateAddressSetMap() throws Exception {
|
||||
@Test
|
||||
public void testCreateAddressSetMap() throws Exception {
|
||||
AddressSetPropertyMap pm = program.createAddressSetPropertyMap("MyMap");
|
||||
assertNotNull(pm);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDuplicateName() throws Exception {
|
||||
@Test
|
||||
public void testDuplicateName() throws Exception {
|
||||
AddressSetPropertyMap pm = program.createAddressSetPropertyMap("MyMap");
|
||||
pm.add(getAddr(0x100), getAddr(0x200));
|
||||
try {
|
||||
|
@ -93,8 +93,8 @@ public class AddressSetPropertyMapTest extends AbstractGhidraHeadedIntegrationTe
|
|||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testAddRange() throws Exception {
|
||||
@Test
|
||||
public void testAddRange() throws Exception {
|
||||
Address start = getAddr(0x1001000);
|
||||
Address end = getAddr(0x1001005);
|
||||
AddressSetPropertyMap pm = program.createAddressSetPropertyMap("MyMap");
|
||||
|
@ -107,8 +107,8 @@ public class AddressSetPropertyMapTest extends AbstractGhidraHeadedIntegrationTe
|
|||
assertTrue(set.isEmpty());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testAddSet() throws Exception {
|
||||
@Test
|
||||
public void testAddSet() throws Exception {
|
||||
AddressSet set = new AddressSet();
|
||||
set.addRange(getAddr(0x100), getAddr(0x200));
|
||||
set.addRange(getAddr(0x400), getAddr(0x500));
|
||||
|
@ -122,8 +122,8 @@ public class AddressSetPropertyMapTest extends AbstractGhidraHeadedIntegrationTe
|
|||
assertEquals(set, pset);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRemoveRange() throws Exception {
|
||||
@Test
|
||||
public void testRemoveRange() throws Exception {
|
||||
AddressSet set = new AddressSet();
|
||||
set.addRange(getAddr(0x100), getAddr(0x200));
|
||||
set.addRange(getAddr(0x400), getAddr(0x500));
|
||||
|
@ -140,8 +140,8 @@ public class AddressSetPropertyMapTest extends AbstractGhidraHeadedIntegrationTe
|
|||
assertEquals(s, pset);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRemoveSet() throws Exception {
|
||||
@Test
|
||||
public void testRemoveSet() throws Exception {
|
||||
AddressSet set = new AddressSet();
|
||||
set.addRange(getAddr(0), getAddr(0x200));
|
||||
set.addRange(getAddr(0x205), getAddr(0x1000));
|
||||
|
@ -160,8 +160,8 @@ public class AddressSetPropertyMapTest extends AbstractGhidraHeadedIntegrationTe
|
|||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testContainsAddress() throws Exception {
|
||||
@Test
|
||||
public void testContainsAddress() throws Exception {
|
||||
AddressSet set = new AddressSet();
|
||||
set.addRange(getAddr(0), getAddr(0x200));
|
||||
set.addRange(getAddr(0x205), getAddr(0x1000));
|
||||
|
@ -175,8 +175,8 @@ public class AddressSetPropertyMapTest extends AbstractGhidraHeadedIntegrationTe
|
|||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testClear() throws Exception {
|
||||
@Test
|
||||
public void testClear() throws Exception {
|
||||
AddressSet set = new AddressSet();
|
||||
set.addRange(getAddr(0), getAddr(0x200));
|
||||
set.addRange(getAddr(0x205), getAddr(0x1000));
|
||||
|
@ -188,8 +188,8 @@ public class AddressSetPropertyMapTest extends AbstractGhidraHeadedIntegrationTe
|
|||
assertTrue(pm.getAddressSet().isEmpty());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testAddressRangeIterator() throws Exception {
|
||||
@Test
|
||||
public void testAddressRangeIterator() throws Exception {
|
||||
AddressSet set = new AddressSet();
|
||||
set.addRange(getAddr(0), getAddr(0x200));
|
||||
set.addRange(getAddr(0x205), getAddr(0x1000));
|
||||
|
@ -223,8 +223,8 @@ public class AddressSetPropertyMapTest extends AbstractGhidraHeadedIntegrationTe
|
|||
assertEquals(4, count);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testAddressIterator() throws Exception {
|
||||
@Test
|
||||
public void testAddressIterator() throws Exception {
|
||||
AddressSet set = new AddressSet();
|
||||
set.addRange(getAddr(0), getAddr(0x10));
|
||||
set.addRange(getAddr(20), getAddr(0x25));
|
||||
|
@ -241,8 +241,8 @@ public class AddressSetPropertyMapTest extends AbstractGhidraHeadedIntegrationTe
|
|||
assertNull(iter.next());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRemoveAddressSetMap() throws Exception {
|
||||
@Test
|
||||
public void testRemoveAddressSetMap() throws Exception {
|
||||
AddressSet set = new AddressSet();
|
||||
set.addRange(getAddr(0), getAddr(0x10));
|
||||
set.addRange(getAddr(20), getAddr(0x25));
|
||||
|
@ -263,15 +263,14 @@ public class AddressSetPropertyMapTest extends AbstractGhidraHeadedIntegrationTe
|
|||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSaveProgram() throws Exception {
|
||||
@Test
|
||||
public void testSaveProgram() throws Exception {
|
||||
Project project = env.getProject();
|
||||
DomainFolder rootFolder = project.getProjectData().getRootFolder();
|
||||
program.endTransaction(transactionID, true);
|
||||
transactionID = -1;
|
||||
|
||||
DomainFile df =
|
||||
rootFolder.createFile("mynotepad", program, TaskMonitor.DUMMY);
|
||||
DomainFile df = rootFolder.createFile("mynotepad", program, TaskMonitor.DUMMY);
|
||||
env.release(program);
|
||||
|
||||
AddressSet set = new AddressSet();
|
||||
|
@ -279,8 +278,7 @@ public class AddressSetPropertyMapTest extends AbstractGhidraHeadedIntegrationTe
|
|||
set.addRange(getAddr(20), getAddr(0x25));
|
||||
set.addRange(getAddr(26), getAddr(0x30));
|
||||
|
||||
Program p =
|
||||
(Program) df.getDomainObject(this, true, false, TaskMonitor.DUMMY);
|
||||
Program p = (Program) df.getDomainObject(this, true, false, TaskMonitor.DUMMY);
|
||||
int txID = p.startTransaction("test");
|
||||
try {
|
||||
AddressSetPropertyMap pm = p.createAddressSetPropertyMap("MyMap");
|
||||
|
@ -309,14 +307,14 @@ public class AddressSetPropertyMapTest extends AbstractGhidraHeadedIntegrationTe
|
|||
p.release(this);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testEvents() throws Exception {
|
||||
@Test
|
||||
public void testEvents() throws Exception {
|
||||
MyDomainObjectListener dol = new MyDomainObjectListener();
|
||||
program.addListener(dol);
|
||||
AddressSetPropertyMap pm = program.createAddressSetPropertyMap("MyMap");
|
||||
program.flushEvents();
|
||||
waitForSwing();
|
||||
assertEquals(ChangeManager.DOCR_ADDRESS_SET_PROPERTY_MAP_ADDED, eventType);
|
||||
assertEquals(ProgramEvent.ADDRESS_PROPERTY_MAP_ADDED, eventType);
|
||||
assertEquals("MyMap", mapName);
|
||||
|
||||
// map changed
|
||||
|
@ -327,13 +325,13 @@ public class AddressSetPropertyMapTest extends AbstractGhidraHeadedIntegrationTe
|
|||
pm.add(set);
|
||||
program.flushEvents();
|
||||
waitForSwing();
|
||||
assertEquals(ChangeManager.DOCR_ADDRESS_SET_PROPERTY_MAP_CHANGED, eventType);
|
||||
assertEquals(ProgramEvent.ADDRESS_PROPERTY_MAP_CHANGED, eventType);
|
||||
assertEquals("MyMap", mapName);
|
||||
|
||||
pm.remove(getAddr(0), getAddr(0x15));
|
||||
program.flushEvents();
|
||||
waitForSwing();
|
||||
assertEquals(ChangeManager.DOCR_ADDRESS_SET_PROPERTY_MAP_CHANGED, eventType);
|
||||
assertEquals(ProgramEvent.ADDRESS_PROPERTY_MAP_CHANGED, eventType);
|
||||
assertEquals("MyMap", mapName);
|
||||
|
||||
set = new AddressSet();
|
||||
|
@ -341,25 +339,25 @@ public class AddressSetPropertyMapTest extends AbstractGhidraHeadedIntegrationTe
|
|||
pm.remove(set);
|
||||
program.flushEvents();
|
||||
waitForSwing();
|
||||
assertEquals(ChangeManager.DOCR_ADDRESS_SET_PROPERTY_MAP_CHANGED, eventType);
|
||||
assertEquals(ProgramEvent.ADDRESS_PROPERTY_MAP_CHANGED, eventType);
|
||||
assertEquals("MyMap", mapName);
|
||||
|
||||
pm.clear();
|
||||
program.flushEvents();
|
||||
waitForSwing();
|
||||
assertEquals(ChangeManager.DOCR_ADDRESS_SET_PROPERTY_MAP_CHANGED, eventType);
|
||||
assertEquals(ProgramEvent.ADDRESS_PROPERTY_MAP_CHANGED, eventType);
|
||||
assertEquals("MyMap", mapName);
|
||||
|
||||
// map removed
|
||||
program.deleteAddressSetPropertyMap("MyMap");
|
||||
program.flushEvents();
|
||||
waitForSwing();
|
||||
assertEquals(ChangeManager.DOCR_ADDRESS_SET_PROPERTY_MAP_REMOVED, eventType);
|
||||
assertEquals(ProgramEvent.ADDRESS_PROPERTY_MAP_REMOVED, eventType);
|
||||
assertEquals("MyMap", mapName);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testMoveRange() throws Exception {
|
||||
@Test
|
||||
public void testMoveRange() throws Exception {
|
||||
Memory memory = program.getMemory();
|
||||
MemoryBlock block = memory.createInitializedBlock(".test", getAddr(0), 0x23, (byte) 0xa,
|
||||
TaskMonitor.DUMMY, false);
|
||||
|
@ -393,8 +391,8 @@ public class AddressSetPropertyMapTest extends AbstractGhidraHeadedIntegrationTe
|
|||
assertEquals(s, pmSet);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDeleteBlockRange() throws Exception {
|
||||
@Test
|
||||
public void testDeleteBlockRange() throws Exception {
|
||||
Memory memory = program.getMemory();
|
||||
MemoryBlock block = memory.createInitializedBlock(".test", getAddr(5), 0x20, (byte) 0xa,
|
||||
TaskMonitor.DUMMY, false);
|
||||
|
|
|
@ -28,7 +28,7 @@ import ghidra.program.model.address.*;
|
|||
import ghidra.program.model.listing.Program;
|
||||
import ghidra.program.model.mem.Memory;
|
||||
import ghidra.program.model.mem.MemoryBlock;
|
||||
import ghidra.program.util.ChangeManager;
|
||||
import ghidra.program.util.ProgramEvent;
|
||||
import ghidra.test.AbstractGhidraHeadlessIntegrationTest;
|
||||
import ghidra.test.TestEnv;
|
||||
import ghidra.util.exception.DuplicateNameException;
|
||||
|
@ -38,9 +38,8 @@ public class IntRangeMapTest extends AbstractGhidraHeadlessIntegrationTest {
|
|||
|
||||
private TestEnv env;
|
||||
private Program program;
|
||||
private AddressFactory addrFactory;
|
||||
private int transactionID;
|
||||
private int eventType;
|
||||
private EventType eventType;
|
||||
private String mapName;
|
||||
|
||||
private Program buildProgram(String programName) throws Exception {
|
||||
|
@ -53,7 +52,6 @@ public class IntRangeMapTest extends AbstractGhidraHeadlessIntegrationTest {
|
|||
public void setUp() throws Exception {
|
||||
env = new TestEnv();
|
||||
program = buildProgram("notepad");
|
||||
addrFactory = program.getAddressFactory();
|
||||
transactionID = program.startTransaction("test");
|
||||
}
|
||||
|
||||
|
@ -66,19 +64,19 @@ public class IntRangeMapTest extends AbstractGhidraHeadlessIntegrationTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testGetNonExistentMap() throws Exception {
|
||||
public void testGetNonExistentMap() throws Exception {
|
||||
IntRangeMap map = program.getIntRangeMap("MyMap");
|
||||
assertNull(map);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCreateAddressSetMap() throws Exception {
|
||||
public void testCreateAddressSetMap() throws Exception {
|
||||
IntRangeMap map = program.createIntRangeMap("MyMap");
|
||||
assertNotNull(map);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDuplicateName() throws Exception {
|
||||
public void testDuplicateName() throws Exception {
|
||||
IntRangeMap map = program.createIntRangeMap("MyMap");
|
||||
map.setValue(getAddr(0x100), getAddr(0x200), 0x11223344);
|
||||
try {
|
||||
|
@ -91,7 +89,7 @@ public class IntRangeMapTest extends AbstractGhidraHeadlessIntegrationTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testSetValueOverRange() throws Exception {
|
||||
public void testSetValueOverRange() throws Exception {
|
||||
Address start = getAddr(0x1001000);
|
||||
Address end = getAddr(0x1001005);
|
||||
IntRangeMap map = program.createIntRangeMap("MyMap");
|
||||
|
@ -108,7 +106,7 @@ public class IntRangeMapTest extends AbstractGhidraHeadlessIntegrationTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testSetValueOverAddressSet() throws Exception {
|
||||
public void testSetValueOverAddressSet() throws Exception {
|
||||
AddressSet set = new AddressSet();
|
||||
set.addRange(getAddr(0x100), getAddr(0x200));
|
||||
set.addRange(getAddr(0x400), getAddr(0x500));
|
||||
|
@ -126,7 +124,7 @@ public class IntRangeMapTest extends AbstractGhidraHeadlessIntegrationTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testRemoveRange() throws Exception {
|
||||
public void testRemoveRange() throws Exception {
|
||||
AddressSet set = new AddressSet();
|
||||
set.addRange(getAddr(0x100), getAddr(0x200));
|
||||
set.addRange(getAddr(0x400), getAddr(0x500));
|
||||
|
@ -145,7 +143,7 @@ public class IntRangeMapTest extends AbstractGhidraHeadlessIntegrationTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testRemoveSet() throws Exception {
|
||||
public void testRemoveSet() throws Exception {
|
||||
AddressSet set = new AddressSet();
|
||||
set.addRange(getAddr(0), getAddr(0x200));
|
||||
set.addRange(getAddr(0x205), getAddr(0x1000));
|
||||
|
@ -166,7 +164,7 @@ public class IntRangeMapTest extends AbstractGhidraHeadlessIntegrationTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testClearAll() throws Exception {
|
||||
public void testClearAll() throws Exception {
|
||||
AddressSet set = new AddressSet();
|
||||
set.addRange(getAddr(0), getAddr(0x200));
|
||||
set.addRange(getAddr(0x205), getAddr(0x1000));
|
||||
|
@ -181,7 +179,7 @@ public class IntRangeMapTest extends AbstractGhidraHeadlessIntegrationTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testRemoveAddressSetMap() throws Exception {
|
||||
public void testRemoveAddressSetMap() throws Exception {
|
||||
AddressSet set = new AddressSet();
|
||||
set.addRange(getAddr(0), getAddr(0x10));
|
||||
set.addRange(getAddr(20), getAddr(0x25));
|
||||
|
@ -204,21 +202,19 @@ public class IntRangeMapTest extends AbstractGhidraHeadlessIntegrationTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testSaveProgram() throws Exception {
|
||||
public void testSaveProgram() throws Exception {
|
||||
Project project = env.getProject();
|
||||
DomainFolder rootFolder = project.getProjectData().getRootFolder();
|
||||
program.endTransaction(transactionID, true);
|
||||
transactionID = -1;
|
||||
|
||||
DomainFile df =
|
||||
rootFolder.createFile("mynotepad", program, TaskMonitor.DUMMY);
|
||||
DomainFile df = rootFolder.createFile("mynotepad", program, TaskMonitor.DUMMY);
|
||||
env.release(program);
|
||||
|
||||
AddressSet set = new AddressSet();
|
||||
set.addRange(getAddr(0), getAddr(0x40));
|
||||
|
||||
Program p =
|
||||
(Program) df.getDomainObject(this, true, false, TaskMonitor.DUMMY);
|
||||
Program p = (Program) df.getDomainObject(this, true, false, TaskMonitor.DUMMY);
|
||||
int txID = p.startTransaction("test");
|
||||
int value = 0x11223344;
|
||||
int otherValue = 0x44332211;
|
||||
|
@ -249,13 +245,13 @@ public class IntRangeMapTest extends AbstractGhidraHeadlessIntegrationTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testEvents() throws Exception {
|
||||
public void testEvents() throws Exception {
|
||||
MyDomainObjectListener dol = new MyDomainObjectListener();
|
||||
program.addListener(dol);
|
||||
IntRangeMap map = program.createIntRangeMap("MyMap");
|
||||
program.flushEvents();
|
||||
waitForSwing();
|
||||
assertEquals(ChangeManager.DOCR_INT_ADDRESS_SET_PROPERTY_MAP_ADDED, eventType);
|
||||
assertEquals(ProgramEvent.INT_PROPERTY_MAP_ADDED, eventType);
|
||||
assertEquals("MyMap", mapName);
|
||||
int value = 0x11223344;
|
||||
|
||||
|
@ -267,13 +263,13 @@ public class IntRangeMapTest extends AbstractGhidraHeadlessIntegrationTest {
|
|||
map.setValue(set, value);
|
||||
program.flushEvents();
|
||||
waitForSwing();
|
||||
assertEquals(ChangeManager.DOCR_INT_ADDRESS_SET_PROPERTY_MAP_CHANGED, eventType);
|
||||
assertEquals(ProgramEvent.INT_PROPERTY_MAP_CHANGED, eventType);
|
||||
assertEquals("MyMap", mapName);
|
||||
|
||||
map.clearValue(getAddr(0), getAddr(0x15));
|
||||
program.flushEvents();
|
||||
waitForSwing();
|
||||
assertEquals(ChangeManager.DOCR_INT_ADDRESS_SET_PROPERTY_MAP_CHANGED, eventType);
|
||||
assertEquals(ProgramEvent.INT_PROPERTY_MAP_CHANGED, eventType);
|
||||
assertEquals("MyMap", mapName);
|
||||
|
||||
set = new AddressSet();
|
||||
|
@ -281,25 +277,25 @@ public class IntRangeMapTest extends AbstractGhidraHeadlessIntegrationTest {
|
|||
map.clearValue(set);
|
||||
program.flushEvents();
|
||||
waitForSwing();
|
||||
assertEquals(ChangeManager.DOCR_INT_ADDRESS_SET_PROPERTY_MAP_CHANGED, eventType);
|
||||
assertEquals(ProgramEvent.INT_PROPERTY_MAP_CHANGED, eventType);
|
||||
assertEquals("MyMap", mapName);
|
||||
|
||||
map.clearAll();
|
||||
program.flushEvents();
|
||||
waitForSwing();
|
||||
assertEquals(ChangeManager.DOCR_INT_ADDRESS_SET_PROPERTY_MAP_CHANGED, eventType);
|
||||
assertEquals(ProgramEvent.INT_PROPERTY_MAP_CHANGED, eventType);
|
||||
assertEquals("MyMap", mapName);
|
||||
|
||||
// map removed
|
||||
program.deleteIntRangeMap("MyMap");
|
||||
program.flushEvents();
|
||||
waitForSwing();
|
||||
assertEquals(ChangeManager.DOCR_INT_ADDRESS_SET_PROPERTY_MAP_REMOVED, eventType);
|
||||
assertEquals(ProgramEvent.INT_PROPERTY_MAP_REMOVED, eventType);
|
||||
assertEquals("MyMap", mapName);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testMoveRange() throws Exception {
|
||||
public void testMoveRange() throws Exception {
|
||||
Memory memory = program.getMemory();
|
||||
MemoryBlock block = memory.createInitializedBlock(".test", getAddr(0), 0x23, (byte) 0xa,
|
||||
TaskMonitor.DUMMY, false);
|
||||
|
@ -335,7 +331,7 @@ public class IntRangeMapTest extends AbstractGhidraHeadlessIntegrationTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testDeleteBlockRange() throws Exception {
|
||||
public void testDeleteBlockRange() throws Exception {
|
||||
Memory memory = program.getMemory();
|
||||
MemoryBlock block = memory.createInitializedBlock(".test", getAddr(5), 0x20, (byte) 0xa,
|
||||
TaskMonitor.DUMMY, false);
|
||||
|
|
|
@ -15,6 +15,9 @@
|
|||
*/
|
||||
package ghidra.app.plugin.core.byteviewer;
|
||||
|
||||
import static ghidra.framework.model.DomainObjectEvent.*;
|
||||
import static ghidra.program.util.ProgramEvent.*;
|
||||
|
||||
import java.awt.event.*;
|
||||
import java.math.BigInteger;
|
||||
import java.util.List;
|
||||
|
@ -39,7 +42,8 @@ import ghidra.framework.plugintool.PluginTool;
|
|||
import ghidra.program.model.address.Address;
|
||||
import ghidra.program.model.listing.CodeUnit;
|
||||
import ghidra.program.model.listing.Program;
|
||||
import ghidra.program.util.*;
|
||||
import ghidra.program.util.ProgramLocation;
|
||||
import ghidra.program.util.ProgramSelection;
|
||||
import ghidra.util.HelpLocation;
|
||||
import ghidra.util.classfinder.ClassSearcher;
|
||||
import ghidra.util.datastruct.WeakDataStructureFactory;
|
||||
|
@ -534,8 +538,7 @@ public class ProgramByteViewerComponentProvider extends ByteViewerComponentProvi
|
|||
public void domainObjectChanged(DomainObjectChangedEvent event) {
|
||||
|
||||
if (blockSet != null) {
|
||||
if (event.containsEvent(DomainObject.DO_OBJECT_SAVED) ||
|
||||
event.containsEvent(DomainObject.DO_DOMAIN_FILE_CHANGED)) {
|
||||
if (event.contains(SAVED, FILE_CHANGED)) {
|
||||
// drop all changes
|
||||
|
||||
blockSet.setByteBlockChangeManager(newByteBlockChangeManager(blockSet, null));
|
||||
|
@ -543,13 +546,8 @@ public class ProgramByteViewerComponentProvider extends ByteViewerComponentProvi
|
|||
}
|
||||
}
|
||||
|
||||
if (event.containsEvent(DomainObject.DO_OBJECT_RESTORED) ||
|
||||
event.containsEvent(ChangeManager.DOCR_MEMORY_BLOCK_CHANGED) ||
|
||||
event.containsEvent(ChangeManager.DOCR_MEMORY_BLOCK_ADDED) ||
|
||||
event.containsEvent(ChangeManager.DOCR_MEMORY_BLOCK_MOVED) ||
|
||||
event.containsEvent(ChangeManager.DOCR_MEMORY_BLOCK_REMOVED) ||
|
||||
event.containsEvent(ChangeManager.DOCR_MEMORY_BLOCKS_JOINED) ||
|
||||
event.containsEvent(ChangeManager.DOCR_MEMORY_BLOCK_SPLIT)) {
|
||||
if (event.contains(RESTORED, MEMORY_BLOCK_CHANGED, MEMORY_BLOCK_ADDED, MEMORY_BLOCK_MOVED,
|
||||
MEMORY_BLOCK_REMOVED, MEMORY_BLOCKS_JOINED, MEMORY_BLOCK_SPLIT)) {
|
||||
|
||||
// call plugin to update data models
|
||||
memoryConfigurationChanged();
|
||||
|
@ -557,9 +555,7 @@ public class ProgramByteViewerComponentProvider extends ByteViewerComponentProvi
|
|||
// changeManager, so get out now.
|
||||
}
|
||||
|
||||
if (event.containsEvent(ChangeManager.DOCR_MEMORY_BYTES_CHANGED) ||
|
||||
event.containsEvent(ChangeManager.DOCR_CODE_ADDED) ||
|
||||
event.containsEvent(ChangeManager.DOCR_MEM_REFERENCE_ADDED)) {
|
||||
if (event.contains(MEMORY_BYTES_CHANGED, CODE_ADDED, REFERENCE_ADDED)) {
|
||||
updateManager.update();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,12 +15,14 @@
|
|||
*/
|
||||
package ghidra.app.decompiler.component;
|
||||
|
||||
import static ghidra.framework.model.DomainObjectEvent.*;
|
||||
import static ghidra.program.util.ProgramEvent.*;
|
||||
|
||||
import java.util.Iterator;
|
||||
|
||||
import ghidra.framework.model.*;
|
||||
import ghidra.program.database.SpecExtension;
|
||||
import ghidra.program.model.listing.Program;
|
||||
import ghidra.program.util.ChangeManager;
|
||||
import ghidra.util.task.SwingUpdateManager;
|
||||
|
||||
/**
|
||||
|
@ -58,16 +60,14 @@ public class DecompilerProgramListener implements DomainObjectListener {
|
|||
public void domainObjectChanged(DomainObjectChangedEvent ev) {
|
||||
// Check for events that signal that a decompiler process' data is stale
|
||||
// and if so force a new process to be spawned
|
||||
if (ev.containsEvent(ChangeManager.DOCR_MEMORY_BLOCK_ADDED) ||
|
||||
ev.containsEvent(ChangeManager.DOCR_MEMORY_BLOCK_REMOVED) ||
|
||||
ev.containsEvent(DomainObject.DO_OBJECT_RESTORED)) {
|
||||
if (ev.contains(MEMORY_BLOCK_ADDED, MEMORY_BLOCK_REMOVED, RESTORED)) {
|
||||
controller.resetDecompiler();
|
||||
}
|
||||
else if (ev.containsEvent(DomainObject.DO_PROPERTY_CHANGED)) {
|
||||
else if (ev.contains(DomainObjectEvent.PROPERTY_CHANGED)) {
|
||||
Iterator<DomainObjectChangeRecord> iter = ev.iterator();
|
||||
while (iter.hasNext()) {
|
||||
DomainObjectChangeRecord record = iter.next();
|
||||
if (record.getEventType() == DomainObject.DO_PROPERTY_CHANGED) {
|
||||
if (record.getEventType() == DomainObjectEvent.PROPERTY_CHANGED) {
|
||||
if (record.getOldValue() instanceof String) {
|
||||
String value = (String) record.getOldValue();
|
||||
if (value.startsWith(SpecExtension.SPEC_EXTENSION)) {
|
||||
|
|
|
@ -15,6 +15,9 @@
|
|||
*/
|
||||
package ghidra.app.plugin.core.functiongraph;
|
||||
|
||||
import static ghidra.framework.model.DomainObjectEvent.*;
|
||||
import static ghidra.program.util.ProgramEvent.*;
|
||||
|
||||
import java.awt.event.MouseEvent;
|
||||
import java.util.*;
|
||||
import java.util.function.Supplier;
|
||||
|
@ -605,30 +608,26 @@ public class FGProvider extends VisualGraphComponentProvider<FGVertex, FGEdge, F
|
|||
// Note: since we are not looping and we are using 'else if's, order is important!
|
||||
//
|
||||
|
||||
if (ev.containsEvent(DomainObject.DO_OBJECT_RESTORED) ||
|
||||
ev.containsEvent(ChangeManager.DOCR_FUNCTION_BODY_CHANGED)) {
|
||||
if (ev.contains(RESTORED, FUNCTION_BODY_CHANGED)) {
|
||||
if (graphDataMissing()) {
|
||||
controller.clear();
|
||||
return; // something really destructive has happened--give up!
|
||||
}
|
||||
|
||||
graphChangedButNotRebuilt = !handleObjectRestored(ev, rebuildGraphOnChanges);
|
||||
}
|
||||
else if (ev.containsEvent(ChangeManager.DOCR_SYMBOL_ADDED) ||
|
||||
ev.containsEvent(ChangeManager.DOCR_SYMBOL_REMOVED)) {
|
||||
else if (ev.contains(SYMBOL_ADDED, SYMBOL_REMOVED)) {
|
||||
|
||||
if (currentGraphContainsEventAddress(ev)) {
|
||||
graphChangedButNotRebuilt = !handleSymbolAddedRemoved(ev, rebuildGraphOnChanges);
|
||||
}
|
||||
}
|
||||
else if (ev.containsEvent(ChangeManager.DOCR_MEM_REFERENCE_ADDED) ||
|
||||
ev.containsEvent(ChangeManager.DOCR_MEM_REFERENCE_REMOVED)) {
|
||||
else if (ev.contains(REFERENCE_ADDED, REFERENCE_REMOVED)) {
|
||||
|
||||
if (currentGraphContainsReferenceChangedEvent(ev)) {
|
||||
graphChangedButNotRebuilt = !handleReferenceAddedRemoved(ev, rebuildGraphOnChanges);
|
||||
}
|
||||
}
|
||||
else if (ev.containsEvent(ChangeManager.DOCR_SYMBOL_RENAMED)) {
|
||||
else if (ev.contains(SYMBOL_RENAMED)) {
|
||||
handleSymbolRenamed(ev);
|
||||
}
|
||||
|
||||
|
@ -664,7 +663,7 @@ public class FGProvider extends VisualGraphComponentProvider<FGVertex, FGEdge, F
|
|||
}
|
||||
|
||||
private void updateGraphForAffectedAddresses(DomainObjectChangedEvent ev) {
|
||||
if (ev.containsEvent(DomainObject.DO_OBJECT_RESTORED)) {
|
||||
if (ev.contains(DomainObjectEvent.RESTORED)) {
|
||||
controller.invalidateAllCacheForProgram(currentProgram);
|
||||
return;
|
||||
}
|
||||
|
@ -709,11 +708,11 @@ public class FGProvider extends VisualGraphComponentProvider<FGVertex, FGEdge, F
|
|||
// Do we need to modify the affected vertex?
|
||||
//
|
||||
for (DomainObjectChangeRecord record : ev) {
|
||||
int eventType = record.getEventType();
|
||||
if (eventType == ChangeManager.DOCR_MEM_REFERENCE_ADDED) {
|
||||
EventType eventType = record.getEventType();
|
||||
if (eventType == ProgramEvent.REFERENCE_ADDED) {
|
||||
handleReferenceAdded(record);
|
||||
}
|
||||
else if (eventType == ChangeManager.DOCR_MEM_REFERENCE_REMOVED) {
|
||||
else if (eventType == ProgramEvent.REFERENCE_REMOVED) {
|
||||
handleReferenceRemoved(record);
|
||||
}
|
||||
}
|
||||
|
@ -817,11 +816,11 @@ public class FGProvider extends VisualGraphComponentProvider<FGVertex, FGEdge, F
|
|||
// Do we need to modify the affected vertex?
|
||||
//
|
||||
for (DomainObjectChangeRecord record : ev) {
|
||||
int eventType = record.getEventType();
|
||||
if (eventType == ChangeManager.DOCR_SYMBOL_ADDED) {
|
||||
EventType eventType = record.getEventType();
|
||||
if (eventType == ProgramEvent.SYMBOL_ADDED) {
|
||||
handleSymbolAdded(record);
|
||||
}
|
||||
else if (eventType == ChangeManager.DOCR_SYMBOL_REMOVED) {
|
||||
else if (eventType == ProgramEvent.SYMBOL_REMOVED) {
|
||||
handleSymbolRemoved(record);
|
||||
}
|
||||
}
|
||||
|
@ -930,8 +929,8 @@ public class FGProvider extends VisualGraphComponentProvider<FGVertex, FGEdge, F
|
|||
private void handleSymbolRenamed(DomainObjectChangedEvent ev) {
|
||||
for (int i = 0; i < ev.numRecords(); i++) {
|
||||
DomainObjectChangeRecord record = ev.getChangeRecord(i);
|
||||
int eventType = record.getEventType();
|
||||
if (eventType == ChangeManager.DOCR_SYMBOL_RENAMED) {
|
||||
EventType eventType = record.getEventType();
|
||||
if (eventType == ProgramEvent.SYMBOL_RENAMED) {
|
||||
Address address = getChangedAddress(record);
|
||||
if (address != null) {
|
||||
controller.refreshDisplayForAddress(address);
|
||||
|
@ -982,15 +981,15 @@ public class FGProvider extends VisualGraphComponentProvider<FGVertex, FGEdge, F
|
|||
FunctionGraph graph = functionGraphData.getFunctionGraph();
|
||||
|
||||
for (DomainObjectChangeRecord record : ev) {
|
||||
int eventType = record.getEventType();
|
||||
if (eventType == ChangeManager.DOCR_MEM_REFERENCE_ADDED) {
|
||||
EventType eventType = record.getEventType();
|
||||
if (eventType == ProgramEvent.REFERENCE_ADDED) {
|
||||
Reference reference = (Reference) record.getNewValue();
|
||||
Address toAddress = reference.getToAddress();
|
||||
if (graph.getVertexForAddress(toAddress) != null) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else if (eventType == ChangeManager.DOCR_MEM_REFERENCE_REMOVED) {
|
||||
else if (eventType == ProgramEvent.REFERENCE_REMOVED) {
|
||||
Reference reference = (Reference) record.getOldValue();
|
||||
Address toAddress = reference.getToAddress();
|
||||
if (graph.getVertexForAddress(toAddress) != null) {
|
||||
|
|
|
@ -145,7 +145,7 @@ class ApplyDiffCommand extends BackgroundCommand implements AnalysisWorker {
|
|||
};
|
||||
// // The events were disabled while doing apply Diff. Now re-enable them by firing object restored event.
|
||||
// ((DomainObjectAdapter)currentProgram).fireEvent(new DomainObjectChangeRecord(
|
||||
// DomainObject.DO_OBJECT_RESTORED));
|
||||
// DomainObjectEvent.RESTORED));
|
||||
// ((DomainObjectAdapter)currentProgram).flushEvents();
|
||||
if (!monitor.isCancelled()) {
|
||||
SwingUtilities.invokeLater(r);
|
||||
|
|
|
@ -22,7 +22,7 @@ import java.util.*;
|
|||
|
||||
import db.*;
|
||||
import ghidra.feature.vt.api.impl.MarkupItemStorage;
|
||||
import ghidra.feature.vt.api.impl.VTChangeManager;
|
||||
import ghidra.feature.vt.api.impl.VTEvent;
|
||||
import ghidra.feature.vt.api.main.*;
|
||||
import ghidra.feature.vt.api.util.VTAssociationStatusException;
|
||||
import ghidra.program.database.DBObjectCache;
|
||||
|
@ -245,7 +245,7 @@ public class AssociationDatabaseManager implements VTAssociationManager {
|
|||
finally {
|
||||
lock.release();
|
||||
}
|
||||
session.setChanged(VTChangeManager.DOCR_VT_ASSOCIATION_ADDED, null, newAssociation);
|
||||
session.setChanged(VTEvent.ASSOCIATION_ADDED, null, newAssociation);
|
||||
return newAssociation;
|
||||
}
|
||||
|
||||
|
@ -254,8 +254,7 @@ public class AssociationDatabaseManager implements VTAssociationManager {
|
|||
long id = existingAssociation.getKey();
|
||||
try {
|
||||
associationTableAdapter.removeAssociaiton(id);
|
||||
session.setChanged(VTChangeManager.DOCR_VT_ASSOCIATION_REMOVED, existingAssociation,
|
||||
null);
|
||||
session.setChanged(VTEvent.ASSOCIATION_REMOVED, existingAssociation, null);
|
||||
}
|
||||
catch (IOException e) {
|
||||
session.dbError(e);
|
||||
|
@ -752,10 +751,9 @@ public class AssociationDatabaseManager implements VTAssociationManager {
|
|||
long sourceID = session.getLongFromSourceAddress(sourceAddress);
|
||||
long destinationID = session.getLongFromDestinationAddress(destinationAddress);
|
||||
try {
|
||||
Set<DBRecord> relatedRecords =
|
||||
associationTableAdapter
|
||||
.getRelatedAssociationRecordsBySourceAndDestinationAddress(
|
||||
sourceID, destinationID);
|
||||
Set<DBRecord> relatedRecords = associationTableAdapter
|
||||
.getRelatedAssociationRecordsBySourceAndDestinationAddress(sourceID,
|
||||
destinationID);
|
||||
for (DBRecord record : relatedRecords) {
|
||||
VTAssociationDB associationDB = getAssociationForRecord(record);
|
||||
VTAssociationStatus status = associationDB.getStatus();
|
||||
|
|
|
@ -21,7 +21,7 @@ import java.util.Collection;
|
|||
|
||||
import db.DBRecord;
|
||||
import ghidra.feature.vt.api.impl.MarkupItemManagerImpl;
|
||||
import ghidra.feature.vt.api.impl.VTChangeManager;
|
||||
import ghidra.feature.vt.api.impl.VTEvent;
|
||||
import ghidra.feature.vt.api.main.*;
|
||||
import ghidra.feature.vt.api.util.VTAssociationStatusException;
|
||||
import ghidra.program.database.DBObjectCache;
|
||||
|
@ -96,8 +96,8 @@ public class VTAssociationDB extends DatabaseObject implements VTAssociation {
|
|||
associationDBM.lock.acquire();
|
||||
try {
|
||||
checkIsValid();
|
||||
return associationDBM.getSourceAddressFromLong(
|
||||
record.getLongValue(SOURCE_ADDRESS_COL.column()));
|
||||
return associationDBM
|
||||
.getSourceAddressFromLong(record.getLongValue(SOURCE_ADDRESS_COL.column()));
|
||||
}
|
||||
finally {
|
||||
associationDBM.lock.release();
|
||||
|
@ -242,9 +242,9 @@ public class VTAssociationDB extends DatabaseObject implements VTAssociation {
|
|||
|
||||
record.setByteValue(APPLIED_STATUS_COL.column(), (byte) status.getStatusValue());
|
||||
associationDBM.updateAssociationRecord(record);
|
||||
associationDBM.getSession().setObjectChanged(
|
||||
VTChangeManager.DOCR_VT_ASSOCIATION_MARKUP_STATUS_CHANGED, this, existingStatus,
|
||||
status);
|
||||
associationDBM.getSession()
|
||||
.setObjectChanged(VTEvent.ASSOCIATION_MARKUP_STATUS_CHANGED, this,
|
||||
existingStatus, status);
|
||||
}
|
||||
finally {
|
||||
associationDBM.lock.release();
|
||||
|
@ -262,8 +262,9 @@ public class VTAssociationDB extends DatabaseObject implements VTAssociation {
|
|||
|
||||
record.setByteValue(STATUS_COL.column(), (byte) status.ordinal());
|
||||
associationDBM.updateAssociationRecord(record);
|
||||
associationDBM.getSession().setObjectChanged(
|
||||
VTChangeManager.DOCR_VT_ASSOCIATION_STATUS_CHANGED, this, existingStatus, status);
|
||||
associationDBM.getSession()
|
||||
.setObjectChanged(VTEvent.ASSOCIATION_STATUS_CHANGED, this, existingStatus,
|
||||
status);
|
||||
}
|
||||
finally {
|
||||
associationDBM.lock.release();
|
||||
|
@ -278,8 +279,8 @@ public class VTAssociationDB extends DatabaseObject implements VTAssociation {
|
|||
voteCount = Math.max(0, voteCount);
|
||||
record.setIntValue(VOTE_COUNT_COL.column(), voteCount);
|
||||
associationDBM.updateAssociationRecord(record);
|
||||
associationDBM.getSession().setObjectChanged(VTChangeManager.DOCR_VT_VOTE_COUNT_CHANGED,
|
||||
this, null, null);
|
||||
associationDBM.getSession()
|
||||
.setObjectChanged(VTEvent.VOTE_COUNT_CHANGED, this, null, null);
|
||||
}
|
||||
finally {
|
||||
associationDBM.lock.release();
|
||||
|
|
|
@ -20,7 +20,7 @@ import static ghidra.feature.vt.api.db.VTMatchTableDBAdapter.ColumnDescription.*
|
|||
import java.io.IOException;
|
||||
|
||||
import db.DBRecord;
|
||||
import ghidra.feature.vt.api.impl.VTChangeManager;
|
||||
import ghidra.feature.vt.api.impl.VTEvent;
|
||||
import ghidra.feature.vt.api.impl.VTProgramCorrelatorInfo;
|
||||
import ghidra.feature.vt.api.main.*;
|
||||
import ghidra.program.database.DBObjectCache;
|
||||
|
@ -125,8 +125,7 @@ public class VTMatchDB extends DatabaseObject implements VTMatch {
|
|||
|
||||
record.setLongValue(TAG_KEY_COL.column(), tagKey);
|
||||
updateRecord();
|
||||
session.setObjectChanged(VTChangeManager.DOCR_VT_MATCH_TAG_CHANGED, this, oldTag,
|
||||
newTagDB);
|
||||
session.setObjectChanged(VTEvent.MATCH_TAG_CHANGED, this, oldTag, newTagDB);
|
||||
}
|
||||
finally {
|
||||
lock.release();
|
||||
|
|
|
@ -64,8 +64,9 @@ public class VTMatchSetDB extends DatabaseObject implements VTMatchSet {
|
|||
return matchSetDB;
|
||||
}
|
||||
|
||||
public static VTMatchSetDB getMatchSetDB(DBRecord record, VTSessionDB session, DBHandle dbHandle,
|
||||
OpenMode openMode, TaskMonitor monitor, Lock lock) throws VersionException {
|
||||
public static VTMatchSetDB getMatchSetDB(DBRecord record, VTSessionDB session,
|
||||
DBHandle dbHandle, OpenMode openMode, TaskMonitor monitor, Lock lock)
|
||||
throws VersionException {
|
||||
|
||||
VTMatchSetDB matchSetDB = new VTMatchSetDB(record, session, dbHandle, lock);
|
||||
matchSetDB.getTableAdapters(record.getKey(), openMode, monitor);
|
||||
|
@ -177,7 +178,7 @@ public class VTMatchSetDB extends DatabaseObject implements VTMatchSet {
|
|||
lock.release();
|
||||
}
|
||||
if (newMatch != null) {
|
||||
session.setObjectChanged(VTChangeManager.DOCR_VT_MATCH_ADDED, newMatch, null, newMatch);
|
||||
session.setObjectChanged(VTEvent.MATCH_ADDED, newMatch, null, newMatch);
|
||||
}
|
||||
return newMatch;
|
||||
}
|
||||
|
@ -226,7 +227,7 @@ public class VTMatchSetDB extends DatabaseObject implements VTMatchSet {
|
|||
}
|
||||
|
||||
DeletedMatch deletedMatch = new DeletedMatch(sourceAddress, destinationAddress);
|
||||
session.setObjectChanged(VTChangeManager.DOCR_VT_MATCH_DELETED, match, deletedMatch, null);
|
||||
session.setObjectChanged(VTEvent.MATCH_DELETED, match, deletedMatch, null);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -41,7 +41,7 @@ import ghidra.util.exception.*;
|
|||
import ghidra.util.task.TaskLauncher;
|
||||
import ghidra.util.task.TaskMonitor;
|
||||
|
||||
public class VTSessionDB extends DomainObjectAdapterDB implements VTSession, VTChangeManager {
|
||||
public class VTSessionDB extends DomainObjectAdapterDB implements VTSession {
|
||||
private final static Field[] COL_FIELDS = new Field[] { StringField.INSTANCE };
|
||||
private final static String[] COL_TYPES = new String[] { "Value" };
|
||||
private final static Schema SCHEMA =
|
||||
|
@ -404,7 +404,7 @@ public class VTSessionDB extends DomainObjectAdapterDB implements VTSession, VTC
|
|||
matchSets.add(matchSet);
|
||||
changeSetsModified = true; // signal endTransaction to clear undo stack
|
||||
|
||||
setObjectChanged(VTChangeManager.DOCR_VT_MATCH_SET_ADDED, matchSet, null, matchSet);
|
||||
setObjectChanged(VTEvent.MATCH_SET_ADDED, matchSet, null, matchSet);
|
||||
|
||||
return matchSet;
|
||||
}
|
||||
|
@ -509,11 +509,16 @@ public class VTSessionDB extends DomainObjectAdapterDB implements VTSession, VTC
|
|||
return getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setChanged(int type, Object oldValue, Object newValue) {
|
||||
/**
|
||||
* Mark the state of a Version Tracking item as having changed and generate
|
||||
* the event of the specified type. Any or all parameters may be null.
|
||||
* @param eventType event type
|
||||
* @param oldValue original value or an Object that is related to the event.
|
||||
* @param newValue new value or an Object that is related to the event.
|
||||
*/
|
||||
public void setChanged(VTEvent eventType, Object oldValue, Object newValue) {
|
||||
changed = true;
|
||||
|
||||
fireEvent(new VersionTrackingChangeRecord(type, null, oldValue, newValue));
|
||||
fireEvent(new VersionTrackingChangeRecord(eventType, null, oldValue, newValue));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -525,12 +530,19 @@ public class VTSessionDB extends DomainObjectAdapterDB implements VTSession, VTC
|
|||
return matches;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setObjectChanged(int type, Object affectedObject, Object oldValue,
|
||||
/**
|
||||
* Mark the state of a Version Tracking item as having changed and generate
|
||||
* the event of the specified type. Any or all parameters may be null.
|
||||
* @param eventType event type
|
||||
* @param affected the version tracking object that was affected by the change.
|
||||
* @param oldValue original value or an Object that is related to the event.
|
||||
* @param newValue new value or an Object that is related to the event.
|
||||
*/
|
||||
public void setObjectChanged(VTEvent eventType, Object affected, Object oldValue,
|
||||
Object newValue) {
|
||||
changed = true;
|
||||
|
||||
fireEvent(new VersionTrackingChangeRecord(type, affectedObject, oldValue, newValue));
|
||||
fireEvent(new VersionTrackingChangeRecord(eventType, affected, oldValue, newValue));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -581,7 +593,7 @@ public class VTSessionDB extends DomainObjectAdapterDB implements VTSession, VTC
|
|||
finally {
|
||||
lock.release();
|
||||
}
|
||||
setObjectChanged(VTChangeManager.DOCR_VT_TAG_REMOVED, this, tagName, null);
|
||||
setObjectChanged(VTEvent.TAG_REMOVED, this, tagName, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -602,7 +614,7 @@ public class VTSessionDB extends DomainObjectAdapterDB implements VTSession, VTC
|
|||
finally {
|
||||
lock.release();
|
||||
}
|
||||
setObjectChanged(VTChangeManager.DOCR_VT_TAG_ADDED, matchTag, null, matchTag);
|
||||
setObjectChanged(VTEvent.TAG_ADDED, matchTag, null, matchTag);
|
||||
return matchTag;
|
||||
}
|
||||
|
||||
|
|
|
@ -46,7 +46,8 @@ public class MarkupItemImpl implements VTMarkupItem {
|
|||
private static boolean isUnApplyingItems = false;
|
||||
private static boolean gettingStatus = false;
|
||||
|
||||
public MarkupItemImpl(VTAssociation association, VTMarkupType markupType, Address sourceAddress) {
|
||||
public MarkupItemImpl(VTAssociation association, VTMarkupType markupType,
|
||||
Address sourceAddress) {
|
||||
this(new MarkupItemStorageImpl(association, markupType, sourceAddress));
|
||||
}
|
||||
|
||||
|
@ -81,16 +82,14 @@ public class MarkupItemImpl implements VTMarkupItem {
|
|||
|
||||
Address oldDestinationAddress = markupItemStorage.getDestinationAddress();
|
||||
String oldAddressSource = markupItemStorage.getDestinationAddressSource();
|
||||
boolean isResettingAddress =
|
||||
USER_DEFINED_ADDRESS_SOURCE.equals(oldAddressSource) &&
|
||||
!USER_DEFINED_ADDRESS_SOURCE.equals(addressSource);
|
||||
boolean isResettingAddress = USER_DEFINED_ADDRESS_SOURCE.equals(oldAddressSource) &&
|
||||
!USER_DEFINED_ADDRESS_SOURCE.equals(addressSource);
|
||||
|
||||
// The following validation call will change the destination address back to an
|
||||
// appropriate address if necessary.
|
||||
// (For example, function name markup must be on the entry point address.)
|
||||
address =
|
||||
markupType.validateDestinationAddress(markupItemStorage.getAssociation(),
|
||||
markupItemStorage.getSourceAddress(), address);
|
||||
address = markupType.validateDestinationAddress(markupItemStorage.getAssociation(),
|
||||
markupItemStorage.getSourceAddress(), address);
|
||||
if (SystemUtilities.isEqual(address, oldDestinationAddress)) {
|
||||
return; // Either the address wasn't changed or we won't let you change this markup address.
|
||||
}
|
||||
|
@ -110,7 +109,7 @@ public class MarkupItemImpl implements VTMarkupItem {
|
|||
|
||||
VTAssociation association = markupItemStorage.getAssociation();
|
||||
VTSessionDB session = (VTSessionDB) association.getSession();
|
||||
session.setObjectChanged(VTChangeManager.DOCR_VT_MARKUP_ITEM_DESTINATION_CHANGED, this,
|
||||
session.setObjectChanged(VTEvent.MARKUP_ITEM_DESTINATION_CHANGED, this,
|
||||
oldDestinationAddress, address);
|
||||
}
|
||||
|
||||
|
@ -127,9 +126,8 @@ public class MarkupItemImpl implements VTMarkupItem {
|
|||
if (!gettingStatus) {
|
||||
try {
|
||||
gettingStatus = true;
|
||||
boolean conflictsWithOtherMarkup =
|
||||
getMarkupType().conflictsWithOtherMarkup(this,
|
||||
getAssociation().getMarkupItems(TaskMonitor.DUMMY));
|
||||
boolean conflictsWithOtherMarkup = getMarkupType().conflictsWithOtherMarkup(
|
||||
this, getAssociation().getMarkupItems(TaskMonitor.DUMMY));
|
||||
if (conflictsWithOtherMarkup) {
|
||||
return CONFLICT;
|
||||
}
|
||||
|
@ -197,8 +195,8 @@ public class MarkupItemImpl implements VTMarkupItem {
|
|||
markupItemStorage =
|
||||
markupItemStorage.setApplyFailed("Can't apply without a valid destination");
|
||||
fireMarkupItemStatusChanged(oldStatus, FAILED_APPLY);
|
||||
throw new VersionTrackingApplyException("Cannot apply a markup item without first "
|
||||
+ "setting the destination address");
|
||||
throw new VersionTrackingApplyException(
|
||||
"Cannot apply a markup item without first " + "setting the destination address");
|
||||
}
|
||||
|
||||
if (!canApply()) {
|
||||
|
@ -309,8 +307,7 @@ public class MarkupItemImpl implements VTMarkupItem {
|
|||
VTAssociation association = getAssociation();
|
||||
VTAssociationStatus associationStatus = association.getStatus();
|
||||
try {
|
||||
Collection<VTMarkupItem> markupItems =
|
||||
association.getMarkupItems(TaskMonitor.DUMMY);
|
||||
Collection<VTMarkupItem> markupItems = association.getMarkupItems(TaskMonitor.DUMMY);
|
||||
return associationStatus.canApply() && getStatus().isAppliable() &&
|
||||
!markupType.conflictsWithOtherMarkup(this, markupItems);
|
||||
}
|
||||
|
@ -413,9 +410,8 @@ public class MarkupItemImpl implements VTMarkupItem {
|
|||
public Stringable getCurrentDestinationValue() {
|
||||
validateDestinationCache();
|
||||
if (cachedDestinationValue == null) {
|
||||
cachedDestinationValue =
|
||||
markupType.getCurrentDestinationValue(markupItemStorage.getAssociation(),
|
||||
markupItemStorage.getDestinationAddress());
|
||||
cachedDestinationValue = markupType.getCurrentDestinationValue(
|
||||
markupItemStorage.getAssociation(), markupItemStorage.getDestinationAddress());
|
||||
}
|
||||
return cachedDestinationValue;
|
||||
}
|
||||
|
@ -428,9 +424,8 @@ public class MarkupItemImpl implements VTMarkupItem {
|
|||
}
|
||||
validateDestinationCache();
|
||||
if (cachedOriginalDestinationValue == null) {
|
||||
cachedOriginalDestinationValue =
|
||||
markupType.getOriginalDestinationValue(markupItemStorage.getAssociation(),
|
||||
markupItemStorage.getDestinationAddress());
|
||||
cachedOriginalDestinationValue = markupType.getOriginalDestinationValue(
|
||||
markupItemStorage.getAssociation(), markupItemStorage.getDestinationAddress());
|
||||
}
|
||||
return cachedOriginalDestinationValue;
|
||||
}
|
||||
|
@ -443,9 +438,8 @@ public class MarkupItemImpl implements VTMarkupItem {
|
|||
}
|
||||
validateSourceCache();
|
||||
if (cachedSourceValue == null) {
|
||||
cachedSourceValue =
|
||||
markupType.getSourceValue(markupItemStorage.getAssociation(),
|
||||
markupItemStorage.getSourceAddress());
|
||||
cachedSourceValue = markupType.getSourceValue(markupItemStorage.getAssociation(),
|
||||
markupItemStorage.getSourceAddress());
|
||||
}
|
||||
return cachedSourceValue;
|
||||
}
|
||||
|
@ -470,11 +464,17 @@ public class MarkupItemImpl implements VTMarkupItem {
|
|||
}
|
||||
|
||||
private long getSourceModificationNumber() {
|
||||
return markupItemStorage.getAssociation().getSession().getSourceProgram().getModificationNumber();
|
||||
return markupItemStorage.getAssociation()
|
||||
.getSession()
|
||||
.getSourceProgram()
|
||||
.getModificationNumber();
|
||||
}
|
||||
|
||||
private long getDestinationModificationNumber() {
|
||||
return markupItemStorage.getAssociation().getSession().getDestinationProgram().getModificationNumber();
|
||||
return markupItemStorage.getAssociation()
|
||||
.getSession()
|
||||
.getDestinationProgram()
|
||||
.getModificationNumber();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -497,8 +497,8 @@ public class MarkupItemImpl implements VTMarkupItem {
|
|||
VTAssociationDB associationDB = (VTAssociationDB) association;
|
||||
associationDB.markupItemStatusChanged(this);
|
||||
VTSessionDB session = (VTSessionDB) association.getSession();
|
||||
session.setObjectChanged(VTChangeManager.DOCR_VT_MARKUP_ITEM_STATUS_CHANGED,
|
||||
markupItemStorage, oldStatus, newStatus);
|
||||
session.setObjectChanged(VTEvent.MARKUP_ITEM_STATUS_CHANGED, markupItemStorage, oldStatus,
|
||||
newStatus);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
/* ###
|
||||
* IP: GHIDRA
|
||||
* REVIEWED: YES
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -16,84 +15,117 @@
|
|||
*/
|
||||
package ghidra.feature.vt.api.impl;
|
||||
|
||||
import static ghidra.feature.vt.api.impl.VTEvent.*;
|
||||
|
||||
/**
|
||||
* Interface to define event types and the method to generate an
|
||||
* event within Version Tracking.
|
||||
* <P>
|
||||
* Note: Previously (before 11.1), VTEvent change event types were defined in this file as
|
||||
* integer constants. Event ids have since been converted to enum types. The defines in this file
|
||||
* have been converted to point to the new enum values to make it easier to convert to this new way
|
||||
* and to clearly see how the old values map to the new enums. In future releases, these defines
|
||||
* will be removed.
|
||||
*/
|
||||
public interface VTChangeManager {
|
||||
|
||||
// event types
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// MATCHES
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
public static final int DOCR_VT_MATCH_SET_ADDED = 1010;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// MATCHES
|
||||
// Deprecated version tracking event ids
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
* The status of a match item in the version tracking results has changed.
|
||||
* A version tracking match set was added
|
||||
* @deprecated Event type numeric constants have been changed to enums. Use the enum directly.
|
||||
*/
|
||||
|
||||
public static final int DOCR_VT_ASSOCIATION_STATUS_CHANGED = 1021;
|
||||
public static final int DOCR_VT_ASSOCIATION_MARKUP_STATUS_CHANGED = 1027;
|
||||
|
||||
public static final int DOCR_VT_MATCH_ADDED = 1022;
|
||||
|
||||
public static final int DOCR_VT_MATCH_DELETED = 1023;
|
||||
|
||||
public static final int DOCR_VT_MATCH_TAG_CHANGED = 1024;
|
||||
|
||||
public static final int DOCR_VT_ASSOCIATION_ADDED = 1025;
|
||||
|
||||
public static final int DOCR_VT_ASSOCIATION_REMOVED = 1026;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// MARKUP ITEMS
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
@Deprecated
|
||||
public static final VTEvent DOCR_VT_MATCH_SET_ADDED = MATCH_SET_ADDED;
|
||||
|
||||
/**
|
||||
* The status of a version tracking mark-up item has changed.
|
||||
* The association status of a match item in the version tracking results has changed
|
||||
* @deprecated Event type numeric constants have been changed to enums. Use the enum directly.
|
||||
*/
|
||||
public static final int DOCR_VT_MARKUP_ITEM_STATUS_CHANGED = 1030;
|
||||
@Deprecated
|
||||
public static final VTEvent DOCR_VT_ASSOCIATION_STATUS_CHANGED = ASSOCIATION_STATUS_CHANGED;
|
||||
|
||||
/**
|
||||
* The destination address of a version tracking mark-up item has changed.
|
||||
* The markup status of a match item in the version tracking results has changed
|
||||
* @deprecated Event type numeric constants have been changed to enums. Use the enum directly.
|
||||
*/
|
||||
public static final int DOCR_VT_MARKUP_ITEM_DESTINATION_CHANGED = 1031;
|
||||
|
||||
public static final int DOCR_VT_TAG_ADDED = 1040;
|
||||
|
||||
public static final int DOCR_VT_TAG_REMOVED = 1041;
|
||||
|
||||
public static final int DOCR_VT_VOTE_COUNT_CHANGED = 1050;
|
||||
@Deprecated
|
||||
public static final VTEvent DOCR_VT_ASSOCIATION_MARKUP_STATUS_CHANGED =
|
||||
ASSOCIATION_MARKUP_STATUS_CHANGED;
|
||||
|
||||
/**
|
||||
* Mark the state of a Version Tracking item as having changed and generate
|
||||
* the event of the specified type. Any or all parameters may be null.
|
||||
* @param type event type
|
||||
* @param oldValue original value or an Object that is related to the event.
|
||||
* @param newValue new value or an Object that is related to the event.
|
||||
* A match result was added
|
||||
* @deprecated Event type numeric constants have been changed to enums. Use the enum directly.
|
||||
*/
|
||||
public void setChanged(int type, Object oldValue, Object newValue);
|
||||
@Deprecated
|
||||
public static final VTEvent DOCR_VT_MATCH_ADDED = MATCH_ADDED;
|
||||
|
||||
/**
|
||||
* Mark the state of a Version Tracking item as having changed and generate
|
||||
* the event of the specified type. Any or all parameters may be null.
|
||||
* @param type event type
|
||||
* @param affectedObj the version tracking object that was affected by the change.
|
||||
* @param oldValue original value or an Object that is related to the event.
|
||||
* @param newValue new value or an Object that is related to the event.
|
||||
* A match result was deleted
|
||||
* @deprecated Event type numeric constants have been changed to enums. Use the enum directly.
|
||||
*/
|
||||
public void setObjectChanged(int type, Object affectedObject, Object oldValue, Object newValue);
|
||||
@Deprecated
|
||||
public static final VTEvent DOCR_VT_MATCH_DELETED = MATCH_DELETED;
|
||||
|
||||
/**
|
||||
* The tag for a match was changed
|
||||
* @deprecated Event type numeric constants have been changed to enums. Use the enum directly.
|
||||
*/
|
||||
@Deprecated
|
||||
public static final VTEvent DOCR_VT_MATCH_TAG_CHANGED = MATCH_TAG_CHANGED;
|
||||
|
||||
/**
|
||||
* A version tracking association was added
|
||||
* @deprecated Event type numeric constants have been changed to enums. Use the enum directly.
|
||||
*/
|
||||
@Deprecated
|
||||
public static final VTEvent DOCR_VT_ASSOCIATION_ADDED = ASSOCIATION_ADDED;
|
||||
|
||||
/**
|
||||
* A version tracking association was removed
|
||||
* @deprecated Event type numeric constants have been changed to enums. Use the enum directly.
|
||||
*/
|
||||
@Deprecated
|
||||
public static final VTEvent DOCR_VT_ASSOCIATION_REMOVED = ASSOCIATION_REMOVED;
|
||||
|
||||
/**
|
||||
* A markup item status was changed
|
||||
* @deprecated Event type numeric constants have been changed to enums. Use the enum directly.
|
||||
*/
|
||||
@Deprecated
|
||||
public static final VTEvent DOCR_VT_MARKUP_ITEM_STATUS_CHANGED = MARKUP_ITEM_STATUS_CHANGED;
|
||||
|
||||
/**
|
||||
* A markup item's destination changed
|
||||
* @deprecated Event type numeric constants have been changed to enums. Use the enum directly.
|
||||
*/
|
||||
@Deprecated
|
||||
public static final VTEvent DOCR_VT_MARKUP_ITEM_DESTINATION_CHANGED =
|
||||
MARKUP_ITEM_DESTINATION_CHANGED;
|
||||
|
||||
/**
|
||||
* A version tracking tag was added
|
||||
* @deprecated Event type numeric constants have been changed to enums. Use the enum directly.
|
||||
*/
|
||||
@Deprecated
|
||||
public static final VTEvent DOCR_VT_TAG_ADDED = TAG_ADDED;
|
||||
|
||||
/**
|
||||
* A version tracking tag was removed
|
||||
* @deprecated Event type numeric constants have been changed to enums. Use the enum directly.
|
||||
*/
|
||||
@Deprecated
|
||||
public static final VTEvent DOCR_VT_TAG_REMOVED = TAG_REMOVED;
|
||||
|
||||
/**
|
||||
* The vote count of a match was changed
|
||||
* @deprecated Event type numeric constants have been changed to enums. Use the enum directly.
|
||||
*/
|
||||
@Deprecated
|
||||
public static final VTEvent DOCR_VT_VOTE_COUNT_CHANGED = VOTE_COUNT_CHANGED;
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,43 @@
|
|||
/* ###
|
||||
* IP: GHIDRA
|
||||
*
|
||||
* 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.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package ghidra.feature.vt.api.impl;
|
||||
|
||||
import ghidra.framework.model.DomainObjectEventIdGenerator;
|
||||
import ghidra.framework.model.EventType;
|
||||
|
||||
public enum VTEvent implements EventType {
|
||||
MATCH_SET_ADDED, // A match set was added
|
||||
ASSOCIATION_STATUS_CHANGED, // an match association status changed
|
||||
ASSOCIATION_MARKUP_STATUS_CHANGED, // an association markup status changed
|
||||
MATCH_ADDED, // a match was added
|
||||
MATCH_DELETED, // a match was deleted
|
||||
MATCH_TAG_CHANGED, // the tag for a match changed
|
||||
ASSOCIATION_ADDED, // an association was created
|
||||
ASSOCIATION_REMOVED, // an association was deleted
|
||||
MARKUP_ITEM_STATUS_CHANGED, // a markup item's status changed
|
||||
MARKUP_ITEM_DESTINATION_CHANGED, // a markup item's destination changed
|
||||
TAG_ADDED, // a tag type was created
|
||||
TAG_REMOVED, // a tag type was deleted
|
||||
VOTE_COUNT_CHANGED; // the vote count for a match changed
|
||||
|
||||
private final int id = DomainObjectEventIdGenerator.next();
|
||||
|
||||
@Override
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
}
|
|
@ -24,19 +24,19 @@ public class VersionTrackingChangeRecord extends DomainObjectChangeRecord {
|
|||
|
||||
private final static long serialVersionUID = 1;
|
||||
|
||||
private Object affectedObj; // may be null
|
||||
private Object affected; // may be null
|
||||
|
||||
/**
|
||||
* Construct a new ProgramChangeRecord.
|
||||
* @param type event type
|
||||
* @param affectedObj the object that is the subject of this change record; may be null.
|
||||
* Construct a new VersionTrackingChangeRecord.
|
||||
* @param eventType event type
|
||||
* @param affected the object that is the subject of this change record; may be null.
|
||||
* @param oldValue the original value; may be null.
|
||||
* @param newValue the new value; may be null.
|
||||
*/
|
||||
public VersionTrackingChangeRecord(int type, Object affectedObj, Object oldValue,
|
||||
public VersionTrackingChangeRecord(VTEvent eventType, Object affected, Object oldValue,
|
||||
Object newValue) {
|
||||
super(type, oldValue, newValue);
|
||||
this.affectedObj = affectedObj;
|
||||
super(eventType, oldValue, newValue);
|
||||
this.affected = affected;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -46,11 +46,15 @@ public class VersionTrackingChangeRecord extends DomainObjectChangeRecord {
|
|||
* affected object
|
||||
*/
|
||||
public Object getObject() {
|
||||
return affectedObj;
|
||||
return affected;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return Integer.toString(getEventType());
|
||||
String s = super.toString();
|
||||
if (affected != null) {
|
||||
s += ", affected = " + affected;
|
||||
}
|
||||
return s;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,8 +15,7 @@
|
|||
*/
|
||||
package ghidra.feature.vt.gui.filters;
|
||||
|
||||
import static ghidra.feature.vt.gui.filters.Filter.FilterEditingStatus.APPLIED;
|
||||
import static ghidra.feature.vt.gui.filters.Filter.FilterEditingStatus.NONE;
|
||||
import static ghidra.feature.vt.gui.filters.Filter.FilterEditingStatus.*;
|
||||
|
||||
import java.awt.BorderLayout;
|
||||
import java.util.*;
|
||||
|
@ -25,14 +24,13 @@ import javax.swing.*;
|
|||
|
||||
import docking.widgets.label.GDLabel;
|
||||
import docking.widgets.label.GLabel;
|
||||
import ghidra.feature.vt.api.impl.VTChangeManager;
|
||||
import ghidra.feature.vt.api.impl.VTEvent;
|
||||
import ghidra.feature.vt.api.impl.VersionTrackingChangeRecord;
|
||||
import ghidra.feature.vt.api.main.*;
|
||||
import ghidra.feature.vt.gui.plugin.VTController;
|
||||
import ghidra.feature.vt.gui.plugin.VTControllerListener;
|
||||
import ghidra.feature.vt.gui.util.MatchInfo;
|
||||
import ghidra.framework.model.DomainObjectChangeRecord;
|
||||
import ghidra.framework.model.DomainObjectChangedEvent;
|
||||
import ghidra.framework.model.*;
|
||||
import ghidra.framework.options.Options;
|
||||
import ghidra.framework.options.SaveState;
|
||||
|
||||
|
@ -352,13 +350,13 @@ public class TagFilter extends AncillaryFilter<VTMatch> {
|
|||
|
||||
for (int i = 0; i < ev.numRecords(); i++) {
|
||||
DomainObjectChangeRecord doRecord = ev.getChangeRecord(i);
|
||||
int eventType = doRecord.getEventType();
|
||||
EventType eventType = doRecord.getEventType();
|
||||
|
||||
if (eventType == VTChangeManager.DOCR_VT_TAG_ADDED) {
|
||||
if (eventType == VTEvent.TAG_ADDED) {
|
||||
VersionTrackingChangeRecord vtRecord = (VersionTrackingChangeRecord) doRecord;
|
||||
tagAdded((VTMatchTag) vtRecord.getNewValue());
|
||||
}
|
||||
else if (eventType == VTChangeManager.DOCR_VT_TAG_REMOVED) {
|
||||
else if (eventType == VTEvent.TAG_REMOVED) {
|
||||
VersionTrackingChangeRecord vtRecord = (VersionTrackingChangeRecord) doRecord;
|
||||
tagRemoved((String) vtRecord.getOldValue());
|
||||
}
|
||||
|
|
|
@ -413,7 +413,7 @@ public class VTControllerImpl
|
|||
Object source = ev.getSource();
|
||||
|
||||
if (source == session) {
|
||||
if (ev.containsEvent(DomainObject.DO_OBJECT_RESTORED)) {
|
||||
if (ev.contains(DomainObjectEvent.RESTORED)) {
|
||||
matchInfoFactory.clearMatchInfoInternalCache();
|
||||
}
|
||||
}
|
||||
|
@ -434,7 +434,7 @@ public class VTControllerImpl
|
|||
}
|
||||
|
||||
private void checkForSave(DomainObjectChangedEvent ev) {
|
||||
if (!ev.containsEvent(DomainObject.DO_OBJECT_SAVED)) {
|
||||
if (!ev.contains(DomainObjectEvent.SAVED)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -628,7 +628,7 @@ public class VTControllerImpl
|
|||
session.updateDestinationProgram(newProgram);
|
||||
}
|
||||
// List<DomainObjectChangeRecord> events = new ArrayList<DomainObjectChangeRecord>();
|
||||
// events.add(new DomainObjectChangeRecord(DomainObject.DO_OBJECT_RESTORED));
|
||||
// events.add(new DomainObjectChangeRecord(DomainObjectEvent.RESTORED));
|
||||
// domainObjectChanged(new DomainObjectChangedEvent(newProgram, events));
|
||||
matchInfoFactory.clearCache();
|
||||
fireSessionChanged();
|
||||
|
|
|
@ -38,7 +38,7 @@ import ghidra.app.plugin.core.colorizer.ColorizingService;
|
|||
import ghidra.app.services.*;
|
||||
import ghidra.app.util.viewer.listingpanel.ListingPanel;
|
||||
import ghidra.app.util.viewer.util.AddressIndexMap;
|
||||
import ghidra.feature.vt.api.impl.VTChangeManager;
|
||||
import ghidra.feature.vt.api.impl.VTEvent;
|
||||
import ghidra.feature.vt.api.main.*;
|
||||
import ghidra.feature.vt.gui.actions.*;
|
||||
import ghidra.feature.vt.gui.duallisting.VTDualListingHighlightProvider;
|
||||
|
@ -352,7 +352,7 @@ public class VTSubToolManager implements VTControllerListener, OptionsChangeList
|
|||
|
||||
@Override
|
||||
public void sessionUpdated(DomainObjectChangedEvent ev) {
|
||||
if (ev.containsEvent(VTChangeManager.DOCR_VT_MARKUP_ITEM_STATUS_CHANGED)) {
|
||||
if (ev.contains(VTEvent.MARKUP_ITEM_STATUS_CHANGED)) {
|
||||
CodeViewerService service = sourceTool.getService(CodeViewerService.class);
|
||||
if (service == null) {
|
||||
return;
|
||||
|
@ -363,7 +363,7 @@ public class VTSubToolManager implements VTControllerListener, OptionsChangeList
|
|||
ListingPanel listingPanel = service.getListingPanel();
|
||||
listingPanel.repaint();
|
||||
}
|
||||
if (ev.containsEvent(DomainObject.DO_OBJECT_RESTORED)) {
|
||||
if (ev.contains(DomainObjectEvent.RESTORED)) {
|
||||
// This kicks the sub-tool highlight providers so each gets fresh
|
||||
// markup item information.
|
||||
for (VersionTrackingSubordinatePluginX pluginX : pluginList) {
|
||||
|
|
|
@ -15,7 +15,6 @@
|
|||
*/
|
||||
package ghidra.feature.vt.gui.provider.functionassociation;
|
||||
|
||||
import static ghidra.feature.vt.api.impl.VTChangeManager.*;
|
||||
import static ghidra.feature.vt.gui.provider.functionassociation.FilterSettings.*;
|
||||
|
||||
import java.awt.*;
|
||||
|
@ -43,6 +42,7 @@ import ghidra.app.plugin.core.functioncompare.FunctionComparisonPanel;
|
|||
import ghidra.app.util.viewer.listingpanel.ListingCodeComparisonPanel;
|
||||
import ghidra.app.util.viewer.listingpanel.ListingPanel;
|
||||
import ghidra.feature.vt.api.db.DeletedMatch;
|
||||
import ghidra.feature.vt.api.impl.VTEvent;
|
||||
import ghidra.feature.vt.api.impl.VersionTrackingChangeRecord;
|
||||
import ghidra.feature.vt.api.main.*;
|
||||
import ghidra.feature.vt.gui.actions.*;
|
||||
|
@ -158,8 +158,8 @@ public class VTFunctionAssociationProvider extends ComponentProviderAdapter
|
|||
Icon allFunctionsIcon = new GIcon("icon.version.tracking.function.filter.all");
|
||||
ActionState<FilterSettings> allFunctionsActionState =
|
||||
new ActionState<>("Show All Functions", allFunctionsIcon, SHOW_ALL);
|
||||
allFunctionsActionState.setHelpLocation(
|
||||
new HelpLocation("VersionTrackingPlugin", "Show_All_Functions"));
|
||||
allFunctionsActionState
|
||||
.setHelpLocation(new HelpLocation("VersionTrackingPlugin", "Show_All_Functions"));
|
||||
|
||||
Icon unmatchedIcon = new GIcon("icon.version.tracking.function.filter.unmatched");
|
||||
ActionState<FilterSettings> unmatchedOnlyActionState =
|
||||
|
@ -167,9 +167,8 @@ public class VTFunctionAssociationProvider extends ComponentProviderAdapter
|
|||
unmatchedOnlyActionState.setHelpLocation(
|
||||
new HelpLocation("VersionTrackingPlugin", "Show_Unmatched_Functions"));
|
||||
|
||||
ActionState<FilterSettings> unacceptedOnlyActionState =
|
||||
new ActionState<>("Show Only Unaccepted Match Functions",
|
||||
FILTER_NOT_ACCEPTED_ICON, SHOW_UNACCEPTED);
|
||||
ActionState<FilterSettings> unacceptedOnlyActionState = new ActionState<>(
|
||||
"Show Only Unaccepted Match Functions", FILTER_NOT_ACCEPTED_ICON, SHOW_UNACCEPTED);
|
||||
unacceptedOnlyActionState.setHelpLocation(
|
||||
new HelpLocation("VersionTrackingPlugin", "Show_Unaccepted_Functions"));
|
||||
|
||||
|
@ -448,8 +447,8 @@ public class VTFunctionAssociationProvider extends ComponentProviderAdapter
|
|||
sourceThreadedTablePanel = new GhidraThreadedTablePanel<>(sourceFunctionsModel, 1000);
|
||||
sourceFunctionsTable = sourceThreadedTablePanel.getTable();
|
||||
sourceFunctionsTable.setName("SourceFunctionTable");
|
||||
sourceFunctionsTable.setPreferenceKey(
|
||||
"VTFunctionAssociationTableModel - Source Function Table");
|
||||
sourceFunctionsTable
|
||||
.setPreferenceKey("VTFunctionAssociationTableModel - Source Function Table");
|
||||
sourceFunctionsTable.installNavigation(tool);
|
||||
sourceFunctionsTable.setAutoLookupColumn(VTFunctionAssociationTableModel.NAME_COL);
|
||||
sourceFunctionsTable.setAutoResizeMode(JTable.AUTO_RESIZE_SUBSEQUENT_COLUMNS);
|
||||
|
@ -470,10 +469,8 @@ public class VTFunctionAssociationProvider extends ComponentProviderAdapter
|
|||
sourceFunctionsModel.addTableModelListener(new TitleUpdateListener());
|
||||
|
||||
sourceFunctionsTable.getColumnModel()
|
||||
.getColumn(
|
||||
VTFunctionAssociationTableModel.ADDRESS_COL)
|
||||
.setPreferredWidth(
|
||||
VTFunctionAssociationTableModel.ADDRESS_COL_WIDTH);
|
||||
.getColumn(VTFunctionAssociationTableModel.ADDRESS_COL)
|
||||
.setPreferredWidth(VTFunctionAssociationTableModel.ADDRESS_COL_WIDTH);
|
||||
|
||||
sourceTableFilterPanel =
|
||||
new GhidraTableFilterPanel<>(sourceFunctionsTable, sourceFunctionsModel);
|
||||
|
@ -524,10 +521,8 @@ public class VTFunctionAssociationProvider extends ComponentProviderAdapter
|
|||
functionHeader.setUpdateTableInRealTime(true);
|
||||
|
||||
destinationFunctionsTable.getColumnModel()
|
||||
.getColumn(
|
||||
VTFunctionAssociationTableModel.ADDRESS_COL)
|
||||
.setPreferredWidth(
|
||||
VTFunctionAssociationTableModel.ADDRESS_COL_WIDTH);
|
||||
.getColumn(VTFunctionAssociationTableModel.ADDRESS_COL)
|
||||
.setPreferredWidth(VTFunctionAssociationTableModel.ADDRESS_COL_WIDTH);
|
||||
|
||||
destinationTableFilterPanel =
|
||||
new GhidraTableFilterPanel<>(destinationFunctionsTable, destinationFunctionsModel);
|
||||
|
@ -682,7 +677,7 @@ public class VTFunctionAssociationProvider extends ComponentProviderAdapter
|
|||
return;
|
||||
}
|
||||
|
||||
if (ev.containsEvent(DomainObject.DO_OBJECT_RESTORED)) {
|
||||
if (ev.contains(DomainObjectEvent.RESTORED)) {
|
||||
reload();
|
||||
return;
|
||||
}
|
||||
|
@ -690,33 +685,33 @@ public class VTFunctionAssociationProvider extends ComponentProviderAdapter
|
|||
boolean contextChanged = false;
|
||||
for (int i = 0; i < ev.numRecords(); i++) {
|
||||
DomainObjectChangeRecord doRecord = ev.getChangeRecord(i);
|
||||
int eventType = doRecord.getEventType();
|
||||
if (eventType == DOCR_VT_MATCH_ADDED) {
|
||||
EventType eventType = doRecord.getEventType();
|
||||
if (eventType == VTEvent.MATCH_ADDED) {
|
||||
VersionTrackingChangeRecord vtRecord = (VersionTrackingChangeRecord) doRecord;
|
||||
VTMatch match = (VTMatch) vtRecord.getNewValue();
|
||||
sourceFunctionsModel.matchAdded(match);
|
||||
destinationFunctionsModel.matchAdded(match);
|
||||
contextChanged = true;
|
||||
}
|
||||
else if (eventType == DOCR_VT_MATCH_DELETED) {
|
||||
else if (eventType == VTEvent.MATCH_DELETED) {
|
||||
VersionTrackingChangeRecord vtRecord = (VersionTrackingChangeRecord) doRecord;
|
||||
DeletedMatch deletedMatch = (DeletedMatch) vtRecord.getOldValue();
|
||||
sourceFunctionsModel.matchRemoved(deletedMatch);
|
||||
destinationFunctionsModel.matchRemoved(deletedMatch);
|
||||
contextChanged = true;
|
||||
}
|
||||
else if (eventType == DOCR_VT_ASSOCIATION_STATUS_CHANGED) {
|
||||
else if (eventType == VTEvent.ASSOCIATION_STATUS_CHANGED) {
|
||||
VersionTrackingChangeRecord vtRecord = (VersionTrackingChangeRecord) doRecord;
|
||||
VTAssociation association = (VTAssociation) vtRecord.getObject();
|
||||
sourceFunctionsModel.associationChanged(association);
|
||||
destinationFunctionsModel.associationChanged(association);
|
||||
contextChanged = true;
|
||||
}
|
||||
else if (eventType == ChangeManager.DOCR_FUNCTION_ADDED) {
|
||||
else if (eventType == ProgramEvent.FUNCTION_ADDED) {
|
||||
functionAdded((ProgramChangeRecord) doRecord);
|
||||
contextChanged = true;
|
||||
}
|
||||
else if (eventType == ChangeManager.DOCR_FUNCTION_REMOVED) {
|
||||
else if (eventType == ProgramEvent.FUNCTION_REMOVED) {
|
||||
functionRemoved((ProgramChangeRecord) doRecord);
|
||||
contextChanged = true;
|
||||
}
|
||||
|
|
|
@ -32,7 +32,7 @@ import docking.widgets.table.RowObjectTableModel;
|
|||
import docking.widgets.table.threaded.GThreadedTablePanel;
|
||||
import generic.theme.GIcon;
|
||||
import ghidra.feature.vt.api.db.DeletedMatch;
|
||||
import ghidra.feature.vt.api.impl.VTChangeManager;
|
||||
import ghidra.feature.vt.api.impl.VTEvent;
|
||||
import ghidra.feature.vt.api.impl.VersionTrackingChangeRecord;
|
||||
import ghidra.feature.vt.api.main.*;
|
||||
import ghidra.feature.vt.gui.actions.CreateImpliedMatchAction;
|
||||
|
@ -105,11 +105,11 @@ public class VTImpliedMatchesTableProvider extends ComponentProviderAdapter
|
|||
};
|
||||
showReferenceLocationAction.setSelected(true);
|
||||
showReferenceLocationAction.setToolBarData(new ToolBarData(REFERNCE_FROM_ICON, "2"));
|
||||
showReferenceLocationAction.setDescription(
|
||||
"<html>Sets table selection navigation mode to " +
|
||||
"navigate <br> to <b>Source</b> and <b>Dest Reference Address</b> columns");
|
||||
showReferenceLocationAction.setHelpLocation(
|
||||
new HelpLocation("VersionTrackingPlugin", "Navigate_References"));
|
||||
showReferenceLocationAction
|
||||
.setDescription("<html>Sets table selection navigation mode to " +
|
||||
"navigate <br> to <b>Source</b> and <b>Dest Reference Address</b> columns");
|
||||
showReferenceLocationAction
|
||||
.setHelpLocation(new HelpLocation("VersionTrackingPlugin", "Navigate_References"));
|
||||
addLocalAction(showReferenceLocationAction);
|
||||
|
||||
showReferenceToLocationAction =
|
||||
|
@ -122,11 +122,11 @@ public class VTImpliedMatchesTableProvider extends ComponentProviderAdapter
|
|||
}
|
||||
};
|
||||
showReferenceToLocationAction.setToolBarData(new ToolBarData(REFERNCE_TO_ICON, "2"));
|
||||
showReferenceToLocationAction.setDescription(
|
||||
"<html>Sets table selection navigation mode to " +
|
||||
"navigate <br> to <b>Source</b> and <b>Dest Address</b> columns");
|
||||
showReferenceToLocationAction.setHelpLocation(
|
||||
new HelpLocation("VersionTrackingPlugin", "Navigate_Match"));
|
||||
showReferenceToLocationAction
|
||||
.setDescription("<html>Sets table selection navigation mode to " +
|
||||
"navigate <br> to <b>Source</b> and <b>Dest Address</b> columns");
|
||||
showReferenceToLocationAction
|
||||
.setHelpLocation(new HelpLocation("VersionTrackingPlugin", "Navigate_Match"));
|
||||
addLocalAction(showReferenceToLocationAction);
|
||||
|
||||
DockingAction action = new CreateImpliedMatchAction(controller, this);
|
||||
|
@ -210,23 +210,23 @@ public class VTImpliedMatchesTableProvider extends ComponentProviderAdapter
|
|||
boolean matchesContextChanged = false;
|
||||
for (int i = 0; i < ev.numRecords(); i++) {
|
||||
DomainObjectChangeRecord doRecord = ev.getChangeRecord(i);
|
||||
int eventType = doRecord.getEventType();
|
||||
EventType eventType = doRecord.getEventType();
|
||||
|
||||
if (eventType == VTChangeManager.DOCR_VT_ASSOCIATION_STATUS_CHANGED ||
|
||||
eventType == VTChangeManager.DOCR_VT_ASSOCIATION_MARKUP_STATUS_CHANGED) {
|
||||
if (eventType == VTEvent.ASSOCIATION_STATUS_CHANGED ||
|
||||
eventType == VTEvent.ASSOCIATION_MARKUP_STATUS_CHANGED) {
|
||||
matchesContextChanged = true;
|
||||
}
|
||||
else if (eventType == DomainObject.DO_OBJECT_RESTORED ||
|
||||
eventType == VTChangeManager.DOCR_VT_MATCH_SET_ADDED) {
|
||||
else if (eventType == DomainObjectEvent.RESTORED ||
|
||||
eventType == VTEvent.MATCH_SET_ADDED) {
|
||||
reload();
|
||||
matchesContextChanged = true;
|
||||
}
|
||||
else if (eventType == VTChangeManager.DOCR_VT_MATCH_ADDED) {
|
||||
else if (eventType == VTEvent.MATCH_ADDED) {
|
||||
VersionTrackingChangeRecord vtRecord = (VersionTrackingChangeRecord) doRecord;
|
||||
impliedMatchTableModel.matchAdded((VTMatch) vtRecord.getNewValue());
|
||||
matchesContextChanged = true;
|
||||
}
|
||||
else if (eventType == VTChangeManager.DOCR_VT_MATCH_DELETED) {
|
||||
else if (eventType == VTEvent.MATCH_DELETED) {
|
||||
VersionTrackingChangeRecord vtRecord = (VersionTrackingChangeRecord) doRecord;
|
||||
impliedMatchTableModel.matchDeleted((DeletedMatch) vtRecord.getOldValue());
|
||||
matchesContextChanged = true;
|
||||
|
|
|
@ -15,7 +15,9 @@
|
|||
*/
|
||||
package ghidra.feature.vt.gui.provider.markuptable;
|
||||
|
||||
import static ghidra.feature.vt.api.impl.VTEvent.*;
|
||||
import static ghidra.feature.vt.gui.plugin.VTPlugin.*;
|
||||
import static ghidra.framework.model.DomainObjectEvent.*;
|
||||
|
||||
import java.awt.*;
|
||||
import java.awt.event.*;
|
||||
|
@ -40,7 +42,6 @@ import generic.theme.GIcon;
|
|||
import ghidra.app.plugin.core.functioncompare.FunctionComparisonPanel;
|
||||
import ghidra.app.util.viewer.listingpanel.*;
|
||||
import ghidra.app.util.viewer.util.CodeComparisonPanel;
|
||||
import ghidra.feature.vt.api.impl.VTChangeManager;
|
||||
import ghidra.feature.vt.api.main.*;
|
||||
import ghidra.feature.vt.api.markuptype.VTMarkupType;
|
||||
import ghidra.feature.vt.gui.actions.*;
|
||||
|
@ -51,7 +52,6 @@ import ghidra.feature.vt.gui.filters.Filter.FilterEditingStatus;
|
|||
import ghidra.feature.vt.gui.plugin.*;
|
||||
import ghidra.feature.vt.gui.provider.markuptable.VTMarkupItemsTableModel.AppliedDestinationAddressTableColumn;
|
||||
import ghidra.feature.vt.gui.util.*;
|
||||
import ghidra.framework.model.DomainObject;
|
||||
import ghidra.framework.model.DomainObjectChangedEvent;
|
||||
import ghidra.framework.options.Options;
|
||||
import ghidra.framework.options.SaveState;
|
||||
|
@ -785,9 +785,7 @@ public class VTMarkupItemsTableProvider extends ComponentProviderAdapter
|
|||
if (!isVisible()) {
|
||||
return;
|
||||
}
|
||||
if (ev.containsEvent(DomainObject.DO_OBJECT_RESTORED) ||
|
||||
ev.containsEvent(VTChangeManager.DOCR_VT_MARKUP_ITEM_DESTINATION_CHANGED) ||
|
||||
ev.containsEvent(VTChangeManager.DOCR_VT_MARKUP_ITEM_STATUS_CHANGED)) {
|
||||
if (ev.contains(RESTORED, MARKUP_ITEM_DESTINATION_CHANGED, MARKUP_ITEM_STATUS_CHANGED)) {
|
||||
|
||||
// FIXME The following block of code still doesn't clear the markup item cache when Reset Match occurs.
|
||||
MatchInfo matchInfo = controller.getMatchInfo();
|
||||
|
|
|
@ -15,159 +15,36 @@
|
|||
*/
|
||||
package ghidra.feature.vt.gui.provider.matchtable;
|
||||
|
||||
import static ghidra.feature.vt.gui.actions.TableSelectionTrackingState.MAINTAIN_SELECTED_ROW_INDEX;
|
||||
import static ghidra.feature.vt.gui.actions.TableSelectionTrackingState.MAINTAIN_SELECTED_ROW_VALUE;
|
||||
import static ghidra.feature.vt.gui.actions.TableSelectionTrackingState.NO_SELECTION_TRACKING;
|
||||
import static ghidra.feature.vt.gui.plugin.VTPlugin.FILTERED_ICON;
|
||||
import static ghidra.feature.vt.gui.plugin.VTPlugin.UNFILTERED_ICON;
|
||||
import static ghidra.feature.vt.gui.util.VTOptionDefines.ACCEPT_MATCH_OPTIONS_NAME;
|
||||
import static ghidra.feature.vt.gui.util.VTOptionDefines.APPLY_DATA_NAME_ON_ACCEPT;
|
||||
import static ghidra.feature.vt.gui.util.VTOptionDefines.APPLY_FUNCTION_NAME_ON_ACCEPT;
|
||||
import static ghidra.feature.vt.gui.util.VTOptionDefines.APPLY_IMPLIED_MATCHES_OPTION;
|
||||
import static ghidra.feature.vt.gui.util.VTOptionDefines.APPLY_MARKUP_OPTIONS_NAME;
|
||||
import static ghidra.feature.vt.gui.util.VTOptionDefines.AUTO_CREATE_IMPLIED_MATCH;
|
||||
import static ghidra.feature.vt.gui.util.VTOptionDefines.AUTO_VT_DATA_CORRELATOR;
|
||||
import static ghidra.feature.vt.gui.util.VTOptionDefines.AUTO_VT_DUPLICATE_FUNCTION_CORRELATOR;
|
||||
import static ghidra.feature.vt.gui.util.VTOptionDefines.AUTO_VT_EXACT_FUNCTION_CORRELATORS;
|
||||
import static ghidra.feature.vt.gui.util.VTOptionDefines.AUTO_VT_IMPLIED_MATCH_CORRELATOR;
|
||||
import static ghidra.feature.vt.gui.util.VTOptionDefines.AUTO_VT_OPTIONS_NAME;
|
||||
import static ghidra.feature.vt.gui.util.VTOptionDefines.AUTO_VT_REFERENCE_CORRELATORS;
|
||||
import static ghidra.feature.vt.gui.util.VTOptionDefines.AUTO_VT_SYMBOL_CORRELATOR;
|
||||
import static ghidra.feature.vt.gui.util.VTOptionDefines.CALLING_CONVENTION;
|
||||
import static ghidra.feature.vt.gui.util.VTOptionDefines.CALL_FIXUP;
|
||||
import static ghidra.feature.vt.gui.util.VTOptionDefines.CREATE_IMPLIED_MATCHES_OPTION;
|
||||
import static ghidra.feature.vt.gui.util.VTOptionDefines.DATA_CORRELATOR_MIN_LEN_OPTION;
|
||||
import static ghidra.feature.vt.gui.util.VTOptionDefines.DATA_MATCH_DATA_TYPE;
|
||||
import static ghidra.feature.vt.gui.util.VTOptionDefines.DEFAULT_OPTION_FOR_CALLING_CONVENTION;
|
||||
import static ghidra.feature.vt.gui.util.VTOptionDefines.DEFAULT_OPTION_FOR_CALL_FIXUP;
|
||||
import static ghidra.feature.vt.gui.util.VTOptionDefines.DEFAULT_OPTION_FOR_DATA_MATCH_DATA_TYPE;
|
||||
import static ghidra.feature.vt.gui.util.VTOptionDefines.DEFAULT_OPTION_FOR_EOL_COMMENTS;
|
||||
import static ghidra.feature.vt.gui.util.VTOptionDefines.DEFAULT_OPTION_FOR_FUNCTION_NAME;
|
||||
import static ghidra.feature.vt.gui.util.VTOptionDefines.DEFAULT_OPTION_FOR_FUNCTION_RETURN_TYPE;
|
||||
import static ghidra.feature.vt.gui.util.VTOptionDefines.DEFAULT_OPTION_FOR_FUNCTION_SIGNATURE;
|
||||
import static ghidra.feature.vt.gui.util.VTOptionDefines.DEFAULT_OPTION_FOR_HIGHEST_NAME_PRIORITY;
|
||||
import static ghidra.feature.vt.gui.util.VTOptionDefines.DEFAULT_OPTION_FOR_IGNORE_EXCLUDED_MARKUP_ITEMS;
|
||||
import static ghidra.feature.vt.gui.util.VTOptionDefines.DEFAULT_OPTION_FOR_IGNORE_INCOMPLETE_MARKUP_ITEMS;
|
||||
import static ghidra.feature.vt.gui.util.VTOptionDefines.DEFAULT_OPTION_FOR_INLINE;
|
||||
import static ghidra.feature.vt.gui.util.VTOptionDefines.DEFAULT_OPTION_FOR_LABELS;
|
||||
import static ghidra.feature.vt.gui.util.VTOptionDefines.DEFAULT_OPTION_FOR_NO_RETURN;
|
||||
import static ghidra.feature.vt.gui.util.VTOptionDefines.DEFAULT_OPTION_FOR_PARAMETER_COMMENTS;
|
||||
import static ghidra.feature.vt.gui.util.VTOptionDefines.DEFAULT_OPTION_FOR_PARAMETER_DATA_TYPES;
|
||||
import static ghidra.feature.vt.gui.util.VTOptionDefines.DEFAULT_OPTION_FOR_PARAMETER_NAMES;
|
||||
import static ghidra.feature.vt.gui.util.VTOptionDefines.DEFAULT_OPTION_FOR_PARAMETER_NAMES_REPLACE_IF_SAME_PRIORITY;
|
||||
import static ghidra.feature.vt.gui.util.VTOptionDefines.DEFAULT_OPTION_FOR_PLATE_COMMENTS;
|
||||
import static ghidra.feature.vt.gui.util.VTOptionDefines.DEFAULT_OPTION_FOR_POST_COMMENTS;
|
||||
import static ghidra.feature.vt.gui.util.VTOptionDefines.DEFAULT_OPTION_FOR_PRE_COMMENTS;
|
||||
import static ghidra.feature.vt.gui.util.VTOptionDefines.DEFAULT_OPTION_FOR_REPEATABLE_COMMENTS;
|
||||
import static ghidra.feature.vt.gui.util.VTOptionDefines.DEFAULT_OPTION_FOR_VAR_ARGS;
|
||||
import static ghidra.feature.vt.gui.util.VTOptionDefines.DISPLAY_APPLY_MARKUP_OPTIONS;
|
||||
import static ghidra.feature.vt.gui.util.VTOptionDefines.DUPE_FUNCTION_CORRELATOR_MIN_LEN_OPTION;
|
||||
import static ghidra.feature.vt.gui.util.VTOptionDefines.END_OF_LINE_COMMENT;
|
||||
import static ghidra.feature.vt.gui.util.VTOptionDefines.FUNCTION_CORRELATOR_MIN_LEN_OPTION;
|
||||
import static ghidra.feature.vt.gui.util.VTOptionDefines.FUNCTION_NAME;
|
||||
import static ghidra.feature.vt.gui.util.VTOptionDefines.FUNCTION_RETURN_TYPE;
|
||||
import static ghidra.feature.vt.gui.util.VTOptionDefines.FUNCTION_SIGNATURE;
|
||||
import static ghidra.feature.vt.gui.util.VTOptionDefines.HIGHEST_NAME_PRIORITY;
|
||||
import static ghidra.feature.vt.gui.util.VTOptionDefines.IGNORE_EXCLUDED_MARKUP_ITEMS;
|
||||
import static ghidra.feature.vt.gui.util.VTOptionDefines.IGNORE_INCOMPLETE_MARKUP_ITEMS;
|
||||
import static ghidra.feature.vt.gui.util.VTOptionDefines.INLINE;
|
||||
import static ghidra.feature.vt.gui.util.VTOptionDefines.LABELS;
|
||||
import static ghidra.feature.vt.gui.util.VTOptionDefines.MAX_CONFLICTS_OPTION;
|
||||
import static ghidra.feature.vt.gui.util.VTOptionDefines.MIN_VOTES_OPTION;
|
||||
import static ghidra.feature.vt.gui.util.VTOptionDefines.NO_RETURN;
|
||||
import static ghidra.feature.vt.gui.util.VTOptionDefines.PARAMETER_COMMENTS;
|
||||
import static ghidra.feature.vt.gui.util.VTOptionDefines.PARAMETER_DATA_TYPES;
|
||||
import static ghidra.feature.vt.gui.util.VTOptionDefines.PARAMETER_NAMES;
|
||||
import static ghidra.feature.vt.gui.util.VTOptionDefines.PARAMETER_NAMES_REPLACE_IF_SAME_PRIORITY;
|
||||
import static ghidra.feature.vt.gui.util.VTOptionDefines.PLATE_COMMENT;
|
||||
import static ghidra.feature.vt.gui.util.VTOptionDefines.POST_COMMENT;
|
||||
import static ghidra.feature.vt.gui.util.VTOptionDefines.PRE_COMMENT;
|
||||
import static ghidra.feature.vt.gui.util.VTOptionDefines.REF_CORRELATOR_MIN_CONF_OPTION;
|
||||
import static ghidra.feature.vt.gui.util.VTOptionDefines.REF_CORRELATOR_MIN_SCORE_OPTION;
|
||||
import static ghidra.feature.vt.gui.util.VTOptionDefines.REPEATABLE_COMMENT;
|
||||
import static ghidra.feature.vt.gui.util.VTOptionDefines.RUN_DUPE_FUNCTION_OPTION;
|
||||
import static ghidra.feature.vt.gui.util.VTOptionDefines.RUN_EXACT_DATA_OPTION;
|
||||
import static ghidra.feature.vt.gui.util.VTOptionDefines.RUN_EXACT_FUNCTION_BYTES_OPTION;
|
||||
import static ghidra.feature.vt.gui.util.VTOptionDefines.RUN_EXACT_FUNCTION_INST_OPTION;
|
||||
import static ghidra.feature.vt.gui.util.VTOptionDefines.RUN_EXACT_SYMBOL_OPTION;
|
||||
import static ghidra.feature.vt.gui.util.VTOptionDefines.RUN_REF_CORRELATORS_OPTION;
|
||||
import static ghidra.feature.vt.gui.util.VTOptionDefines.SYMBOL_CORRELATOR_MIN_LEN_OPTION;
|
||||
import static ghidra.feature.vt.gui.util.VTOptionDefines.VAR_ARGS;
|
||||
import static ghidra.feature.vt.api.impl.VTEvent.*;
|
||||
import static ghidra.feature.vt.gui.actions.TableSelectionTrackingState.*;
|
||||
import static ghidra.feature.vt.gui.plugin.VTPlugin.*;
|
||||
import static ghidra.feature.vt.gui.util.VTOptionDefines.*;
|
||||
import static ghidra.framework.model.DomainObjectEvent.*;
|
||||
|
||||
import java.awt.Adjustable;
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Rectangle;
|
||||
import java.awt.event.FocusAdapter;
|
||||
import java.awt.event.FocusEvent;
|
||||
import java.awt.event.MouseEvent;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.awt.*;
|
||||
import java.awt.event.*;
|
||||
import java.util.*;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.swing.BorderFactory;
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JComponent;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JScrollBar;
|
||||
import javax.swing.JTable;
|
||||
import javax.swing.ListSelectionModel;
|
||||
import javax.swing.*;
|
||||
import javax.swing.event.ListSelectionEvent;
|
||||
import javax.swing.event.ListSelectionListener;
|
||||
import javax.swing.table.TableCellRenderer;
|
||||
import javax.swing.table.TableColumn;
|
||||
import javax.swing.table.TableColumnModel;
|
||||
import javax.swing.table.*;
|
||||
|
||||
import docking.ActionContext;
|
||||
import docking.DockingWindowManager;
|
||||
import docking.WindowPosition;
|
||||
import docking.widgets.table.AbstractSortedTableModel;
|
||||
import docking.widgets.table.GTable;
|
||||
import docking.widgets.table.RowObjectSelectionManager;
|
||||
import docking.widgets.table.RowObjectTableModel;
|
||||
import docking.widgets.table.SelectionManager;
|
||||
import docking.*;
|
||||
import docking.widgets.table.*;
|
||||
import docking.widgets.table.threaded.ThreadedTableModel;
|
||||
import ghidra.feature.vt.api.impl.VTChangeManager;
|
||||
import ghidra.feature.vt.api.impl.VTEvent;
|
||||
import ghidra.feature.vt.api.impl.VersionTrackingChangeRecord;
|
||||
import ghidra.feature.vt.api.main.VTMarkupItem;
|
||||
import ghidra.feature.vt.api.main.VTMatch;
|
||||
import ghidra.feature.vt.api.main.VTSession;
|
||||
import ghidra.feature.vt.gui.actions.AcceptMatchAction;
|
||||
import ghidra.feature.vt.gui.actions.ApplyBlockedMatchAction;
|
||||
import ghidra.feature.vt.gui.actions.ApplyMatchAction;
|
||||
import ghidra.feature.vt.gui.actions.ChooseMatchTagAction;
|
||||
import ghidra.feature.vt.gui.actions.ClearMatchAction;
|
||||
import ghidra.feature.vt.gui.actions.CreateSelectionAction;
|
||||
import ghidra.feature.vt.gui.actions.EditAllTagsAction;
|
||||
import ghidra.feature.vt.gui.actions.MatchTableSelectionAction;
|
||||
import ghidra.feature.vt.gui.actions.RejectMatchAction;
|
||||
import ghidra.feature.vt.gui.actions.RemoveMatchAction;
|
||||
import ghidra.feature.vt.gui.actions.RemoveMatchTagAction;
|
||||
import ghidra.feature.vt.gui.actions.TableSelectionTrackingState;
|
||||
import ghidra.feature.vt.api.main.*;
|
||||
import ghidra.feature.vt.gui.actions.*;
|
||||
import ghidra.feature.vt.gui.editors.MatchTagCellEditor;
|
||||
import ghidra.feature.vt.gui.filters.AncillaryFilterDialogComponentProvider;
|
||||
import ghidra.feature.vt.gui.filters.Filter;
|
||||
import ghidra.feature.vt.gui.filters.*;
|
||||
import ghidra.feature.vt.gui.filters.Filter.FilterEditingStatus;
|
||||
import ghidra.feature.vt.gui.filters.FilterDialogModel;
|
||||
import ghidra.feature.vt.gui.filters.FilterStatusListener;
|
||||
import ghidra.feature.vt.gui.plugin.VTController;
|
||||
import ghidra.feature.vt.gui.plugin.VTControllerListener;
|
||||
import ghidra.feature.vt.gui.plugin.VTPlugin;
|
||||
import ghidra.feature.vt.gui.plugin.VersionTrackingPluginPackage;
|
||||
import ghidra.feature.vt.gui.util.AbstractVTMatchTableModel.DestinationLabelTableColumn;
|
||||
import ghidra.feature.vt.gui.util.AbstractVTMatchTableModel.SourceLabelTableColumn;
|
||||
import ghidra.feature.vt.gui.util.AbstractVTMatchTableModel.StatusTableColumn;
|
||||
import ghidra.feature.vt.gui.util.AbstractVTMatchTableModel.TagTableColumn;
|
||||
import ghidra.feature.vt.gui.util.AllTextFilter;
|
||||
import ghidra.feature.vt.gui.util.FilterIconFlashTimer;
|
||||
import ghidra.feature.vt.gui.util.MatchInfo;
|
||||
import ghidra.feature.vt.gui.util.MatchStatusRenderer;
|
||||
import ghidra.feature.vt.gui.util.VTSymbolRenderer;
|
||||
import ghidra.framework.model.DomainObject;
|
||||
import ghidra.framework.model.DomainObjectChangeRecord;
|
||||
import ghidra.framework.model.DomainObjectChangedEvent;
|
||||
import ghidra.feature.vt.gui.plugin.*;
|
||||
import ghidra.feature.vt.gui.util.*;
|
||||
import ghidra.feature.vt.gui.util.AbstractVTMatchTableModel.*;
|
||||
import ghidra.framework.model.*;
|
||||
import ghidra.framework.options.Options;
|
||||
import ghidra.framework.options.SaveState;
|
||||
import ghidra.framework.plugintool.ComponentProviderAdapter;
|
||||
|
@ -614,8 +491,7 @@ public class VTMatchTableProvider extends ComponentProviderAdapter
|
|||
return;
|
||||
}
|
||||
|
||||
if (ev.containsEvent(DomainObject.DO_OBJECT_RESTORED) ||
|
||||
ev.containsEvent(VTChangeManager.DOCR_VT_MATCH_SET_ADDED)) {// save some work
|
||||
if (ev.contains(RESTORED, MATCH_SET_ADDED)) {// save some work
|
||||
saveComplexSelectionUpdate();
|
||||
reload();
|
||||
return;
|
||||
|
@ -624,25 +500,25 @@ public class VTMatchTableProvider extends ComponentProviderAdapter
|
|||
boolean matchesContextChanged = false;
|
||||
for (int i = 0; i < ev.numRecords(); i++) {
|
||||
DomainObjectChangeRecord doRecord = ev.getChangeRecord(i);
|
||||
int eventType = doRecord.getEventType();
|
||||
EventType eventType = doRecord.getEventType();
|
||||
|
||||
if (eventType == VTChangeManager.DOCR_VT_ASSOCIATION_STATUS_CHANGED ||
|
||||
eventType == VTChangeManager.DOCR_VT_ASSOCIATION_MARKUP_STATUS_CHANGED) {
|
||||
if (eventType == ASSOCIATION_STATUS_CHANGED ||
|
||||
eventType == VTEvent.ASSOCIATION_MARKUP_STATUS_CHANGED) {
|
||||
|
||||
updateWithoutFullReload();
|
||||
matchesContextChanged = true;
|
||||
saveComplexSelectionUpdate();
|
||||
}
|
||||
else if (eventType == VTChangeManager.DOCR_VT_MATCH_TAG_CHANGED) {
|
||||
else if (eventType == VTEvent.MATCH_TAG_CHANGED) {
|
||||
updateWithoutFullReload();
|
||||
matchesContextChanged = true;
|
||||
}
|
||||
else if (eventType == VTChangeManager.DOCR_VT_MATCH_ADDED) {
|
||||
else if (eventType == VTEvent.MATCH_ADDED) {
|
||||
VersionTrackingChangeRecord vtRecord = (VersionTrackingChangeRecord) doRecord;
|
||||
matchesTableModel.addObject((VTMatch) vtRecord.getNewValue());
|
||||
matchesContextChanged = true;
|
||||
}
|
||||
else if (eventType == VTChangeManager.DOCR_VT_MATCH_DELETED) {
|
||||
else if (eventType == VTEvent.MATCH_DELETED) {
|
||||
VersionTrackingChangeRecord vtRecord = (VersionTrackingChangeRecord) doRecord;
|
||||
matchesTableModel.removeObject((VTMatch) vtRecord.getObject());
|
||||
matchesContextChanged = true;
|
||||
|
@ -833,21 +709,23 @@ public class VTMatchTableProvider extends ComponentProviderAdapter
|
|||
.setOptionsHelpLocation(
|
||||
new HelpLocation("VersionTracking", "Apply Markup Options"));
|
||||
|
||||
|
||||
// Auto VT options
|
||||
|
||||
// put checkboxes to determine which correlators to run during auto VT
|
||||
vtOptions.registerOption(CREATE_IMPLIED_MATCHES_OPTION, true, null,
|
||||
"Create Implied Matches when AutoVT correlators apply function matches.");
|
||||
vtOptions.registerOption(RUN_EXACT_DATA_OPTION, true, null, "Run the Exact Data Correlator");
|
||||
vtOptions.registerOption(RUN_EXACT_SYMBOL_OPTION, true, null, "Run the Exact Symbol Correlator");
|
||||
vtOptions.registerOption(RUN_EXACT_DATA_OPTION, true, null,
|
||||
"Run the Exact Data Correlator");
|
||||
vtOptions.registerOption(RUN_EXACT_SYMBOL_OPTION, true, null,
|
||||
"Run the Exact Symbol Correlator");
|
||||
vtOptions.registerOption(RUN_EXACT_FUNCTION_BYTES_OPTION, true, null,
|
||||
"Run the Exact Function Bytes Correlator");
|
||||
vtOptions.registerOption(RUN_EXACT_FUNCTION_INST_OPTION, true, null,
|
||||
"Run the Exact Function Instruction Bytes and Mnemonics Correlators");
|
||||
vtOptions.registerOption(RUN_DUPE_FUNCTION_OPTION, true, null,
|
||||
"Run the Duplicate Function Instruction Correlator");
|
||||
vtOptions.registerOption(RUN_REF_CORRELATORS_OPTION, true, null, "Run the Reference Correlators");
|
||||
vtOptions.registerOption(RUN_REF_CORRELATORS_OPTION, true, null,
|
||||
"Run the Reference Correlators");
|
||||
|
||||
// set help for the sub categories
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@ import docking.widgets.table.RowObjectTableModel;
|
|||
import docking.widgets.table.threaded.ThreadedTableModel;
|
||||
import generic.theme.GColor;
|
||||
import generic.theme.GIcon;
|
||||
import ghidra.feature.vt.api.impl.VTChangeManager;
|
||||
import ghidra.feature.vt.api.impl.VTEvent;
|
||||
import ghidra.feature.vt.api.main.*;
|
||||
import ghidra.feature.vt.gui.actions.*;
|
||||
import ghidra.feature.vt.gui.filters.*;
|
||||
|
@ -435,20 +435,19 @@ public abstract class VTMatchOneToManyTableProvider extends ComponentProviderAda
|
|||
boolean matchesContextChanged = false;
|
||||
for (int i = 0; i < ev.numRecords(); i++) {
|
||||
DomainObjectChangeRecord doRecord = ev.getChangeRecord(i);
|
||||
int eventType = doRecord.getEventType();
|
||||
EventType eventType = doRecord.getEventType();
|
||||
|
||||
if (eventType == VTChangeManager.DOCR_VT_ASSOCIATION_MARKUP_STATUS_CHANGED ||
|
||||
eventType == VTChangeManager.DOCR_VT_ASSOCIATION_STATUS_CHANGED ||
|
||||
eventType == VTChangeManager.DOCR_VT_MATCH_TAG_CHANGED) {
|
||||
if (eventType == VTEvent.ASSOCIATION_MARKUP_STATUS_CHANGED ||
|
||||
eventType == VTEvent.ASSOCIATION_STATUS_CHANGED ||
|
||||
eventType == VTEvent.MATCH_TAG_CHANGED) {
|
||||
|
||||
oneToManyTableModel.refresh();
|
||||
repaint();
|
||||
matchesContextChanged = true;
|
||||
}
|
||||
else if (eventType == DomainObject.DO_OBJECT_RESTORED ||
|
||||
eventType == VTChangeManager.DOCR_VT_MATCH_SET_ADDED ||
|
||||
eventType == VTChangeManager.DOCR_VT_MATCH_ADDED ||
|
||||
eventType == VTChangeManager.DOCR_VT_MATCH_DELETED) {
|
||||
else if (eventType == DomainObjectEvent.RESTORED ||
|
||||
eventType == VTEvent.MATCH_SET_ADDED || eventType == VTEvent.MATCH_ADDED ||
|
||||
eventType == VTEvent.MATCH_DELETED) {
|
||||
|
||||
reload();
|
||||
repaint();
|
||||
|
|
|
@ -25,7 +25,7 @@ import org.junit.*;
|
|||
|
||||
import generic.timer.GhidraTimer;
|
||||
import ghidra.feature.vt.api.db.VTMatchTagDB;
|
||||
import ghidra.feature.vt.api.impl.VTChangeManager;
|
||||
import ghidra.feature.vt.api.impl.VTEvent;
|
||||
import ghidra.feature.vt.api.main.*;
|
||||
import ghidra.feature.vt.api.util.VTAssociationStatusException;
|
||||
import ghidra.framework.model.*;
|
||||
|
@ -88,7 +88,7 @@ public class VTDomainObjectEventsTest extends VTBaseTestCase {
|
|||
createMatchSet();
|
||||
|
||||
assertEventCount(1);
|
||||
assertEquals(VTChangeManager.DOCR_VT_MATCH_SET_ADDED, events.get(0).getEventType());
|
||||
assertEquals(VTEvent.MATCH_SET_ADDED, events.get(0).getEventType());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -100,8 +100,8 @@ public class VTDomainObjectEventsTest extends VTBaseTestCase {
|
|||
matchSet.addMatch(match);
|
||||
|
||||
assertEventCount(2);
|
||||
assertEquals(VTChangeManager.DOCR_VT_ASSOCIATION_ADDED, events.get(0).getEventType());
|
||||
assertEquals(VTChangeManager.DOCR_VT_MATCH_ADDED, events.get(1).getEventType());
|
||||
assertEquals(VTEvent.ASSOCIATION_ADDED, events.get(0).getEventType());
|
||||
assertEquals(VTEvent.MATCH_ADDED, events.get(1).getEventType());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -116,7 +116,7 @@ public class VTDomainObjectEventsTest extends VTBaseTestCase {
|
|||
matchSet.addMatch(matchInfo);
|
||||
|
||||
assertEventCount(1);
|
||||
assertEquals(VTChangeManager.DOCR_VT_MATCH_ADDED, events.get(0).getEventType());
|
||||
assertEquals(VTEvent.MATCH_ADDED, events.get(0).getEventType());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -130,8 +130,8 @@ public class VTDomainObjectEventsTest extends VTBaseTestCase {
|
|||
manualMatchSet.removeMatch(match);
|
||||
|
||||
assertEventCount(2);
|
||||
assertEquals(VTChangeManager.DOCR_VT_ASSOCIATION_REMOVED, events.get(0).getEventType());
|
||||
assertEquals(VTChangeManager.DOCR_VT_MATCH_DELETED, events.get(1).getEventType());
|
||||
assertEquals(VTEvent.ASSOCIATION_REMOVED, events.get(0).getEventType());
|
||||
assertEquals(VTEvent.MATCH_DELETED, events.get(1).getEventType());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -145,8 +145,8 @@ public class VTDomainObjectEventsTest extends VTBaseTestCase {
|
|||
manualMatchSet.removeMatch(match);
|
||||
|
||||
assertEventCount(2);
|
||||
assertEquals(VTChangeManager.DOCR_VT_ASSOCIATION_REMOVED, events.get(0).getEventType());
|
||||
assertEquals(VTChangeManager.DOCR_VT_MATCH_DELETED, events.get(1).getEventType());
|
||||
assertEquals(VTEvent.ASSOCIATION_REMOVED, events.get(0).getEventType());
|
||||
assertEquals(VTEvent.MATCH_DELETED, events.get(1).getEventType());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -158,8 +158,7 @@ public class VTDomainObjectEventsTest extends VTBaseTestCase {
|
|||
match.getAssociation().setRejected();
|
||||
|
||||
assertEventCount(1);
|
||||
assertEquals(VTChangeManager.DOCR_VT_ASSOCIATION_STATUS_CHANGED,
|
||||
events.get(0).getEventType());
|
||||
assertEquals(VTEvent.ASSOCIATION_STATUS_CHANGED, events.get(0).getEventType());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -173,8 +172,7 @@ public class VTDomainObjectEventsTest extends VTBaseTestCase {
|
|||
match.getAssociation().setAccepted();
|
||||
|
||||
assertEventCount(1);
|
||||
assertEquals(VTChangeManager.DOCR_VT_ASSOCIATION_STATUS_CHANGED,
|
||||
events.get(0).getEventType());
|
||||
assertEquals(VTEvent.ASSOCIATION_STATUS_CHANGED, events.get(0).getEventType());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -202,8 +200,7 @@ public class VTDomainObjectEventsTest extends VTBaseTestCase {
|
|||
assertEquals(destinationAddress, markupItem.getDestinationAddress());
|
||||
|
||||
assertEventCount(1);
|
||||
assertEquals(VTChangeManager.DOCR_VT_MARKUP_ITEM_DESTINATION_CHANGED,
|
||||
events.get(0).getEventType());
|
||||
assertEquals(VTEvent.MARKUP_ITEM_DESTINATION_CHANGED, events.get(0).getEventType());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -223,8 +220,7 @@ public class VTDomainObjectEventsTest extends VTBaseTestCase {
|
|||
markupItem.apply(VTMarkupItemApplyActionType.REPLACE, null);
|
||||
|
||||
assertEventCount(1);
|
||||
assertEquals(VTChangeManager.DOCR_VT_MARKUP_ITEM_STATUS_CHANGED,
|
||||
events.get(0).getEventType());
|
||||
assertEquals(VTEvent.MARKUP_ITEM_STATUS_CHANGED, events.get(0).getEventType());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -244,15 +240,14 @@ public class VTDomainObjectEventsTest extends VTBaseTestCase {
|
|||
markupItem.setConsidered(VTMarkupItemConsideredStatus.IGNORE_DONT_CARE);
|
||||
|
||||
assertEventCount(1);
|
||||
assertEquals(VTChangeManager.DOCR_VT_MARKUP_ITEM_STATUS_CHANGED,
|
||||
events.get(0).getEventType());
|
||||
assertEquals(VTEvent.MARKUP_ITEM_STATUS_CHANGED, events.get(0).getEventType());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testTagAddedEvent() {
|
||||
db.createMatchTag("TEST");
|
||||
assertEventCount(1);
|
||||
assertEquals(VTChangeManager.DOCR_VT_TAG_ADDED, events.get(0).getEventType());
|
||||
assertEquals(VTEvent.TAG_ADDED, events.get(0).getEventType());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -261,7 +256,7 @@ public class VTDomainObjectEventsTest extends VTBaseTestCase {
|
|||
clearEvents();
|
||||
db.deleteMatchTag(tag);
|
||||
assertEventCount(1);
|
||||
assertEquals(VTChangeManager.DOCR_VT_TAG_REMOVED, events.get(0).getEventType());
|
||||
assertEquals(VTEvent.TAG_REMOVED, events.get(0).getEventType());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -274,12 +269,12 @@ public class VTDomainObjectEventsTest extends VTBaseTestCase {
|
|||
clearEvents();
|
||||
match.setTag(tag);
|
||||
assertEventCount(1);
|
||||
assertEquals(VTChangeManager.DOCR_VT_MATCH_TAG_CHANGED, events.get(0).getEventType());
|
||||
assertEquals(VTEvent.MATCH_TAG_CHANGED, events.get(0).getEventType());
|
||||
|
||||
clearEvents();
|
||||
match.setTag(null);
|
||||
assertEventCount(1);
|
||||
assertEquals(VTChangeManager.DOCR_VT_MATCH_TAG_CHANGED, events.get(0).getEventType());
|
||||
assertEquals(VTEvent.MATCH_TAG_CHANGED, events.get(0).getEventType());
|
||||
|
||||
}
|
||||
|
||||
|
@ -291,7 +286,7 @@ public class VTDomainObjectEventsTest extends VTBaseTestCase {
|
|||
clearEvents();
|
||||
match.getAssociation().setVoteCount(4);
|
||||
assertEventCount(1);
|
||||
assertEquals(VTChangeManager.DOCR_VT_VOTE_COUNT_CHANGED, events.get(0).getEventType());
|
||||
assertEquals(VTEvent.VOTE_COUNT_CHANGED, events.get(0).getEventType());
|
||||
}
|
||||
|
||||
private void assertEventCount(int n) {
|
||||
|
|
|
@ -23,7 +23,7 @@ import java.util.*;
|
|||
import org.junit.*;
|
||||
|
||||
import ghidra.feature.vt.api.db.VTSessionDB;
|
||||
import ghidra.feature.vt.api.impl.VTChangeManager;
|
||||
import ghidra.feature.vt.api.impl.VTEvent;
|
||||
import ghidra.feature.vt.api.impl.VersionTrackingChangeRecord;
|
||||
import ghidra.feature.vt.api.main.*;
|
||||
import ghidra.feature.vt.db.DummyTestProgramCorrelator;
|
||||
|
@ -317,16 +317,14 @@ public class TagFilterTest extends VTBaseTestCase {
|
|||
|
||||
private void notifyTagAdded(VTMatchTag newTag) throws IOException {
|
||||
List<DomainObjectChangeRecord> subEvents = new ArrayList<>();
|
||||
subEvents.add(new VersionTrackingChangeRecord(VTChangeManager.DOCR_VT_TAG_ADDED, newTag,
|
||||
null, newTag));
|
||||
subEvents.add(new VersionTrackingChangeRecord(VTEvent.TAG_ADDED, newTag, null, newTag));
|
||||
listener.sessionUpdated(
|
||||
new DomainObjectChangedEvent(new DummyDomainObject(this), subEvents));
|
||||
}
|
||||
|
||||
private void notifyTagRemoved(String tagName) throws IOException {
|
||||
List<DomainObjectChangeRecord> subEvents = new ArrayList<>();
|
||||
subEvents.add(new VersionTrackingChangeRecord(VTChangeManager.DOCR_VT_TAG_REMOVED, null,
|
||||
tagName, null));
|
||||
subEvents.add(new VersionTrackingChangeRecord(VTEvent.TAG_REMOVED, null, tagName, null));
|
||||
listener.sessionUpdated(
|
||||
new DomainObjectChangedEvent(new DummyDomainObject(this), subEvents));
|
||||
}
|
||||
|
|
|
@ -156,7 +156,7 @@ public abstract class DomainObjectAdapter implements DomainObject {
|
|||
name = newName;
|
||||
changed = true;
|
||||
}
|
||||
fireEvent(new DomainObjectChangeRecord(DO_OBJECT_RENAMED));
|
||||
fireEvent(new DomainObjectChangeRecord(DomainObjectEvent.RENAMED));
|
||||
}
|
||||
|
||||
private void clearDomainObj() {
|
||||
|
@ -195,7 +195,7 @@ public abstract class DomainObjectAdapter implements DomainObject {
|
|||
clearDomainObj();
|
||||
DomainFile oldDf = domainFile;
|
||||
domainFile = df;
|
||||
fireEvent(new DomainObjectChangeRecord(DO_DOMAIN_FILE_CHANGED, oldDf, df));
|
||||
fireEvent(new DomainObjectChangeRecord(DomainObjectEvent.FILE_CHANGED, oldDf, df));
|
||||
fileChangeListeners.invoke().domainFileChanged(this);
|
||||
|
||||
}
|
||||
|
@ -314,7 +314,8 @@ public abstract class DomainObjectAdapter implements DomainObject {
|
|||
if (eventsEnabled != v) {
|
||||
eventsEnabled = v;
|
||||
if (eventsEnabled) {
|
||||
DomainObjectChangeRecord docr = new DomainObjectChangeRecord(DO_OBJECT_RESTORED);
|
||||
DomainObjectChangeRecord docr =
|
||||
new DomainObjectChangeRecord(DomainObjectEvent.RESTORED);
|
||||
docs.fireEvent(docr);
|
||||
for (DomainObjectChangeSupport queue : changeSupportMap.values()) {
|
||||
queue.fireEvent(docr);
|
||||
|
|
|
@ -477,8 +477,8 @@ public abstract class DomainObjectAdapterDB extends DomainObjectAdapter
|
|||
*/
|
||||
protected boolean propertyChanged(String propertyName, Object oldValue, Object newValue) {
|
||||
setChanged(true);
|
||||
fireEvent(
|
||||
new DomainObjectChangeRecord(DomainObject.DO_PROPERTY_CHANGED, propertyName, newValue));
|
||||
fireEvent(new DomainObjectChangeRecord(DomainObjectEvent.PROPERTY_CHANGED, propertyName,
|
||||
newValue));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -534,7 +534,7 @@ public abstract class DomainObjectAdapterDB extends DomainObjectAdapter
|
|||
}
|
||||
|
||||
if (wasSaved) {
|
||||
fireEvent(new DomainObjectChangeRecord(DomainObject.DO_OBJECT_SAVED));
|
||||
fireEvent(new DomainObjectChangeRecord(DomainObjectEvent.SAVED));
|
||||
|
||||
DomainFile df = getDomainFile();
|
||||
if (df instanceof GhidraFile) {
|
||||
|
|
|
@ -190,7 +190,7 @@ class DomainObjectChangeSupport {
|
|||
|
||||
Runnable errorTask = () -> {
|
||||
List<DomainObjectChangeRecord> records =
|
||||
Arrays.asList(new DomainObjectChangeRecord(DomainObject.DO_OBJECT_ERROR, null, t));
|
||||
Arrays.asList(new DomainObjectChangeRecord(DomainObjectEvent.ERROR, null, t));
|
||||
DomainObjectChangedEvent ev = new DomainObjectChangedEvent(src, records);
|
||||
for (DomainObjectListener l : listenersCopy) {
|
||||
try {
|
||||
|
|
|
@ -92,7 +92,7 @@ class DomainObjectTransactionManager extends AbstractTransactionManager {
|
|||
domainObj.clearCache(false);
|
||||
}
|
||||
|
||||
domainObj.fireEvent(new DomainObjectChangeRecord(DomainObject.DO_OBJECT_RESTORED));
|
||||
domainObj.fireEvent(new DomainObjectChangeRecord(DomainObjectEvent.RESTORED));
|
||||
if (notify) {
|
||||
notifyEndTransaction();
|
||||
}
|
||||
|
@ -182,7 +182,7 @@ class DomainObjectTransactionManager extends AbstractTransactionManager {
|
|||
if (notify) {
|
||||
notifyEndTransaction();
|
||||
}
|
||||
domainObj.fireEvent(new DomainObjectChangeRecord(DomainObject.DO_OBJECT_RESTORED));
|
||||
domainObj.fireEvent(new DomainObjectChangeRecord(DomainObjectEvent.RESTORED));
|
||||
transaction.restoreToolStates(true);
|
||||
transaction = null;
|
||||
}
|
||||
|
@ -272,7 +272,7 @@ class DomainObjectTransactionManager extends AbstractTransactionManager {
|
|||
if (domainObj.changeSet != null) {
|
||||
domainObj.changeSet.redo();
|
||||
}
|
||||
domainObj.fireEvent(new DomainObjectChangeRecord(DomainObject.DO_OBJECT_RESTORED));
|
||||
domainObj.fireEvent(new DomainObjectChangeRecord(DomainObjectEvent.RESTORED));
|
||||
undoList.addLast(t);
|
||||
t.restoreToolStates(false);
|
||||
if (notify) {
|
||||
|
@ -291,7 +291,7 @@ class DomainObjectTransactionManager extends AbstractTransactionManager {
|
|||
domainObj.changeSet.undo();
|
||||
}
|
||||
domainObj.clearCache(false);
|
||||
domainObj.fireEvent(new DomainObjectChangeRecord(DomainObject.DO_OBJECT_RESTORED));
|
||||
domainObj.fireEvent(new DomainObjectChangeRecord(DomainObjectEvent.RESTORED));
|
||||
redoList.addLast(t);
|
||||
t.restoreToolStates(true);
|
||||
if (notify) {
|
||||
|
|
|
@ -31,48 +31,69 @@ import ghidra.util.task.TaskMonitor;
|
|||
* data objects that are persistent. <CODE>DomainObject</CODE>s maintain an
|
||||
* association with a <CODE>DomainFile</CODE>. A <CODE>DomainObject</CODE> that
|
||||
* has never been saved will have a null <CODE>DomainFile</CODE>.
|
||||
* <P>
|
||||
* Note: Previously (before 11.1), domain object change event types were defined in this file as
|
||||
* integer constants. Event ids have since been converted to enum types. The defines in this file
|
||||
* have been converted to point to the new enum values to make it easier to convert to this new way
|
||||
* and to clearly see how the old values map to the new enums. In future releases, these defines
|
||||
* will be removed.
|
||||
*/
|
||||
public interface DomainObject {
|
||||
|
||||
/**
|
||||
* Event type generated when the domain object is saved.
|
||||
* @deprecated Event type numeric constants have been changed to enums. Use the enum directly.
|
||||
*/
|
||||
@Deprecated
|
||||
public final static EventType DO_OBJECT_SAVED = DomainObjectEvent.SAVED;
|
||||
|
||||
/**
|
||||
* Event type generated when the domain file associated with
|
||||
* the domain object changes.
|
||||
* @deprecated Event type numeric constants have been changed to enums. Use the enum directly.
|
||||
*/
|
||||
@Deprecated
|
||||
public final static EventType DO_DOMAIN_FILE_CHANGED = DomainObjectEvent.FILE_CHANGED;
|
||||
|
||||
/**
|
||||
* Event type generated when the object name changes.
|
||||
* @deprecated Event type numeric constants have been changed to enums. Use the enum directly.
|
||||
*/
|
||||
@Deprecated
|
||||
public final static EventType DO_OBJECT_RENAMED = DomainObjectEvent.RENAMED;
|
||||
|
||||
/**
|
||||
* Event type generated when domain object is restored.
|
||||
* @deprecated Event type numeric constants have been changed to enums. Use the enum directly.
|
||||
*/
|
||||
@Deprecated
|
||||
public static final EventType DO_OBJECT_RESTORED = DomainObjectEvent.RESTORED;
|
||||
|
||||
/**
|
||||
* Event type generated when a property on this DomainObject is changed.
|
||||
* @deprecated Event type numeric constants have been changed to enums. Use the enum directly.
|
||||
*/
|
||||
@Deprecated
|
||||
public static final EventType DO_PROPERTY_CHANGED = DomainObjectEvent.PROPERTY_CHANGED;
|
||||
|
||||
/**
|
||||
* Event type generated when this domain object is closed.
|
||||
* @deprecated Event type numeric constants have been changed to enums. Use the enum directly.
|
||||
*/
|
||||
@Deprecated
|
||||
public static final EventType DO_OBJECT_CLOSED = DomainObjectEvent.CLOSED;
|
||||
|
||||
/**
|
||||
* Event type generated when a fatal error occurs which renders the domain object invalid.
|
||||
* @deprecated Event type numeric constants have been changed to enums. Use the enum directly.
|
||||
*/
|
||||
@Deprecated
|
||||
public static final EventType DO_OBJECT_ERROR = DomainObjectEvent.ERROR;
|
||||
|
||||
/**
|
||||
* Object to synchronize on for undo/redo operations.
|
||||
*/
|
||||
public final static Object undoLock = new Object();
|
||||
/**
|
||||
* Event type generated when the domain object is saved.
|
||||
*/
|
||||
public final static int DO_OBJECT_SAVED = 1;
|
||||
|
||||
/**
|
||||
* Event type generated when the domain file associated with
|
||||
* the domain object changes.
|
||||
*/
|
||||
public final static int DO_DOMAIN_FILE_CHANGED = 2;
|
||||
|
||||
/**
|
||||
* Event type generated when the object name changes.
|
||||
*/
|
||||
public final static int DO_OBJECT_RENAMED = 3;
|
||||
|
||||
/**
|
||||
* Event type generated when domain object is restored.
|
||||
*/
|
||||
public static final int DO_OBJECT_RESTORED = 4;
|
||||
|
||||
/**
|
||||
* Event type generated when a property on this DomainObject is changed.
|
||||
*/
|
||||
public static final int DO_PROPERTY_CHANGED = 5;
|
||||
|
||||
/**
|
||||
* Event type generated when this domain object is closed.
|
||||
*/
|
||||
public static final int DO_OBJECT_CLOSED = 6;
|
||||
|
||||
/**
|
||||
* Event type generated when a fatal error occurs which renders the domain object invalid.
|
||||
*/
|
||||
public static final int DO_OBJECT_ERROR = 8;
|
||||
|
||||
/**
|
||||
* Returns whether the object has changed.
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue