mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2025-10-04 18:29:37 +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
|
@ -15,6 +15,8 @@
|
|||
*/
|
||||
package ghidra.app.plugin.assembler.sleigh;
|
||||
|
||||
import static ghidra.program.util.ProgramEvent.*;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.Collection;
|
||||
|
@ -37,7 +39,6 @@ import ghidra.program.model.lang.RegisterValue;
|
|||
import ghidra.program.model.listing.*;
|
||||
import ghidra.program.model.mem.Memory;
|
||||
import ghidra.program.model.mem.MemoryAccessException;
|
||||
import ghidra.program.util.ChangeManager;
|
||||
import ghidra.util.task.TaskMonitor;
|
||||
|
||||
public abstract class AbstractSleighAssembler<RP extends AssemblyResolvedPatterns>
|
||||
|
@ -47,10 +48,7 @@ public abstract class AbstractSleighAssembler<RP extends AssemblyResolvedPattern
|
|||
protected class ListenerForSymbolsRefresh implements DomainObjectListener {
|
||||
@Override
|
||||
public void domainObjectChanged(DomainObjectChangedEvent ev) {
|
||||
if (ev.containsEvent(ChangeManager.DOCR_SYMBOL_ADDED) ||
|
||||
ev.containsEvent(ChangeManager.DOCR_SYMBOL_ADDRESS_CHANGED) ||
|
||||
ev.containsEvent(ChangeManager.DOCR_SYMBOL_REMOVED) ||
|
||||
ev.containsEvent(ChangeManager.DOCR_SYMBOL_RENAMED)) {
|
||||
if (ev.contains(SYMBOL_ADDED, SYMBOL_ADDRESS_CHANGED, SYMBOL_REMOVED, SYMBOL_RENAMED)) {
|
||||
synchronized (lock) {
|
||||
symbols = null;
|
||||
}
|
||||
|
|
|
@ -26,7 +26,8 @@ import ghidra.framework.options.Options;
|
|||
import ghidra.program.model.data.*;
|
||||
import ghidra.program.model.listing.DataTypeArchive;
|
||||
import ghidra.program.model.listing.Program;
|
||||
import ghidra.program.util.*;
|
||||
import ghidra.program.util.ProgramChangeRecord;
|
||||
import ghidra.program.util.ProgramEvent;
|
||||
import ghidra.util.InvalidNameException;
|
||||
import ghidra.util.exception.*;
|
||||
import ghidra.util.task.TaskMonitor;
|
||||
|
@ -34,8 +35,7 @@ import ghidra.util.task.TaskMonitor;
|
|||
/**
|
||||
* Database implementation for Data Type Archive.
|
||||
*/
|
||||
public class DataTypeArchiveDB extends DomainObjectAdapterDB
|
||||
implements DataTypeArchive, DataTypeArchiveChangeManager {
|
||||
public class DataTypeArchiveDB extends DomainObjectAdapterDB implements DataTypeArchive {
|
||||
|
||||
/**
|
||||
* DB_VERSION should be incremented any time a change is made to the overall
|
||||
|
@ -287,98 +287,82 @@ public class DataTypeArchiveDB extends DomainObjectAdapterDB
|
|||
/**
|
||||
* notification the a data type has changed
|
||||
* @param dataTypeID the id of the data type that changed.
|
||||
* @param type the type of the change (moved, renamed, etc.)
|
||||
* @param eventType the type of the change (moved, renamed, etc.)
|
||||
* @param isAutoResponseChange true if change is an auto-response change caused by
|
||||
* another datatype's change (e.g., size, alignment), else false in which case this
|
||||
* change will be added to archive change-set to aid merge conflict detection.
|
||||
* @param oldValue the old data type.
|
||||
* @param newValue the new data type.
|
||||
*/
|
||||
public void dataTypeChanged(long dataTypeID, int type, boolean isAutoResponseChange,
|
||||
Object oldValue, Object newValue) {
|
||||
public void dataTypeChanged(long dataTypeID, ProgramEvent eventType,
|
||||
boolean isAutoResponseChange, Object oldValue, Object newValue) {
|
||||
if (recordChanges && !isAutoResponseChange) {
|
||||
((DataTypeArchiveDBChangeSet) changeSet).dataTypeChanged(dataTypeID);
|
||||
}
|
||||
changed = true;
|
||||
fireEvent(new ProgramChangeRecord(type, null, null, null, oldValue, newValue));
|
||||
fireEvent(new ProgramChangeRecord(eventType, oldValue, newValue));
|
||||
}
|
||||
|
||||
/**
|
||||
* Notification that a data type was added.
|
||||
* @param dataTypeID the id if the data type that was added.
|
||||
* @param type should always be DATATYPE_ADDED
|
||||
* @param eventType should always be DATATYPE_ADDED
|
||||
* @param oldValue always null
|
||||
* @param newValue the data type added.
|
||||
*/
|
||||
public void dataTypeAdded(long dataTypeID, int type, Object oldValue, Object newValue) {
|
||||
public void dataTypeAdded(long dataTypeID, ProgramEvent eventType, Object oldValue,
|
||||
Object newValue) {
|
||||
if (recordChanges) {
|
||||
((DataTypeArchiveDBChangeSet) changeSet).dataTypeAdded(dataTypeID);
|
||||
}
|
||||
changed = true;
|
||||
fireEvent(new ProgramChangeRecord(type, null, null, null, oldValue, newValue));
|
||||
fireEvent(new ProgramChangeRecord(eventType, oldValue, newValue));
|
||||
}
|
||||
|
||||
/**
|
||||
* Notification that a category was changed.
|
||||
* @param categoryID the id of the data type that was added.
|
||||
* @param type the type of changed
|
||||
* @param eventType the type of change
|
||||
* @param oldValue old value depends on the type.
|
||||
* @param newValue new value depends on the type.
|
||||
*/
|
||||
public void categoryChanged(long categoryID, int type, Object oldValue, Object newValue) {
|
||||
public void categoryChanged(long categoryID, ProgramEvent eventType, Object oldValue,
|
||||
Object newValue) {
|
||||
if (recordChanges) {
|
||||
((DataTypeArchiveDBChangeSet) changeSet).categoryChanged(categoryID);
|
||||
}
|
||||
changed = true;
|
||||
fireEvent(new ProgramChangeRecord(type, null, null, null, oldValue, newValue));
|
||||
fireEvent(new ProgramChangeRecord(eventType, oldValue, newValue));
|
||||
}
|
||||
|
||||
/**
|
||||
* Notification that a category was added.
|
||||
* @param categoryID the id of the data type that was added.
|
||||
* @param type the type of changed (should always be CATEGORY_ADDED)
|
||||
* @param eventType the type of change (should always be CATEGORY_ADDED)
|
||||
* @param oldValue always null
|
||||
* @param newValue new value depends on the type.
|
||||
*/
|
||||
public void categoryAdded(long categoryID, int type, Object oldValue, Object newValue) {
|
||||
public void categoryAdded(long categoryID, ProgramEvent eventType, Object oldValue,
|
||||
Object newValue) {
|
||||
if (recordChanges) {
|
||||
((DataTypeArchiveDBChangeSet) changeSet).categoryAdded(categoryID);
|
||||
}
|
||||
changed = true;
|
||||
fireEvent(new ProgramChangeRecord(type, null, null, null, oldValue, newValue));
|
||||
fireEvent(new ProgramChangeRecord(eventType, oldValue, newValue));
|
||||
}
|
||||
|
||||
/**
|
||||
* Mark the state this Data Type Archive as having changed and generate
|
||||
* the event. Any or all parameters may be null.
|
||||
* @param type event type
|
||||
* @param eventType event type
|
||||
* @param oldValue original value
|
||||
* @param newValue new value
|
||||
*/
|
||||
@Override
|
||||
public void setChanged(int type, Object oldValue, Object newValue) {
|
||||
public void setChanged(ProgramEvent eventType, Object oldValue, Object newValue) {
|
||||
|
||||
changed = true;
|
||||
|
||||
fireEvent(new DataTypeArchiveChangeRecord(type, null, oldValue, newValue));
|
||||
}
|
||||
|
||||
/**
|
||||
* Mark the state of a Program as having changed and generate
|
||||
* the event. Any or all parameters may be null.
|
||||
* NOTE: ChangeSet data will not be updated since this a very generic
|
||||
* change not related to a specific address.
|
||||
* @param type event type
|
||||
* @param affectedObj object that is the subject of the event
|
||||
* @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
|
||||
* the event
|
||||
*/
|
||||
@Override
|
||||
public void setObjChanged(int type, Object affectedObj, Object oldValue, Object newValue) {
|
||||
changed = true;
|
||||
fireEvent(new DataTypeArchiveChangeRecord(type, affectedObj, oldValue, newValue));
|
||||
fireEvent(new ProgramChangeRecord(eventType, oldValue, newValue));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -531,7 +515,7 @@ public class DataTypeArchiveDB extends DomainObjectAdapterDB
|
|||
@Override
|
||||
public void invalidate() {
|
||||
clearCache(false);
|
||||
fireEvent(new DomainObjectChangeRecord(DomainObject.DO_OBJECT_RESTORED));
|
||||
fireEvent(new DomainObjectChangeRecord(DomainObjectEvent.RESTORED));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -22,7 +22,7 @@ import db.util.ErrorHandler;
|
|||
import ghidra.program.database.map.AddressMap;
|
||||
import ghidra.program.database.util.AddressRangeMapDB;
|
||||
import ghidra.program.model.address.*;
|
||||
import ghidra.program.util.ChangeManager;
|
||||
import ghidra.program.util.ProgramEvent;
|
||||
import ghidra.util.Lock;
|
||||
import ghidra.util.exception.CancelledException;
|
||||
import ghidra.util.exception.DuplicateNameException;
|
||||
|
@ -102,8 +102,7 @@ public class IntRangeMapDB implements IntRangeMap {
|
|||
lock.acquire();
|
||||
try {
|
||||
propertyMap.paintRange(start, end, new IntField(value));
|
||||
program.setChanged(ChangeManager.DOCR_INT_ADDRESS_SET_PROPERTY_MAP_CHANGED, null,
|
||||
mapName);
|
||||
program.setChanged(ProgramEvent.INT_PROPERTY_MAP_CHANGED, null, mapName);
|
||||
}
|
||||
finally {
|
||||
lock.release();
|
||||
|
@ -122,8 +121,7 @@ public class IntRangeMapDB implements IntRangeMap {
|
|||
AddressRange range = iter.next();
|
||||
setValue(range.getMinAddress(), range.getMaxAddress(), value);
|
||||
}
|
||||
program.setChanged(ChangeManager.DOCR_INT_ADDRESS_SET_PROPERTY_MAP_CHANGED, null,
|
||||
mapName);
|
||||
program.setChanged(ProgramEvent.INT_PROPERTY_MAP_CHANGED, null, mapName);
|
||||
}
|
||||
finally {
|
||||
lock.release();
|
||||
|
@ -136,8 +134,7 @@ public class IntRangeMapDB implements IntRangeMap {
|
|||
lock.acquire();
|
||||
try {
|
||||
propertyMap.dispose();
|
||||
program.setChanged(ChangeManager.DOCR_INT_ADDRESS_SET_PROPERTY_MAP_CHANGED, null,
|
||||
mapName);
|
||||
program.setChanged(ProgramEvent.INT_PROPERTY_MAP_CHANGED, null, mapName);
|
||||
}
|
||||
finally {
|
||||
lock.release();
|
||||
|
@ -150,8 +147,7 @@ public class IntRangeMapDB implements IntRangeMap {
|
|||
lock.acquire();
|
||||
try {
|
||||
propertyMap.clearRange(startAddr, endAddr);
|
||||
program.setChanged(ChangeManager.DOCR_INT_ADDRESS_SET_PROPERTY_MAP_CHANGED, null,
|
||||
mapName);
|
||||
program.setChanged(ProgramEvent.INT_PROPERTY_MAP_CHANGED, null, mapName);
|
||||
}
|
||||
finally {
|
||||
lock.release();
|
||||
|
@ -168,8 +164,7 @@ public class IntRangeMapDB implements IntRangeMap {
|
|||
AddressRange range = iter.next();
|
||||
clearValue(range.getMinAddress(), range.getMaxAddress());
|
||||
}
|
||||
program.setChanged(ChangeManager.DOCR_INT_ADDRESS_SET_PROPERTY_MAP_CHANGED, null,
|
||||
mapName);
|
||||
program.setChanged(ProgramEvent.INT_PROPERTY_MAP_CHANGED, null, mapName);
|
||||
}
|
||||
finally {
|
||||
lock.release();
|
||||
|
|
|
@ -809,15 +809,15 @@ public class ProgramDB extends DomainObjectAdapterDB implements Program, ChangeM
|
|||
/**
|
||||
* notification the a datatype has changed
|
||||
* @param dataTypeID the id of the datatype that changed.
|
||||
* @param type the type of the change (moved, renamed, etc.)
|
||||
* @param eventType the type of the change (moved, renamed, etc.)
|
||||
* @param isAutoChange true if change was an automatic change in response to
|
||||
* another datatype's change (e.g., size, alignment), else false in which case this
|
||||
* change will be added to program change-set to aid merge conflict detection.
|
||||
* @param oldValue the old datatype.
|
||||
* @param newValue the new datatype.
|
||||
*/
|
||||
public void dataTypeChanged(long dataTypeID, int type, boolean isAutoChange, Object oldValue,
|
||||
Object newValue) {
|
||||
public void dataTypeChanged(long dataTypeID, ProgramEvent eventType, boolean isAutoChange,
|
||||
Object oldValue, Object newValue) {
|
||||
// TODO: do not need to record type changes for packed composite change which is in repsonse
|
||||
// to component size or alignment change.
|
||||
if (recordChanges && !isAutoChange) {
|
||||
|
@ -832,100 +832,104 @@ public class ProgramDB extends DomainObjectAdapterDB implements Program, ChangeM
|
|||
catch (IOException e) {
|
||||
dbError(e);
|
||||
}
|
||||
fireEvent(new ProgramChangeRecord(type, null, null, null, oldValue, newValue));
|
||||
fireEvent(new ProgramChangeRecord(eventType, null, null, null, oldValue, newValue));
|
||||
}
|
||||
|
||||
/**
|
||||
* Notification that a datatype was added.
|
||||
* @param dataTypeID the id if the datatype that was added.
|
||||
* @param type should always be DATATYPE_ADDED
|
||||
* @param eventType should always be DATATYPE_ADDED
|
||||
* @param oldValue always null
|
||||
* @param newValue the datatype added.
|
||||
*/
|
||||
public void dataTypeAdded(long dataTypeID, int type, Object oldValue, Object newValue) {
|
||||
public void dataTypeAdded(long dataTypeID, ProgramEvent eventType, Object oldValue,
|
||||
Object newValue) {
|
||||
if (recordChanges) {
|
||||
((ProgramDBChangeSet) changeSet).dataTypeAdded(dataTypeID);
|
||||
}
|
||||
changed = true;
|
||||
fireEvent(new ProgramChangeRecord(type, null, null, null, oldValue, newValue));
|
||||
fireEvent(new ProgramChangeRecord(eventType, null, null, null, oldValue, newValue));
|
||||
}
|
||||
|
||||
/**
|
||||
* Notification that a category was changed.
|
||||
* @param categoryID the id of the datatype that was added.
|
||||
* @param type the type of changed
|
||||
* @param eventType the type of change.
|
||||
* @param oldValue old value depends on the type.
|
||||
* @param newValue new value depends on the type.
|
||||
*/
|
||||
public void categoryChanged(long categoryID, int type, Object oldValue, Object newValue) {
|
||||
public void categoryChanged(long categoryID, ProgramEvent eventType, Object oldValue,
|
||||
Object newValue) {
|
||||
if (recordChanges) {
|
||||
((ProgramDBChangeSet) changeSet).categoryChanged(categoryID);
|
||||
}
|
||||
changed = true;
|
||||
fireEvent(new ProgramChangeRecord(type, null, null, null, oldValue, newValue));
|
||||
fireEvent(new ProgramChangeRecord(eventType, null, null, null, oldValue, newValue));
|
||||
}
|
||||
|
||||
/**
|
||||
* Notification that a category was added.
|
||||
* @param categoryID the id of the datatype that was added.
|
||||
* @param type the type of changed (should always be CATEGORY_ADDED)
|
||||
* @param eventType the type of change (should always be CATEGORY_ADDED)
|
||||
* @param oldValue always null
|
||||
* @param newValue new value depends on the type.
|
||||
*/
|
||||
public void categoryAdded(long categoryID, int type, Object oldValue, Object newValue) {
|
||||
public void categoryAdded(long categoryID, ProgramEvent eventType, Object oldValue,
|
||||
Object newValue) {
|
||||
if (recordChanges) {
|
||||
((ProgramDBChangeSet) changeSet).categoryAdded(categoryID);
|
||||
}
|
||||
changed = true;
|
||||
fireEvent(new ProgramChangeRecord(type, null, null, null, oldValue, newValue));
|
||||
fireEvent(new ProgramChangeRecord(eventType, null, null, null, oldValue, newValue));
|
||||
}
|
||||
|
||||
public void sourceArchiveAdded(UniversalID sourceArchiveID, int type) {
|
||||
public void sourceArchiveAdded(UniversalID sourceArchiveID, ProgramEvent eventType) {
|
||||
if (recordChanges) {
|
||||
((ProgramDBChangeSet) changeSet).sourceArchiveAdded(sourceArchiveID.getValue());
|
||||
}
|
||||
changed = true;
|
||||
fireEvent(new ProgramChangeRecord(type, null, null, sourceArchiveID, null, null));
|
||||
fireEvent(new ProgramChangeRecord(eventType, null, null, sourceArchiveID, null, null));
|
||||
}
|
||||
|
||||
public void sourceArchiveChanged(UniversalID sourceArchiveID, int type) {
|
||||
public void sourceArchiveChanged(UniversalID sourceArchiveID, ProgramEvent eventType) {
|
||||
if (recordChanges) {
|
||||
((ProgramDBChangeSet) changeSet).sourceArchiveChanged(sourceArchiveID.getValue());
|
||||
}
|
||||
changed = true;
|
||||
fireEvent(new ProgramChangeRecord(type, null, null, sourceArchiveID, null, null));
|
||||
fireEvent(new ProgramChangeRecord(eventType, null, null, sourceArchiveID, null, null));
|
||||
}
|
||||
|
||||
/**
|
||||
* Notification that a program tree was added.
|
||||
* @param id the id of the program tree that was added.
|
||||
* @param type the type of changed
|
||||
* @param eventType the type of change
|
||||
* @param oldValue old value is null
|
||||
* @param newValue new value depends the tree that was added.
|
||||
*/
|
||||
public void programTreeAdded(long id, int type, Object oldValue, Object newValue) {
|
||||
public void programTreeAdded(long id, ProgramEvent eventType, Object oldValue,
|
||||
Object newValue) {
|
||||
if (recordChanges) {
|
||||
((ProgramDBChangeSet) changeSet).programTreeAdded(id);
|
||||
}
|
||||
changed = true;
|
||||
fireEvent(new ProgramChangeRecord(type, null, null, null, oldValue, newValue));
|
||||
fireEvent(new ProgramChangeRecord(eventType, null, null, null, oldValue, newValue));
|
||||
}
|
||||
|
||||
/**
|
||||
* Notification that a program tree was changed.
|
||||
* @param id the id of the program tree that was changed.
|
||||
* @param type the type of change
|
||||
* @param eventType the {@link EventType} for this event
|
||||
* @param affectedObj the object that was changed
|
||||
* @param oldValue old value depends on the type of the change
|
||||
* @param newValue old value depends on the type of the change
|
||||
*/
|
||||
public void programTreeChanged(long id, int type, Object affectedObj, Object oldValue,
|
||||
Object newValue) {
|
||||
public void programTreeChanged(long id, ProgramEvent eventType, Object affectedObj,
|
||||
Object oldValue, Object newValue) {
|
||||
if (recordChanges) {
|
||||
((ProgramDBChangeSet) changeSet).programTreeChanged(id);
|
||||
}
|
||||
changed = true;
|
||||
fireEvent(new ProgramChangeRecord(type, null, null, affectedObj, oldValue, newValue));
|
||||
fireEvent(new ProgramChangeRecord(eventType, null, null, affectedObj, oldValue, newValue));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -933,45 +937,46 @@ public class ProgramDB extends DomainObjectAdapterDB implements Program, ChangeM
|
|||
* edit or a delete.
|
||||
*
|
||||
* @param tag the tag that was changed.
|
||||
* @param type the type of change
|
||||
* @param eventType the type of change
|
||||
* @param oldValue old value
|
||||
* @param newValue new value
|
||||
*/
|
||||
public void tagChanged(FunctionTag tag, int type, Object oldValue, Object newValue) {
|
||||
public void tagChanged(FunctionTag tag, ProgramEvent eventType, Object oldValue,
|
||||
Object newValue) {
|
||||
if (recordChanges) {
|
||||
long tagID = tag.getId();
|
||||
((ProgramDBChangeSet) changeSet).tagChanged(tagID);
|
||||
}
|
||||
changed = true;
|
||||
fireEvent(new ProgramChangeRecord(type, null, null, tag, oldValue, newValue));
|
||||
fireEvent(new ProgramChangeRecord(eventType, null, null, tag, oldValue, newValue));
|
||||
}
|
||||
|
||||
/**
|
||||
* Notification that a new {@link FunctionTag} was created.
|
||||
*
|
||||
* @param tag the tag that was created.
|
||||
* @param type the type of change
|
||||
* @param eventType the type of change
|
||||
*/
|
||||
public void tagCreated(FunctionTag tag, int type) {
|
||||
public void tagCreated(FunctionTag tag, ProgramEvent eventType) {
|
||||
if (recordChanges) {
|
||||
long tagID = tag.getId();
|
||||
((ProgramDBChangeSet) changeSet).tagCreated(tagID);
|
||||
}
|
||||
changed = true;
|
||||
fireEvent(new ProgramChangeRecord(type, null, null, tag, null, null));
|
||||
fireEvent(new ProgramChangeRecord(eventType, null, null, tag, null, null));
|
||||
}
|
||||
|
||||
/**
|
||||
* Notification that a symbol was changed.
|
||||
* @param symbol the symbol that was changed.
|
||||
* @param type the type of change
|
||||
* @param eventType the type of change
|
||||
* @param addr the address of the symbol that changed
|
||||
* @param affectedObj the object that was changed
|
||||
* @param oldValue old value depends on the type of the change
|
||||
* @param newValue old value depends on the type of the change
|
||||
*/
|
||||
public void symbolChanged(Symbol symbol, int type, Address addr, Object affectedObj,
|
||||
Object oldValue, Object newValue) {
|
||||
public void symbolChanged(Symbol symbol, ProgramEvent eventType, Address addr,
|
||||
Object affectedObj, Object oldValue, Object newValue) {
|
||||
if (recordChanges) {
|
||||
// Only add the symbol ID to the change set if it isn't a default symbol.
|
||||
if (!symbol.isDynamic()) {
|
||||
|
@ -984,8 +989,7 @@ public class ProgramDB extends DomainObjectAdapterDB implements Program, ChangeM
|
|||
Function function = (Function) parentNamespace;
|
||||
Address entryPoint = function.getEntryPoint();
|
||||
updateChangeSet(entryPoint, entryPoint);
|
||||
fireEvent(new ProgramChangeRecord(DOCR_FUNCTION_CHANGED, entryPoint, entryPoint,
|
||||
function, null, null));
|
||||
fireEvent(new FunctionChangeRecord(function, null));
|
||||
}
|
||||
}
|
||||
if (addr != null) {
|
||||
|
@ -993,18 +997,18 @@ public class ProgramDB extends DomainObjectAdapterDB implements Program, ChangeM
|
|||
}
|
||||
}
|
||||
changed = true;
|
||||
fireEvent(new ProgramChangeRecord(type, addr, addr, affectedObj, oldValue, newValue));
|
||||
fireEvent(new ProgramChangeRecord(eventType, addr, addr, affectedObj, oldValue, newValue));
|
||||
}
|
||||
|
||||
/**
|
||||
* Notification that a symbol was added.
|
||||
* @param symbol the symbol that was added.
|
||||
* @param type the type of change
|
||||
* @param eventType the type of change
|
||||
* @param addr the address of the symbol that added
|
||||
* @param oldValue old value depends on the type of the change
|
||||
* @param newValue old value depends on the type of the change
|
||||
*/
|
||||
public void symbolAdded(Symbol symbol, int type, Address addr, Object oldValue,
|
||||
public void symbolAdded(Symbol symbol, ProgramEvent eventType, Address addr, Object oldValue,
|
||||
Object newValue) {
|
||||
if (recordChanges) {
|
||||
if (!symbol.isDynamic()) {
|
||||
|
@ -1017,8 +1021,7 @@ public class ProgramDB extends DomainObjectAdapterDB implements Program, ChangeM
|
|||
if (function != null) {
|
||||
Address entryPoint = function.getEntryPoint();
|
||||
updateChangeSet(entryPoint, entryPoint);
|
||||
fireEvent(new ProgramChangeRecord(DOCR_FUNCTION_CHANGED, entryPoint, entryPoint,
|
||||
function, null, null));
|
||||
fireEvent(new FunctionChangeRecord(function, null));
|
||||
}
|
||||
}
|
||||
if (addr != null) {
|
||||
|
@ -1026,7 +1029,7 @@ public class ProgramDB extends DomainObjectAdapterDB implements Program, ChangeM
|
|||
}
|
||||
}
|
||||
changed = true;
|
||||
fireEvent(new ProgramChangeRecord(type, addr, addr, null, oldValue, newValue));
|
||||
fireEvent(new ProgramChangeRecord(eventType, addr, addr, null, oldValue, newValue));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -1041,78 +1044,50 @@ public class ProgramDB extends DomainObjectAdapterDB implements Program, ChangeM
|
|||
}
|
||||
}
|
||||
changed = true;
|
||||
fireEvent(
|
||||
new ProgramChangeRecord(DOCR_REGISTER_VALUES_CHANGED, start, end, null, null, null));
|
||||
fireEvent(new ProgramChangeRecord(ProgramEvent.REGISTER_VALUES_CHANGED, start, end, null,
|
||||
null, null));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setChanged(int type, Object oldValue, Object newValue) {
|
||||
setChanged(type, (Address) null, (Address) null, oldValue, newValue);
|
||||
public void setChanged(ProgramEvent event, Object oldValue, Object newValue) {
|
||||
setChanged(event, (Address) null, (Address) null, oldValue, newValue);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setChanged(int type, Address start, Address end, Object oldValue, Object newValue) {
|
||||
|
||||
Address newstart = null;
|
||||
Address newend = null;
|
||||
|
||||
if (start != null) {
|
||||
newstart = start;
|
||||
}
|
||||
if (end != null) {
|
||||
newend = end;
|
||||
}
|
||||
public void setChanged(ProgramChangeRecord changeRecord) {
|
||||
if (recordChanges) {
|
||||
updateChangeSet(newstart, newend);
|
||||
updateChangeSet(changeRecord.getStart(), changeRecord.getEnd());
|
||||
}
|
||||
changed = true;
|
||||
fireEvent(changeRecord);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setChanged(ProgramEvent event, Address start, Address end, Object oldValue,
|
||||
Object newValue) {
|
||||
|
||||
if (recordChanges) {
|
||||
updateChangeSet(start, end);
|
||||
}
|
||||
changed = true;
|
||||
|
||||
fireEvent(new ProgramChangeRecord(type, newstart, newend, null, oldValue, newValue));
|
||||
fireEvent(new ProgramChangeRecord(event, start, end, null, oldValue, newValue));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setObjChanged(int type, Object affectedObj, Object oldValue, Object newValue) {
|
||||
changed = true;
|
||||
fireEvent(new ProgramChangeRecord(type, null, null, affectedObj, oldValue, newValue));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setObjChanged(int type, int subType, Object affectedObj, Object oldValue,
|
||||
public void setObjChanged(ProgramEvent eventType, Object affected, Object oldValue,
|
||||
Object newValue) {
|
||||
changed = true;
|
||||
fireEvent(
|
||||
new ProgramChangeRecord(type, subType, null, null, affectedObj, oldValue, newValue));
|
||||
fireEvent(new ProgramChangeRecord(eventType, null, null, affected, oldValue, newValue));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setObjChanged(int type, Address addr, Object affectedObj, Object oldValue,
|
||||
Object newValue) {
|
||||
if (recordChanges) {
|
||||
updateChangeSet(addr, addr);
|
||||
}
|
||||
changed = true;
|
||||
fireEvent(new ProgramChangeRecord(type, addr, addr, affectedObj, oldValue, newValue));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setObjChanged(int type, int subType, Address addr, Object affectedObj,
|
||||
public void setObjChanged(ProgramEvent eventType, Address addr, Object affectedObj,
|
||||
Object oldValue, Object newValue) {
|
||||
if (recordChanges) {
|
||||
updateChangeSet(addr, addr);
|
||||
}
|
||||
changed = true;
|
||||
fireEvent(
|
||||
new ProgramChangeRecord(type, subType, addr, addr, affectedObj, oldValue, newValue));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setObjChanged(int type, AddressSetView addrSet, Object affectedObj, Object oldValue,
|
||||
Object newValue) {
|
||||
if (recordChanges) {
|
||||
updateChangeSet(addrSet);
|
||||
}
|
||||
changed = true;
|
||||
fireEvent(new ProgramChangeRecord(type, null, null, affectedObj, oldValue, newValue));
|
||||
fireEvent(new ProgramChangeRecord(eventType, addr, addr, affectedObj, oldValue, newValue));
|
||||
}
|
||||
|
||||
private void updateChangeSet(Address start, Address end) {
|
||||
|
@ -1125,12 +1100,6 @@ public class ProgramDB extends DomainObjectAdapterDB implements Program, ChangeM
|
|||
}
|
||||
}
|
||||
|
||||
private void updateChangeSet(AddressSetView addrSet) {
|
||||
if (addrSet != null) {
|
||||
((ProgramDBChangeSet) changeSet).add(addrSet);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPropertyChanged(String propertyName, Address codeUnitAddr, Object oldValue,
|
||||
Object newValue) {
|
||||
|
@ -1138,7 +1107,8 @@ public class ProgramDB extends DomainObjectAdapterDB implements Program, ChangeM
|
|||
updateChangeSet(codeUnitAddr, null);
|
||||
}
|
||||
changed = true;
|
||||
fireEvent(new CodeUnitPropertyChangeRecord(propertyName, codeUnitAddr, oldValue, newValue));
|
||||
fireEvent(new CodeUnitPropertyChangeRecord(ProgramEvent.CODE_UNIT_PROPERTY_CHANGED,
|
||||
propertyName, codeUnitAddr, oldValue, newValue));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -1147,7 +1117,8 @@ public class ProgramDB extends DomainObjectAdapterDB implements Program, ChangeM
|
|||
updateChangeSet(start, end);
|
||||
}
|
||||
changed = true;
|
||||
fireEvent(new CodeUnitPropertyChangeRecord(propertyName, start, end));
|
||||
fireEvent(new CodeUnitPropertyChangeRecord(ProgramEvent.CODE_UNIT_PROPERTY_RANGE_REMOVED,
|
||||
propertyName, start, end));
|
||||
}
|
||||
|
||||
void userDataChanged(String propertyName, Address codeUnitAddr, Object oldValue,
|
||||
|
@ -1217,7 +1188,7 @@ public class ProgramDB extends DomainObjectAdapterDB implements Program, ChangeM
|
|||
ovSpace =
|
||||
overlaySpaceAdapter.createOverlaySpace(addressFactory, overlaySpaceName, baseSpace);
|
||||
|
||||
setChanged(ChangeManager.DOCR_OVERLAY_SPACE_ADDED, overlaySpaceName, null);
|
||||
setChanged(ProgramEvent.OVERLAY_SPACE_ADDED, overlaySpaceName, null);
|
||||
}
|
||||
catch (IOException e) {
|
||||
dbError(e);
|
||||
|
@ -1248,8 +1219,8 @@ public class ProgramDB extends DomainObjectAdapterDB implements Program, ChangeM
|
|||
addressFactory.overlaySpaceRenamed(overlaySpaceName, newName, true);
|
||||
addrMap.renameOverlaySpace(overlaySpaceName, newName);
|
||||
clearCache(true);
|
||||
setChanged(ChangeManager.DOCR_OVERLAY_SPACE_RENAMED, overlaySpaceName, newName);
|
||||
fireEvent(new DomainObjectChangeRecord(DomainObject.DO_OBJECT_RESTORED));
|
||||
setChanged(ProgramEvent.OVERLAY_SPACE_RENAMED, overlaySpaceName, newName);
|
||||
fireEvent(new DomainObjectChangeRecord(DomainObjectEvent.RESTORED));
|
||||
}
|
||||
}
|
||||
catch (IOException e) {
|
||||
|
@ -1281,8 +1252,8 @@ public class ProgramDB extends DomainObjectAdapterDB implements Program, ChangeM
|
|||
overlaySpaceAdapter.removeOverlaySpace(overlaySpaceName);
|
||||
addrMap.deleteOverlaySpace(overlaySpaceName);
|
||||
clearCache(true);
|
||||
setChanged(ChangeManager.DOCR_OVERLAY_SPACE_REMOVED, overlaySpaceName, null);
|
||||
fireEvent(new DomainObjectChangeRecord(DomainObject.DO_OBJECT_RESTORED));
|
||||
setChanged(ProgramEvent.OVERLAY_SPACE_REMOVED, overlaySpaceName, null);
|
||||
fireEvent(new DomainObjectChangeRecord(DomainObjectEvent.RESTORED));
|
||||
return true;
|
||||
}
|
||||
catch (IOException e) {
|
||||
|
@ -1367,7 +1338,7 @@ public class ProgramDB extends DomainObjectAdapterDB implements Program, ChangeM
|
|||
dataMap.put(IMAGE_OFFSET, Long.toHexString(base.getOffset()));
|
||||
imageBaseOverride = false;
|
||||
|
||||
setChanged(ChangeManager.DOCR_IMAGE_BASE_CHANGED, oldBase, base);
|
||||
setChanged(ProgramEvent.IMAGE_BASE_CHANGED, oldBase, base);
|
||||
invalidate();
|
||||
((SymbolManager) managers[SYMBOL_MGR]).imageBaseChanged(oldBase, base);
|
||||
changed = true;
|
||||
|
@ -1874,7 +1845,7 @@ public class ProgramDB extends DomainObjectAdapterDB implements Program, ChangeM
|
|||
@Override
|
||||
public void invalidate() {
|
||||
clearCache(false);
|
||||
fireEvent(new DomainObjectChangeRecord(DomainObject.DO_OBJECT_RESTORED));
|
||||
fireEvent(new DomainObjectChangeRecord(DomainObjectEvent.RESTORED));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -2157,7 +2128,7 @@ public class ProgramDB extends DomainObjectAdapterDB implements Program, ChangeM
|
|||
finally {
|
||||
setEventsEnabled(true);
|
||||
}
|
||||
fireEvent(new DomainObjectChangeRecord(ChangeManager.DOCR_LANGUAGE_CHANGED));
|
||||
fireEvent(new DomainObjectChangeRecord(ProgramEvent.LANGUAGE_CHANGED));
|
||||
}
|
||||
finally {
|
||||
lock.release();
|
||||
|
@ -2278,7 +2249,7 @@ public class ProgramDB extends DomainObjectAdapterDB implements Program, ChangeM
|
|||
AddressSetPropertyMapDB map =
|
||||
AddressSetPropertyMapDB.createPropertyMap(this, mapName, this, addrMap, lock);
|
||||
addrSetPropertyMap.put(mapName, map);
|
||||
setChanged(DOCR_ADDRESS_SET_PROPERTY_MAP_ADDED, null, mapName);
|
||||
setChanged(ProgramEvent.ADDRESS_PROPERTY_MAP_ADDED, null, mapName);
|
||||
return map;
|
||||
}
|
||||
finally {
|
||||
|
@ -2316,7 +2287,7 @@ public class ProgramDB extends DomainObjectAdapterDB implements Program, ChangeM
|
|||
}
|
||||
if (pm != null) {
|
||||
pm.delete();
|
||||
setChanged(DOCR_ADDRESS_SET_PROPERTY_MAP_REMOVED, null, mapName);
|
||||
setChanged(ProgramEvent.ADDRESS_PROPERTY_MAP_REMOVED, null, mapName);
|
||||
}
|
||||
}
|
||||
finally {
|
||||
|
@ -2330,7 +2301,7 @@ public class ProgramDB extends DomainObjectAdapterDB implements Program, ChangeM
|
|||
try {
|
||||
IntRangeMapDB map = IntRangeMapDB.createPropertyMap(this, mapName, this, addrMap, lock);
|
||||
intRangePropertyMap.put(mapName, map);
|
||||
setChanged(DOCR_INT_ADDRESS_SET_PROPERTY_MAP_ADDED, null, mapName);
|
||||
setChanged(ProgramEvent.INT_PROPERTY_MAP_ADDED, null, mapName);
|
||||
return map;
|
||||
}
|
||||
finally {
|
||||
|
@ -2369,7 +2340,7 @@ public class ProgramDB extends DomainObjectAdapterDB implements Program, ChangeM
|
|||
|
||||
if (rangeMap != null) {
|
||||
rangeMap.delete();
|
||||
setChanged(DOCR_INT_ADDRESS_SET_PROPERTY_MAP_REMOVED, null, mapName);
|
||||
setChanged(ProgramEvent.INT_PROPERTY_MAP_REMOVED, null, mapName);
|
||||
}
|
||||
}
|
||||
finally {
|
||||
|
|
|
@ -27,7 +27,7 @@ import ghidra.framework.store.LockException;
|
|||
import ghidra.program.model.data.*;
|
||||
import ghidra.program.model.lang.*;
|
||||
import ghidra.program.model.listing.IncompatibleLanguageException;
|
||||
import ghidra.program.util.DataTypeArchiveChangeManager;
|
||||
import ghidra.program.util.ProgramEvent;
|
||||
import ghidra.util.InvalidNameException;
|
||||
import ghidra.util.Lock;
|
||||
import ghidra.util.exception.CancelledException;
|
||||
|
@ -65,8 +65,8 @@ public class ProjectDataTypeManager extends StandAloneDataTypeManager
|
|||
* @throws IOException if a database I/O error occurs.
|
||||
*/
|
||||
ProjectDataTypeManager(DataTypeArchiveDB dataTypeArchive, DBHandle handle, int openMode,
|
||||
ErrorHandler errHandler, Lock lock,
|
||||
TaskMonitor monitor) throws CancelledException, VersionException, IOException {
|
||||
ErrorHandler errHandler, Lock lock, TaskMonitor monitor)
|
||||
throws CancelledException, VersionException, IOException {
|
||||
super(handle, openMode, errHandler, lock, monitor);
|
||||
this.dataTypeArchive = dataTypeArchive;
|
||||
logWarning();
|
||||
|
@ -110,75 +110,73 @@ public class ProjectDataTypeManager extends StandAloneDataTypeManager
|
|||
super.dataTypeChanged(dt, isAutoChange);
|
||||
// dataTypeArchive.getCodeManager().invalidateCache(false);
|
||||
// TODO
|
||||
dataTypeArchive.dataTypeChanged(getID(dt),
|
||||
DataTypeArchiveChangeManager.DOCR_DATA_TYPE_CHANGED, isAutoChange, null, dt);
|
||||
dataTypeArchive.dataTypeChanged(getID(dt), ProgramEvent.DATA_TYPE_CHANGED, isAutoChange,
|
||||
null, dt);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void dataTypeAdded(DataType newDt, DataType originalDataType) {
|
||||
super.dataTypeAdded(newDt, originalDataType);
|
||||
// saveArchiveName(originalDataType);
|
||||
dataTypeArchive.dataTypeAdded(getID(newDt),
|
||||
DataTypeArchiveChangeManager.DOCR_DATA_TYPE_ADDED, null, newDt);
|
||||
dataTypeArchive.dataTypeAdded(getID(newDt), ProgramEvent.DATA_TYPE_ADDED, null, newDt);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void dataTypeReplaced(long existingDtID, DataTypePath existingPath,
|
||||
DataType replacementDt) {
|
||||
super.dataTypeReplaced(existingDtID, existingPath, replacementDt);
|
||||
dataTypeArchive.dataTypeChanged(existingDtID,
|
||||
DataTypeArchiveChangeManager.DOCR_DATA_TYPE_REPLACED, false, existingPath,
|
||||
replacementDt);
|
||||
dataTypeArchive.dataTypeChanged(existingDtID, ProgramEvent.DATA_TYPE_REPLACED, false,
|
||||
existingPath, replacementDt);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void dataTypeDeleted(long deletedID, DataTypePath deletedDataTypePath) {
|
||||
super.dataTypeDeleted(deletedID, deletedDataTypePath);
|
||||
dataTypeArchive.dataTypeChanged(deletedID,
|
||||
DataTypeArchiveChangeManager.DOCR_DATA_TYPE_REMOVED, false, deletedDataTypePath, null);
|
||||
dataTypeArchive.dataTypeChanged(deletedID, ProgramEvent.DATA_TYPE_REMOVED, false,
|
||||
deletedDataTypePath, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void dataTypeMoved(DataType dt, DataTypePath oldPath, DataTypePath newPath) {
|
||||
super.dataTypeMoved(dt, oldPath, newPath);
|
||||
Category category = getCategory(oldPath.getCategoryPath());
|
||||
dataTypeArchive.dataTypeChanged(getID(dt),
|
||||
DataTypeArchiveChangeManager.DOCR_DATA_TYPE_MOVED, false, category, dt);
|
||||
dataTypeArchive.dataTypeChanged(getID(dt), ProgramEvent.DATA_TYPE_MOVED, false, category,
|
||||
dt);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void dataTypeNameChanged(DataType dt, String oldName) {
|
||||
super.dataTypeNameChanged(dt, oldName);
|
||||
dataTypeArchive.dataTypeChanged(getID(dt),
|
||||
DataTypeArchiveChangeManager.DOCR_DATA_TYPE_RENAMED, false, oldName, dt);
|
||||
dataTypeArchive.dataTypeChanged(getID(dt), ProgramEvent.DATA_TYPE_RENAMED, false, oldName,
|
||||
dt);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void categoryCreated(Category newCategory) {
|
||||
super.categoryCreated(newCategory);
|
||||
dataTypeArchive.categoryAdded(newCategory.getID(),
|
||||
DataTypeArchiveChangeManager.DOCR_CATEGORY_ADDED, newCategory.getParent(), newCategory);
|
||||
dataTypeArchive.categoryAdded(newCategory.getID(), ProgramEvent.DATA_TYPE_CATEGORY_ADDED,
|
||||
newCategory.getParent(), newCategory);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void categoryRenamed(CategoryPath oldPath, Category category) {
|
||||
super.categoryRenamed(oldPath, category);
|
||||
dataTypeArchive.categoryChanged(category.getID(),
|
||||
DataTypeArchiveChangeManager.DOCR_CATEGORY_RENAMED, oldPath.getName(), category);
|
||||
dataTypeArchive.categoryChanged(category.getID(), ProgramEvent.DATA_TYPE_CATEGORY_RENAMED,
|
||||
oldPath.getName(), category);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void categoryRemoved(Category parent, String name, long categoryID) {
|
||||
super.categoryRemoved(parent, name, categoryID);
|
||||
dataTypeArchive.categoryChanged(categoryID,
|
||||
DataTypeArchiveChangeManager.DOCR_CATEGORY_REMOVED, parent, name);
|
||||
protected void categoryRemoved(Category parent, String categoryName, long categoryID) {
|
||||
super.categoryRemoved(parent, categoryName, categoryID);
|
||||
dataTypeArchive.categoryChanged(categoryID, ProgramEvent.DATA_TYPE_CATEGORY_REMOVED, parent,
|
||||
categoryName);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void categoryMoved(CategoryPath oldPath, Category category) {
|
||||
super.categoryMoved(oldPath, category);
|
||||
dataTypeArchive.categoryChanged(category.getID(),
|
||||
DataTypeArchiveChangeManager.DOCR_CATEGORY_MOVED, oldPath.getParent(), category);
|
||||
dataTypeArchive.categoryChanged(category.getID(), ProgramEvent.DATA_TYPE_CATEGORY_MOVED,
|
||||
oldPath.getParent(), category);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -33,7 +33,7 @@ import ghidra.program.database.util.DatabaseTableUtils;
|
|||
import ghidra.program.database.util.EmptyRecordIterator;
|
||||
import ghidra.program.model.address.*;
|
||||
import ghidra.program.model.listing.*;
|
||||
import ghidra.program.util.ChangeManager;
|
||||
import ghidra.program.util.ProgramEvent;
|
||||
import ghidra.util.Lock;
|
||||
import ghidra.util.datastruct.ObjectArray;
|
||||
import ghidra.util.exception.*;
|
||||
|
@ -161,7 +161,7 @@ public class BookmarkDBManager implements BookmarkManager, ErrorHandler, Manager
|
|||
if (rec != null) {
|
||||
bookmarkAdapter.updateRecord(rec);
|
||||
Address addr = bm.getAddress();
|
||||
program.setObjChanged(ChangeManager.DOCR_BOOKMARK_CHANGED, addr, bm, null, null);
|
||||
program.setObjChanged(ProgramEvent.BOOKMARK_CHANGED, addr, bm, null, null);
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -211,7 +211,7 @@ public class BookmarkDBManager implements BookmarkManager, ErrorHandler, Manager
|
|||
bookmarkAdapter.addType(bmt.getTypeId());
|
||||
|
||||
// fire event
|
||||
program.setObjChanged(ChangeManager.DOCR_BOOKMARK_TYPE_ADDED, bmt, null, null);
|
||||
program.setObjChanged(ProgramEvent.BOOKMARK_TYPE_ADDED, bmt, null, null);
|
||||
|
||||
}
|
||||
return bmt;
|
||||
|
@ -301,7 +301,7 @@ public class BookmarkDBManager implements BookmarkManager, ErrorHandler, Manager
|
|||
bm = new BookmarkDB(this, cache, rec);
|
||||
|
||||
// fire event
|
||||
program.setObjChanged(ChangeManager.DOCR_BOOKMARK_ADDED, addr, bm, null, null);
|
||||
program.setObjChanged(ProgramEvent.BOOKMARK_ADDED, addr, bm, null, null);
|
||||
}
|
||||
return bm;
|
||||
}
|
||||
|
@ -375,7 +375,7 @@ public class BookmarkDBManager implements BookmarkManager, ErrorHandler, Manager
|
|||
try {
|
||||
bookmarkAdapter.deleteRecord(bm.getId());
|
||||
// fire event
|
||||
program.setObjChanged(ChangeManager.DOCR_BOOKMARK_REMOVED, addr, bm, null, null);
|
||||
program.setObjChanged(ProgramEvent.BOOKMARK_REMOVED, addr, bm, null, null);
|
||||
}
|
||||
catch (IOException e) {
|
||||
dbError(e);
|
||||
|
@ -395,8 +395,7 @@ public class BookmarkDBManager implements BookmarkManager, ErrorHandler, Manager
|
|||
bookmarkAdapter.deleteType(typeId);
|
||||
bookmarkTypeAdapter.deleteRecord(typeId);
|
||||
bmt.setHasBookmarks(false);
|
||||
program.setObjChanged(ChangeManager.DOCR_BOOKMARK_TYPE_REMOVED, bmt, null,
|
||||
null);
|
||||
program.setObjChanged(ProgramEvent.BOOKMARK_TYPE_REMOVED, bmt, null, null);
|
||||
}
|
||||
}
|
||||
catch (IOException e) {
|
||||
|
|
|
@ -36,7 +36,8 @@ import ghidra.program.model.listing.*;
|
|||
import ghidra.program.model.mem.*;
|
||||
import ghidra.program.model.symbol.*;
|
||||
import ghidra.program.model.util.*;
|
||||
import ghidra.program.util.ChangeManager;
|
||||
import ghidra.program.util.CommentChangeRecord;
|
||||
import ghidra.program.util.ProgramEvent;
|
||||
import ghidra.util.*;
|
||||
import ghidra.util.exception.*;
|
||||
import ghidra.util.task.TaskMonitor;
|
||||
|
@ -570,8 +571,8 @@ public class CodeManager implements ErrorHandler, ManagerDB {
|
|||
}
|
||||
}
|
||||
set.addRange(block.getStartAddress(), maxAddr);
|
||||
program.setChanged(ChangeManager.DOCR_CODE_ADDED, block.getStartAddress(),
|
||||
maxAddr, null, null);
|
||||
program.setChanged(ProgramEvent.CODE_ADDED, block.getStartAddress(), maxAddr,
|
||||
null, null);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -626,7 +627,7 @@ public class CodeManager implements ErrorHandler, ManagerDB {
|
|||
}
|
||||
|
||||
// fire event
|
||||
program.setChanged(ChangeManager.DOCR_CODE_ADDED, address, endAddr, null, inst);
|
||||
program.setChanged(ProgramEvent.CODE_ADDED, address, endAddr, null, inst);
|
||||
|
||||
return inst;
|
||||
}
|
||||
|
@ -2047,11 +2048,11 @@ public class CodeManager implements ErrorHandler, ManagerDB {
|
|||
if (dataType instanceof Composite || dataType instanceof Array ||
|
||||
dataType instanceof Dynamic) {
|
||||
compositeMgr.add(addr);
|
||||
program.setChanged(ChangeManager.DOCR_COMPOSITE_ADDED, addr, endAddr, null, null);
|
||||
program.setChanged(ProgramEvent.COMPOSITE_ADDED, addr, endAddr, null, null);
|
||||
}
|
||||
|
||||
// fire event
|
||||
program.setChanged(ChangeManager.DOCR_CODE_ADDED, addr, endAddr, null, data);
|
||||
program.setChanged(ProgramEvent.CODE_ADDED, addr, endAddr, null, data);
|
||||
|
||||
addDataReferences(data, new ArrayList<Address>());
|
||||
|
||||
|
@ -2212,7 +2213,7 @@ public class CodeManager implements ErrorHandler, ManagerDB {
|
|||
boolean commentRemoved = commentAdapter.deleteRecords(start, end);
|
||||
if (commentRemoved) {
|
||||
// fire event
|
||||
program.setChanged(ChangeManager.DOCR_CODE_REMOVED, start, end, null, null);
|
||||
program.setChanged(ProgramEvent.CODE_REMOVED, start, end, null, null);
|
||||
}
|
||||
}
|
||||
catch (IOException e) {
|
||||
|
@ -2322,7 +2323,7 @@ public class CodeManager implements ErrorHandler, ManagerDB {
|
|||
}
|
||||
}
|
||||
|
||||
program.setChanged(ChangeManager.DOCR_CODE_REMOVED, start, end, cu, null);
|
||||
program.setChanged(ProgramEvent.CODE_REMOVED, start, end, cu, null);
|
||||
}
|
||||
finally {
|
||||
lock.release();
|
||||
|
@ -3319,28 +3320,8 @@ public class CodeManager implements ErrorHandler, ManagerDB {
|
|||
}
|
||||
|
||||
void sendNotification(Address address, int commentType, String oldValue, String newValue) {
|
||||
int eventType;
|
||||
switch (commentType) {
|
||||
case CodeUnit.PLATE_COMMENT:
|
||||
eventType = ChangeManager.DOCR_PLATE_COMMENT_CHANGED;
|
||||
break;
|
||||
case CodeUnit.PRE_COMMENT:
|
||||
eventType = ChangeManager.DOCR_PRE_COMMENT_CHANGED;
|
||||
break;
|
||||
case CodeUnit.POST_COMMENT:
|
||||
eventType = ChangeManager.DOCR_POST_COMMENT_CHANGED;
|
||||
break;
|
||||
case CodeUnit.REPEATABLE_COMMENT:
|
||||
eventType = ChangeManager.DOCR_REPEATABLE_COMMENT_CHANGED;
|
||||
break;
|
||||
case CodeUnit.EOL_COMMENT:
|
||||
default:
|
||||
eventType = ChangeManager.DOCR_EOL_COMMENT_CHANGED;
|
||||
}
|
||||
createCommentHistoryRecord(address, commentType, oldValue, newValue);
|
||||
|
||||
program.setChanged(eventType, address, address, oldValue, newValue);
|
||||
|
||||
program.setChanged(new CommentChangeRecord(commentType, address, oldValue, newValue));
|
||||
}
|
||||
|
||||
void createCommentHistoryRecord(Address address, int commentType, String oldComment,
|
||||
|
@ -3464,7 +3445,7 @@ public class CodeManager implements ErrorHandler, ManagerDB {
|
|||
rec.setLongValue(DataDBAdapter.DATA_TYPE_ID_COL, newDataTypeID);
|
||||
dataAdapter.putRecord(rec);
|
||||
Address addr = addrMap.decodeAddress(rec.getKey());
|
||||
program.setChanged(ChangeManager.DOCR_CODE_REPLACED, addr, addr, null, null);
|
||||
program.setChanged(ProgramEvent.CODE_REPLACED, addr, addr, null, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -29,7 +29,7 @@ import ghidra.program.model.pcode.PcodeOp;
|
|||
import ghidra.program.model.scalar.Scalar;
|
||||
import ghidra.program.model.symbol.*;
|
||||
import ghidra.program.model.util.CodeUnitInsertionException;
|
||||
import ghidra.program.util.ChangeManager;
|
||||
import ghidra.program.util.ProgramEvent;
|
||||
import ghidra.util.Msg;
|
||||
import ghidra.util.exception.NoValueException;
|
||||
|
||||
|
@ -233,10 +233,9 @@ public class InstructionDB extends CodeUnitDB implements Instruction, Instructio
|
|||
// Continue walking instructions backwards if a delay-slot instruction is found and
|
||||
// either the delay slot instruction does not fallthrough or it does not have a
|
||||
// ref or label on it.
|
||||
while (instr != null && instr.isInDelaySlot() &&
|
||||
(!instr.hasFallthrough() ||
|
||||
!program.getSymbolTable().hasSymbol(instr.getMinAddress())));
|
||||
|
||||
while (instr != null && instr.isInDelaySlot() && (!instr.hasFallthrough() ||
|
||||
!program.getSymbolTable().hasSymbol(instr.getMinAddress())));
|
||||
|
||||
if (instr == null) {
|
||||
return null;
|
||||
}
|
||||
|
@ -643,7 +642,7 @@ public class InstructionDB extends CodeUnitDB implements Instruction, Instructio
|
|||
finally {
|
||||
lock.release();
|
||||
}
|
||||
program.setChanged(ChangeManager.DOCR_FLOWOVERRIDE_CHANGED, address, address, null, null);
|
||||
program.setChanged(ProgramEvent.FLOW_OVERRIDE_CHANGED, address, address, null, null);
|
||||
}
|
||||
|
||||
private boolean isSameFlowType(FlowType origFlowType, RefType referenceType) {
|
||||
|
@ -750,8 +749,7 @@ public class InstructionDB extends CodeUnitDB implements Instruction, Instructio
|
|||
flags &= FALLTHROUGH_CLEAR_MASK;
|
||||
}
|
||||
codeMgr.setFlags(addr, flags);
|
||||
program.setChanged(ChangeManager.DOCR_FALLTHROUGH_CHANGED, address, address, null,
|
||||
null);
|
||||
program.setChanged(ProgramEvent.FALLTHROUGH_CHANGED, address, address, null, null);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -806,8 +804,8 @@ public class InstructionDB extends CodeUnitDB implements Instruction, Instructio
|
|||
try {
|
||||
checkDeleted();
|
||||
if (doSetLengthOverride(len)) {
|
||||
program.setChanged(ChangeManager.DOCR_LENGTH_OVERRIDE_CHANGED, address, address,
|
||||
null, null);
|
||||
program.setChanged(ProgramEvent.LENGTH_OVERRIDE_CHANGED, address, address, null,
|
||||
null);
|
||||
}
|
||||
}
|
||||
finally {
|
||||
|
|
|
@ -29,7 +29,7 @@ import ghidra.program.database.map.AddressMap;
|
|||
import ghidra.program.model.address.Address;
|
||||
import ghidra.program.model.data.*;
|
||||
import ghidra.program.model.listing.Program;
|
||||
import ghidra.program.util.ChangeManager;
|
||||
import ghidra.program.util.ProgramEvent;
|
||||
import ghidra.util.*;
|
||||
import ghidra.util.exception.*;
|
||||
import ghidra.util.task.TaskMonitor;
|
||||
|
@ -37,8 +37,7 @@ import ghidra.util.task.TaskMonitor;
|
|||
/**
|
||||
* Class for managing data types in a program
|
||||
*/
|
||||
public class ProgramDataTypeManager extends ProgramBasedDataTypeManagerDB
|
||||
implements ManagerDB {
|
||||
public class ProgramDataTypeManager extends ProgramBasedDataTypeManagerDB implements ManagerDB {
|
||||
|
||||
private static final String OLD_DT_ARCHIVE_FILENAMES = "DataTypeArchiveFilenames"; // eliminated with Ghidra 4.3
|
||||
|
||||
|
@ -77,8 +76,7 @@ public class ProgramDataTypeManager extends ProgramBasedDataTypeManagerDB
|
|||
|
||||
@Override
|
||||
protected void dataSettingChanged(Address dataAddr) {
|
||||
program.setChanged(ChangeManager.DOCR_DATA_TYPE_SETTING_CHANGED, dataAddr,
|
||||
dataAddr, null, null);
|
||||
program.setChanged(ProgramEvent.DATA_TYPE_SETTING_CHANGED, dataAddr, dataAddr, null, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -139,7 +137,7 @@ public class ProgramDataTypeManager extends ProgramBasedDataTypeManagerDB
|
|||
setProgramArchitecture(program, program.getSymbolTable().getVariableStorageManager(), true,
|
||||
monitor);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return program.getName();
|
||||
|
@ -159,83 +157,82 @@ public class ProgramDataTypeManager extends ProgramBasedDataTypeManagerDB
|
|||
@Override
|
||||
public void sourceArchiveChanged(UniversalID sourceArchiveID) {
|
||||
super.sourceArchiveChanged(sourceArchiveID);
|
||||
program.sourceArchiveChanged(sourceArchiveID, ChangeManager.DOCR_SOURCE_ARCHIVE_CHANGED);
|
||||
program.sourceArchiveChanged(sourceArchiveID, ProgramEvent.SOURCE_ARCHIVE_CHANGED);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void sourceArchiveAdded(UniversalID sourceArchiveID) {
|
||||
super.sourceArchiveAdded(sourceArchiveID);
|
||||
program.sourceArchiveAdded(sourceArchiveID, ChangeManager.DOCR_SOURCE_ARCHIVE_ADDED);
|
||||
program.sourceArchiveAdded(sourceArchiveID, ProgramEvent.SOURCE_ARCHIVE_ADDED);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dataTypeChanged(DataType dt, boolean isAutoChange) {
|
||||
super.dataTypeChanged(dt, isAutoChange);
|
||||
if (!isCreatingDataType()) {
|
||||
program.dataTypeChanged(getID(dt), ChangeManager.DOCR_DATA_TYPE_CHANGED,
|
||||
isAutoChange, null, dt);
|
||||
program.dataTypeChanged(getID(dt), ProgramEvent.DATA_TYPE_CHANGED, isAutoChange, null,
|
||||
dt);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void dataTypeAdded(DataType newDt, DataType originalDataType) {
|
||||
super.dataTypeAdded(newDt, originalDataType);
|
||||
program.dataTypeAdded(getID(newDt), ChangeManager.DOCR_DATA_TYPE_ADDED, null, newDt);
|
||||
program.dataTypeAdded(getID(newDt), ProgramEvent.DATA_TYPE_ADDED, null, newDt);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void dataTypeReplaced(long existingDtID, DataTypePath existingPath,
|
||||
DataType replacementDt) {
|
||||
super.dataTypeReplaced(existingDtID, existingPath, replacementDt);
|
||||
program.dataTypeChanged(existingDtID, ChangeManager.DOCR_DATA_TYPE_REPLACED, true,
|
||||
existingPath,
|
||||
program.dataTypeChanged(existingDtID, ProgramEvent.DATA_TYPE_REPLACED, true, existingPath,
|
||||
replacementDt);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void dataTypeDeleted(long deletedID, DataTypePath deletedDataTypePath) {
|
||||
super.dataTypeDeleted(deletedID, deletedDataTypePath);
|
||||
program.dataTypeChanged(deletedID, ChangeManager.DOCR_DATA_TYPE_REMOVED,
|
||||
false, deletedDataTypePath, null);
|
||||
program.dataTypeChanged(deletedID, ProgramEvent.DATA_TYPE_REMOVED, false,
|
||||
deletedDataTypePath, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void dataTypeMoved(DataType dt, DataTypePath oldPath, DataTypePath newPath) {
|
||||
super.dataTypeMoved(dt, oldPath, newPath);
|
||||
Category category = getCategory(oldPath.getCategoryPath());
|
||||
program.dataTypeChanged(getID(dt), ChangeManager.DOCR_DATA_TYPE_MOVED, false, category, dt);
|
||||
program.dataTypeChanged(getID(dt), ProgramEvent.DATA_TYPE_MOVED, false, category, dt);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void dataTypeNameChanged(DataType dt, String oldName) {
|
||||
super.dataTypeNameChanged(dt, oldName);
|
||||
program.dataTypeChanged(getID(dt), ChangeManager.DOCR_DATA_TYPE_RENAMED, false, oldName, dt);
|
||||
program.dataTypeChanged(getID(dt), ProgramEvent.DATA_TYPE_RENAMED, false, oldName, dt);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void categoryCreated(Category newCategory) {
|
||||
super.categoryCreated(newCategory);
|
||||
program.categoryAdded(newCategory.getID(), ChangeManager.DOCR_CATEGORY_ADDED,
|
||||
program.categoryAdded(newCategory.getID(), ProgramEvent.DATA_TYPE_CATEGORY_ADDED,
|
||||
newCategory.getParent(), newCategory);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void categoryRenamed(CategoryPath oldPath, Category category) {
|
||||
super.categoryRenamed(oldPath, category);
|
||||
program.categoryChanged(category.getID(), ChangeManager.DOCR_CATEGORY_RENAMED,
|
||||
program.categoryChanged(category.getID(), ProgramEvent.DATA_TYPE_CATEGORY_RENAMED,
|
||||
oldPath.getName(), category);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void categoryRemoved(Category parent, String name, long categoryID) {
|
||||
super.categoryRemoved(parent, name, categoryID);
|
||||
program.categoryChanged(categoryID, ChangeManager.DOCR_CATEGORY_REMOVED, parent, name);
|
||||
program.categoryChanged(categoryID, ProgramEvent.DATA_TYPE_CATEGORY_REMOVED, parent, name);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void categoryMoved(CategoryPath oldPath, Category category) {
|
||||
super.categoryMoved(oldPath, category);
|
||||
program.categoryChanged(category.getID(), ChangeManager.DOCR_CATEGORY_MOVED,
|
||||
program.categoryChanged(category.getID(), ProgramEvent.DATA_TYPE_CATEGORY_MOVED,
|
||||
oldPath.getParent(), category);
|
||||
}
|
||||
|
||||
|
|
|
@ -15,6 +15,8 @@
|
|||
*/
|
||||
package ghidra.program.database.function;
|
||||
|
||||
import static ghidra.program.util.FunctionChangeRecord.FunctionChangeType.*;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.*;
|
||||
|
||||
|
@ -30,7 +32,7 @@ import ghidra.program.model.lang.*;
|
|||
import ghidra.program.model.listing.*;
|
||||
import ghidra.program.model.symbol.*;
|
||||
import ghidra.program.model.util.StringPropertyMap;
|
||||
import ghidra.program.util.ChangeManager;
|
||||
import ghidra.program.util.ProgramEvent;
|
||||
import ghidra.util.*;
|
||||
import ghidra.util.exception.*;
|
||||
import ghidra.util.task.TaskMonitor;
|
||||
|
@ -666,7 +668,7 @@ public class FunctionDB extends DatabaseObject implements Function {
|
|||
try {
|
||||
rec.setIntValue(FunctionAdapter.STACK_PURGE_COL, change);
|
||||
manager.getFunctionAdapter().updateFunctionRecord(rec);
|
||||
manager.functionChanged(this, ChangeManager.FUNCTION_CHANGED_PURGE);
|
||||
manager.functionChanged(this, PURGE_CHANGED);
|
||||
}
|
||||
catch (IOException e) {
|
||||
manager.dbError(e);
|
||||
|
@ -815,8 +817,8 @@ public class FunctionDB extends DatabaseObject implements Function {
|
|||
|
||||
dataTypes[0] = returnParam.getFormalDataType();
|
||||
returnParam.setDynamicStorage(
|
||||
VoidDataType.isVoidDataType(dataTypes[0]) ? VariableStorage.VOID_STORAGE
|
||||
: VariableStorage.UNASSIGNED_STORAGE);
|
||||
VoidDataType.isVoidDataType(dataTypes[0]) ? VariableStorage.VOID_STORAGE
|
||||
: VariableStorage.UNASSIGNED_STORAGE);
|
||||
|
||||
PrototypeModel callingConvention = getCallingConvention();
|
||||
if (callingConvention == null) {
|
||||
|
@ -995,7 +997,7 @@ public class FunctionDB extends DatabaseObject implements Function {
|
|||
if (var.getComment() != null) {
|
||||
v.symbol.setSymbolStringData(var.getComment());
|
||||
}
|
||||
manager.functionChanged(this, 0);
|
||||
manager.functionChanged(this, null);
|
||||
return v;
|
||||
}
|
||||
finally {
|
||||
|
@ -1300,7 +1302,6 @@ public class FunctionDB extends DatabaseObject implements Function {
|
|||
source);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Increment updateInProgressCount indicating that an update operation is in progress and
|
||||
* that any attempted refresh should be deferred. The updateRefreshReqd flag will be set
|
||||
|
@ -1479,7 +1480,7 @@ public class FunctionDB extends DatabaseObject implements Function {
|
|||
// assign dynamic storage
|
||||
updateParametersAndReturn();
|
||||
|
||||
manager.functionChanged(this, ChangeManager.FUNCTION_CHANGED_PARAMETERS);
|
||||
manager.functionChanged(this, PARAMETERS_CHANGED);
|
||||
}
|
||||
finally {
|
||||
frame.setInvalid();
|
||||
|
@ -1653,7 +1654,7 @@ public class FunctionDB extends DatabaseObject implements Function {
|
|||
|
||||
params.add(ordinal, p);
|
||||
updateParametersAndReturn();
|
||||
manager.functionChanged(this, ChangeManager.FUNCTION_CHANGED_PARAMETERS);
|
||||
manager.functionChanged(this, PARAMETERS_CHANGED);
|
||||
}
|
||||
if (!DEFAULT_PARAM_PREFIX.equals(name)) {
|
||||
p.setName(name, paramSource);
|
||||
|
@ -1683,7 +1684,7 @@ public class FunctionDB extends DatabaseObject implements Function {
|
|||
params.add(ordinal, p);
|
||||
updateParametersAndReturn();
|
||||
symbolMap.put(p.symbol, p);
|
||||
manager.functionChanged(this, ChangeManager.FUNCTION_CHANGED_PARAMETERS);
|
||||
manager.functionChanged(this, PARAMETERS_CHANGED);
|
||||
}
|
||||
if (var.getComment() != null) {
|
||||
p.symbol.setSymbolStringData(var.getComment());
|
||||
|
@ -1830,8 +1831,7 @@ public class FunctionDB extends DatabaseObject implements Function {
|
|||
}
|
||||
}
|
||||
|
||||
manager.functionChanged(this,
|
||||
(var instanceof Parameter) ? ChangeManager.FUNCTION_CHANGED_PARAMETERS : 0);
|
||||
manager.functionChanged(this, (var instanceof Parameter) ? PARAMETERS_CHANGED : null);
|
||||
frame.setInvalid();
|
||||
}
|
||||
finally {
|
||||
|
@ -1954,7 +1954,7 @@ public class FunctionDB extends DatabaseObject implements Function {
|
|||
params.add(toOrdinal, param);
|
||||
}
|
||||
updateParametersAndReturn();
|
||||
manager.functionChanged(this, ChangeManager.FUNCTION_CHANGED_PARAMETERS);
|
||||
manager.functionChanged(this, PARAMETERS_CHANGED);
|
||||
return param;
|
||||
}
|
||||
finally {
|
||||
|
@ -1996,7 +1996,7 @@ public class FunctionDB extends DatabaseObject implements Function {
|
|||
rec.setIntValue(FunctionAdapter.STACK_LOCAL_SIZE_COL, size);
|
||||
try {
|
||||
manager.getFunctionAdapter().updateFunctionRecord(rec);
|
||||
manager.functionChanged(this, 0);
|
||||
manager.functionChanged(this, null);
|
||||
}
|
||||
catch (IOException e) {
|
||||
manager.dbError(e);
|
||||
|
@ -2050,7 +2050,7 @@ public class FunctionDB extends DatabaseObject implements Function {
|
|||
rec.setIntValue(FunctionAdapter.STACK_RETURN_OFFSET_COL, offset);
|
||||
try {
|
||||
manager.getFunctionAdapter().updateFunctionRecord(rec);
|
||||
manager.functionChanged(this, 0);
|
||||
manager.functionChanged(this, null);
|
||||
}
|
||||
catch (IOException e) {
|
||||
manager.dbError(e);
|
||||
|
@ -2132,7 +2132,7 @@ public class FunctionDB extends DatabaseObject implements Function {
|
|||
}
|
||||
else if (hasVarArgs != hasVarArgs()) {
|
||||
setFunctionFlag(FunctionAdapter.FUNCTION_VARARG_FLAG, hasVarArgs);
|
||||
manager.functionChanged(this, ChangeManager.FUNCTION_CHANGED_PARAMETERS);
|
||||
manager.functionChanged(this, PARAMETERS_CHANGED);
|
||||
}
|
||||
}
|
||||
finally {
|
||||
|
@ -2158,7 +2158,7 @@ public class FunctionDB extends DatabaseObject implements Function {
|
|||
else if (!isExternal() && isInline != isInline()) {
|
||||
// only non-external functions may be inline
|
||||
setFunctionFlag(FunctionAdapter.FUNCTION_INLINE_FLAG, isInline);
|
||||
manager.functionChanged(this, ChangeManager.FUNCTION_CHANGED_INLINE);
|
||||
manager.functionChanged(this, INLINE_CHANGED);
|
||||
}
|
||||
}
|
||||
finally {
|
||||
|
@ -2183,7 +2183,7 @@ public class FunctionDB extends DatabaseObject implements Function {
|
|||
}
|
||||
else if (hasNoReturn != hasNoReturn()) {
|
||||
setFunctionFlag(FunctionAdapter.FUNCTION_NO_RETURN_FLAG, hasNoReturn);
|
||||
manager.functionChanged(this, ChangeManager.FUNCTION_CHANGED_NORETURN);
|
||||
manager.functionChanged(this, NO_RETURN_CHANGED);
|
||||
}
|
||||
}
|
||||
finally {
|
||||
|
@ -2379,7 +2379,7 @@ public class FunctionDB extends DatabaseObject implements Function {
|
|||
updateParametersAndReturn(); // assign dynamic storage
|
||||
}
|
||||
|
||||
manager.functionChanged(this, ChangeManager.FUNCTION_CHANGED_PARAMETERS);
|
||||
manager.functionChanged(this, PARAMETERS_CHANGED);
|
||||
}
|
||||
catch (InvalidInputException e) {
|
||||
throw new AssertException(e); // should not occur
|
||||
|
@ -2496,7 +2496,7 @@ public class FunctionDB extends DatabaseObject implements Function {
|
|||
rec.setByteValue(FunctionAdapter.FUNCTION_FLAGS_COL, flags);
|
||||
try {
|
||||
manager.getFunctionAdapter().updateFunctionRecord(rec);
|
||||
manager.functionChanged(this, 0);
|
||||
manager.functionChanged(this, null);
|
||||
}
|
||||
catch (IOException e) {
|
||||
manager.dbError(e);
|
||||
|
@ -2597,11 +2597,11 @@ public class FunctionDB extends DatabaseObject implements Function {
|
|||
loadVariables();
|
||||
removeExplicitThisParameter();
|
||||
updateParametersAndReturn(); // assign dynamic storage
|
||||
manager.functionChanged(this, ChangeManager.FUNCTION_CHANGED_PARAMETERS);
|
||||
manager.functionChanged(this, ChangeManager.FUNCTION_CHANGED_RETURN);
|
||||
manager.functionChanged(this, PARAMETERS_CHANGED);
|
||||
manager.functionChanged(this, RETURN_TYPE_CHANGED);
|
||||
}
|
||||
else {
|
||||
manager.functionChanged(this, 0); // change did not affect parameters
|
||||
manager.functionChanged(this, null); // change did not affect parameters
|
||||
}
|
||||
}
|
||||
catch (IOException e) {
|
||||
|
@ -2640,8 +2640,7 @@ public class FunctionDB extends DatabaseObject implements Function {
|
|||
}
|
||||
|
||||
void dataTypeChanged(VariableDB var) {
|
||||
manager.functionChanged(this,
|
||||
(var instanceof Parameter) ? ChangeManager.FUNCTION_CHANGED_PARAMETERS : 0);
|
||||
manager.functionChanged(this, (var instanceof Parameter) ? PARAMETERS_CHANGED : null);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -2691,7 +2690,7 @@ public class FunctionDB extends DatabaseObject implements Function {
|
|||
}
|
||||
callFixupMap.add(entryPoint, name);
|
||||
}
|
||||
manager.functionChanged(this, ChangeManager.FUNCTION_CHANGED_CALL_FIXUP);
|
||||
manager.functionChanged(this, CALL_FIXUP_CHANGED);
|
||||
}
|
||||
finally {
|
||||
endUpdate();
|
||||
|
@ -2803,7 +2802,7 @@ public class FunctionDB extends DatabaseObject implements Function {
|
|||
tagManager.applyFunctionTag(getID(), tag.getId());
|
||||
|
||||
Address addr = getEntryPoint();
|
||||
program.setChanged(ChangeManager.DOCR_TAG_ADDED_TO_FUNCTION, addr, addr, tag, tag);
|
||||
program.setChanged(ProgramEvent.FUNCTION_TAG_APPLIED, addr, addr, tag, tag);
|
||||
}
|
||||
|
||||
// Add to local cache
|
||||
|
@ -2836,8 +2835,7 @@ public class FunctionDB extends DatabaseObject implements Function {
|
|||
|
||||
if (removed) {
|
||||
Address addr = getEntryPoint();
|
||||
program.setChanged(ChangeManager.DOCR_TAG_REMOVED_FROM_FUNCTION, addr, addr, tag,
|
||||
tag);
|
||||
program.setChanged(ProgramEvent.FUNCTION_TAG_UNAPPLIED, addr, addr, tag, tag);
|
||||
|
||||
// Remove from the local cache.
|
||||
if (tags != null) {
|
||||
|
|
|
@ -15,6 +15,8 @@
|
|||
*/
|
||||
package ghidra.program.database.function;
|
||||
|
||||
import static ghidra.program.util.FunctionChangeRecord.FunctionChangeType.*;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.*;
|
||||
import java.util.function.Predicate;
|
||||
|
@ -38,8 +40,8 @@ import ghidra.program.model.pcode.HighFunction;
|
|||
import ghidra.program.model.symbol.*;
|
||||
import ghidra.program.model.util.PropertyMapManager;
|
||||
import ghidra.program.model.util.StringPropertyMap;
|
||||
import ghidra.program.util.ChangeManager;
|
||||
import ghidra.program.util.LanguageTranslator;
|
||||
import ghidra.program.util.*;
|
||||
import ghidra.program.util.FunctionChangeRecord.FunctionChangeType;
|
||||
import ghidra.util.Lock;
|
||||
import ghidra.util.Msg;
|
||||
import ghidra.util.exception.*;
|
||||
|
@ -166,8 +168,7 @@ public class FunctionManagerDB implements FunctionManager {
|
|||
* @throws InvalidInputException if the name is invalid
|
||||
*/
|
||||
public Function createExternalFunction(Address extSpaceAddr, String name, Namespace nameSpace,
|
||||
String extData, SourceType source)
|
||||
throws InvalidInputException {
|
||||
String extData, SourceType source) throws InvalidInputException {
|
||||
lock.acquire();
|
||||
try {
|
||||
Symbol symbol =
|
||||
|
@ -180,7 +181,7 @@ public class FunctionManagerDB implements FunctionManager {
|
|||
|
||||
FunctionDB funcDB = new FunctionDB(this, cache, addrMap, rec);
|
||||
|
||||
program.setObjChanged(ChangeManager.DOCR_FUNCTION_ADDED, extSpaceAddr, funcDB, null,
|
||||
program.setObjChanged(ProgramEvent.FUNCTION_ADDED, extSpaceAddr, funcDB, null,
|
||||
null);
|
||||
return funcDB;
|
||||
}
|
||||
|
@ -222,7 +223,7 @@ public class FunctionManagerDB implements FunctionManager {
|
|||
static void checkSingleAddressSpaceOnly(AddressSetView set) {
|
||||
if (set.getMinAddress().getAddressSpace() != set.getMaxAddress().getAddressSpace()) {
|
||||
throw new IllegalArgumentException(
|
||||
"Function body must contain single address space only");
|
||||
"Function body must contain single address space only");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -292,8 +293,8 @@ public class FunctionManagerDB implements FunctionManager {
|
|||
thunkAdapter.createThunkRecord(symbol.getID(), refFunc.getID());
|
||||
|
||||
// Default thunk function name changes dynamically as a result of becoming a thunk
|
||||
program.symbolChanged(symbol, ChangeManager.DOCR_SYMBOL_RENAMED, entryPoint,
|
||||
symbol, oldName, symbol.getName());
|
||||
program.symbolChanged(symbol, ProgramEvent.SYMBOL_RENAMED, entryPoint, symbol,
|
||||
oldName, symbol.getName());
|
||||
}
|
||||
|
||||
DBRecord rec = adapter.createFunctionRecord(symbol.getID(), returnDataTypeId);
|
||||
|
@ -301,8 +302,7 @@ public class FunctionManagerDB implements FunctionManager {
|
|||
FunctionDB funcDB = new FunctionDB(this, cache, addrMap, rec);
|
||||
namespaceMgr.setBody(funcDB, body);
|
||||
|
||||
program.setObjChanged(ChangeManager.DOCR_FUNCTION_ADDED, entryPoint, funcDB, null,
|
||||
null);
|
||||
program.setObjChanged(ProgramEvent.FUNCTION_ADDED, entryPoint, funcDB, null, null);
|
||||
return funcDB;
|
||||
}
|
||||
catch (IOException e) {
|
||||
|
@ -357,14 +357,11 @@ public class FunctionManagerDB implements FunctionManager {
|
|||
|
||||
// Default thunk function name changes dynamically as a result of becoming a thunk
|
||||
if (s.getSource() == SourceType.DEFAULT) {
|
||||
program.symbolChanged(s, ChangeManager.DOCR_SYMBOL_RENAMED,
|
||||
function.getEntryPoint(), s, oldName, s.getName());
|
||||
program.symbolChanged(s, ProgramEvent.SYMBOL_RENAMED, function.getEntryPoint(),
|
||||
s, oldName, s.getName());
|
||||
}
|
||||
}
|
||||
|
||||
program.setObjChanged(ChangeManager.DOCR_FUNCTION_CHANGED,
|
||||
ChangeManager.FUNCTION_CHANGED_THUNK, function.getEntryPoint(), function, null,
|
||||
null);
|
||||
program.setChanged(new FunctionChangeRecord(function, THUNK_CHANGED));
|
||||
}
|
||||
catch (IOException e) {
|
||||
dbError(e);
|
||||
|
@ -453,8 +450,7 @@ public class FunctionManagerDB implements FunctionManager {
|
|||
adapter.removeFunctionRecord(functionID);
|
||||
cache.delete(functionID);
|
||||
|
||||
program.setObjChanged(ChangeManager.DOCR_FUNCTION_REMOVED, entryPoint, function, body,
|
||||
null);
|
||||
program.setObjChanged(ProgramEvent.FUNCTION_REMOVED, entryPoint, function, body, null);
|
||||
return true;
|
||||
}
|
||||
catch (IOException e) {
|
||||
|
@ -856,17 +852,15 @@ public class FunctionManagerDB implements FunctionManager {
|
|||
return callFixupMap;
|
||||
}
|
||||
|
||||
void functionChanged(FunctionDB func, int subEventType) {
|
||||
program.setObjChanged(ChangeManager.DOCR_FUNCTION_CHANGED, subEventType,
|
||||
func.getEntryPoint(), func, null, null);
|
||||
void functionChanged(FunctionDB func, FunctionChangeType changeType) {
|
||||
program.setChanged(new FunctionChangeRecord(func, changeType));
|
||||
|
||||
List<Long> thunkFunctionIds = getThunkFunctionIds(func.getKey());
|
||||
if (thunkFunctionIds != null) {
|
||||
for (long key : thunkFunctionIds) {
|
||||
Function thunk = getFunction(key);
|
||||
if (thunk != null) {
|
||||
program.setObjChanged(ChangeManager.DOCR_FUNCTION_CHANGED, subEventType,
|
||||
thunk.getEntryPoint(), thunk, null, null);
|
||||
program.setChanged(new FunctionChangeRecord(thunk, changeType));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1017,7 +1011,7 @@ public class FunctionManagerDB implements FunctionManager {
|
|||
// TODO: DON'T THINK THIS SHOULD BE DONE ANYMORE!
|
||||
// function.setStackPurgeSize(Function.UNKNOWN_STACK_DEPTH_CHANGE);
|
||||
|
||||
program.setObjChanged(ChangeManager.DOCR_FUNCTION_BODY_CHANGED, function.getEntryPoint(),
|
||||
program.setObjChanged(ProgramEvent.FUNCTION_BODY_CHANGED, function.getEntryPoint(),
|
||||
function, null, null);
|
||||
}
|
||||
|
||||
|
@ -1226,7 +1220,7 @@ public class FunctionManagerDB implements FunctionManager {
|
|||
if (functionDB == null) {
|
||||
functionDB = new FunctionDB(this, cache, addrMap, rec);
|
||||
}
|
||||
functionChanged(functionDB, ChangeManager.FUNCTION_CHANGED_RETURN);
|
||||
functionChanged(functionDB, RETURN_TYPE_CHANGED);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,6 +26,7 @@ import ghidra.program.database.DBObjectCache;
|
|||
import ghidra.program.database.ProgramDB;
|
||||
import ghidra.program.model.listing.*;
|
||||
import ghidra.program.util.ChangeManager;
|
||||
import ghidra.program.util.ProgramEvent;
|
||||
import ghidra.util.Lock;
|
||||
import ghidra.util.datastruct.Counter;
|
||||
import ghidra.util.exception.CancelledException;
|
||||
|
@ -162,7 +163,7 @@ public class FunctionTagManagerDB implements FunctionTagManager, ErrorHandler {
|
|||
|
||||
DBRecord record = functionTagAdapter.createTagRecord(name, comment);
|
||||
tag = getFunctionTagFromCache(record);
|
||||
fireTagCreatedNotification(ChangeManager.DOCR_FUNCTION_TAG_CREATED, tag);
|
||||
fireTagCreatedNotification(ProgramEvent.FUNCTION_TAG_CREATED, tag);
|
||||
|
||||
return tag;
|
||||
}
|
||||
|
@ -254,8 +255,7 @@ public class FunctionTagManagerDB implements FunctionTagManager, ErrorHandler {
|
|||
functionTagAdapter.updateRecord(tag.getRecord());
|
||||
|
||||
// Notify subscribers of the change.
|
||||
fireTagChangedNotification(ChangeManager.DOCR_FUNCTION_TAG_CHANGED, tag, oldValue,
|
||||
newValue);
|
||||
fireTagChangedNotification(ProgramEvent.FUNCTION_TAG_CHANGED, tag, oldValue, newValue);
|
||||
invalidateFunctions();
|
||||
}
|
||||
|
||||
|
@ -299,29 +299,29 @@ public class FunctionTagManagerDB implements FunctionTagManager, ErrorHandler {
|
|||
* @param oldValue the old value
|
||||
* @param newValue the new value
|
||||
*/
|
||||
private void fireTagChangedNotification(int type, FunctionTag tag, String oldValue,
|
||||
String newValue) {
|
||||
program.tagChanged(tag, type, oldValue, newValue);
|
||||
private void fireTagChangedNotification(ProgramEvent eventType, FunctionTag tag,
|
||||
String oldValue, String newValue) {
|
||||
program.tagChanged(tag, eventType, oldValue, newValue);
|
||||
}
|
||||
|
||||
/**
|
||||
* Fires off a notification indicating that a new tag has been created.
|
||||
*
|
||||
* @param type {@link ChangeManager} change type
|
||||
* @param eventType {@link ChangeManager} change type
|
||||
* @param tag the tag that was created
|
||||
*/
|
||||
private void fireTagCreatedNotification(int type, FunctionTag tag) {
|
||||
program.tagCreated(tag, type);
|
||||
private void fireTagCreatedNotification(ProgramEvent eventType, FunctionTag tag) {
|
||||
program.tagCreated(tag, eventType);
|
||||
}
|
||||
|
||||
/**
|
||||
* Fires off a notification indicating that the given tag has been deleted.
|
||||
*
|
||||
* @param type the type of change
|
||||
* @param eventType the type of change
|
||||
* @param tag the tag that was deleted
|
||||
*/
|
||||
private void fireTagDeletedNotification(int type, FunctionTag tag) {
|
||||
program.tagChanged(tag, type, tag, null);
|
||||
private void fireTagDeletedNotification(ProgramEvent eventType, FunctionTag tag) {
|
||||
program.tagChanged(tag, eventType, tag, null);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -354,7 +354,7 @@ public class FunctionTagManagerDB implements FunctionTagManager, ErrorHandler {
|
|||
// Removing an object invalidates the db cache.
|
||||
cache.delete(tag.getId());
|
||||
|
||||
fireTagDeletedNotification(ChangeManager.DOCR_FUNCTION_TAG_DELETED, tag);
|
||||
fireTagDeletedNotification(ProgramEvent.FUNCTION_TAG_DELETED, tag);
|
||||
invalidateFunctions();
|
||||
}
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@ public class LocalVariableDB extends VariableDB implements LocalVariable {
|
|||
function.startUpdate();
|
||||
function.checkDeleted();
|
||||
symbol.setFirstUseOffset(firstUseOffset);
|
||||
functionMgr.functionChanged(function, 0);
|
||||
functionMgr.functionChanged(function, null);
|
||||
}
|
||||
finally {
|
||||
function.endUpdate();
|
||||
|
|
|
@ -15,13 +15,14 @@
|
|||
*/
|
||||
package ghidra.program.database.function;
|
||||
|
||||
import static ghidra.program.util.FunctionChangeRecord.FunctionChangeType.*;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import ghidra.program.model.data.*;
|
||||
import ghidra.program.model.lang.DynamicVariableStorage;
|
||||
import ghidra.program.model.listing.*;
|
||||
import ghidra.program.model.symbol.SourceType;
|
||||
import ghidra.program.util.ChangeManager;
|
||||
import ghidra.util.exception.DuplicateNameException;
|
||||
import ghidra.util.exception.InvalidInputException;
|
||||
|
||||
|
@ -98,7 +99,7 @@ public class ReturnParameterDB extends ParameterDB {
|
|||
function.updateParametersAndReturn();
|
||||
}
|
||||
function.updateSignatureSourceAfterVariableChange(source, type);
|
||||
functionMgr.functionChanged(function, ChangeManager.FUNCTION_CHANGED_RETURN);
|
||||
functionMgr.functionChanged(function, RETURN_TYPE_CHANGED);
|
||||
}
|
||||
catch (IOException e) {
|
||||
functionMgr.dbError(e);
|
||||
|
@ -148,7 +149,7 @@ public class ReturnParameterDB extends ParameterDB {
|
|||
function.updateParametersAndReturn();
|
||||
}
|
||||
function.updateSignatureSourceAfterVariableChange(source, type);
|
||||
functionMgr.functionChanged(function, ChangeManager.FUNCTION_CHANGED_RETURN);
|
||||
functionMgr.functionChanged(function, RETURN_TYPE_CHANGED);
|
||||
}
|
||||
catch (IOException e) {
|
||||
functionMgr.dbError(e);
|
||||
|
|
|
@ -182,7 +182,7 @@ public abstract class VariableDB implements Variable {
|
|||
@Override
|
||||
public void setComment(String comment) {
|
||||
symbol.setSymbolStringData(comment);
|
||||
functionMgr.functionChanged(function, 0);
|
||||
functionMgr.functionChanged(function, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -21,8 +21,8 @@ import java.util.*;
|
|||
|
||||
import db.DBConstants;
|
||||
import db.DBHandle;
|
||||
import ghidra.framework.model.DomainObject;
|
||||
import ghidra.framework.model.DomainObjectChangeRecord;
|
||||
import ghidra.framework.model.DomainObjectEvent;
|
||||
import ghidra.framework.store.LockException;
|
||||
import ghidra.program.database.*;
|
||||
import ghidra.program.database.code.CodeManager;
|
||||
|
@ -32,7 +32,7 @@ import ghidra.program.model.lang.Language;
|
|||
import ghidra.program.model.listing.Instruction;
|
||||
import ghidra.program.model.listing.Program;
|
||||
import ghidra.program.model.mem.*;
|
||||
import ghidra.program.util.ChangeManager;
|
||||
import ghidra.program.util.ProgramEvent;
|
||||
import ghidra.util.*;
|
||||
import ghidra.util.exception.*;
|
||||
import ghidra.util.task.TaskMonitor;
|
||||
|
@ -485,23 +485,23 @@ public class MemoryMapDB implements Memory, ManagerDB, LiveMemoryListener {
|
|||
void fireBlockAdded(MemoryBlock newBlock) {
|
||||
AddressRange range = new AddressRangeImpl(newBlock.getStart(), newBlock.getEnd());
|
||||
program.getTreeManager().addMemoryBlock(newBlock.getName(), range);
|
||||
program.setChanged(ChangeManager.DOCR_MEMORY_BLOCK_ADDED, newBlock.getStart(),
|
||||
newBlock.getEnd(), null, null);
|
||||
program.fireEvent(new DomainObjectChangeRecord(DomainObject.DO_OBJECT_RESTORED));
|
||||
program.setChanged(ProgramEvent.MEMORY_BLOCK_ADDED, newBlock.getStart(), newBlock.getEnd(),
|
||||
null, null);
|
||||
program.fireEvent(new DomainObjectChangeRecord(DomainObjectEvent.RESTORED));
|
||||
}
|
||||
|
||||
void fireBlockSplit() {
|
||||
program.fireEvent(new DomainObjectChangeRecord(DomainObject.DO_OBJECT_RESTORED));
|
||||
program.fireEvent(new DomainObjectChangeRecord(DomainObjectEvent.RESTORED));
|
||||
}
|
||||
|
||||
void fireBlockRemoved(Address blockStartAddr) {
|
||||
program.setChanged(ChangeManager.DOCR_MEMORY_BLOCK_REMOVED, blockStartAddr, null);
|
||||
program.fireEvent(new DomainObjectChangeRecord(DomainObject.DO_OBJECT_RESTORED));
|
||||
program.setChanged(ProgramEvent.MEMORY_BLOCK_REMOVED, blockStartAddr, null);
|
||||
program.fireEvent(new DomainObjectChangeRecord(DomainObjectEvent.RESTORED));
|
||||
}
|
||||
|
||||
void fireBlockMoved(MemoryBlockDB block, Address oldStartAddr) {
|
||||
program.setChanged(ChangeManager.DOCR_MEMORY_BLOCKS_JOINED, oldStartAddr, block);
|
||||
program.fireEvent(new DomainObjectChangeRecord(DomainObject.DO_OBJECT_RESTORED));
|
||||
program.setChanged(ProgramEvent.MEMORY_BLOCKS_JOINED, oldStartAddr, block);
|
||||
program.fireEvent(new DomainObjectChangeRecord(DomainObjectEvent.RESTORED));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -512,17 +512,16 @@ public class MemoryMapDB implements Memory, ManagerDB, LiveMemoryListener {
|
|||
* @param oldBlockStartAddr original start address of affected block
|
||||
*/
|
||||
void fireBlocksJoined(MemoryBlock newBlock, Address oldBlockStartAddr) {
|
||||
program.setChanged(ChangeManager.DOCR_MEMORY_BLOCKS_JOINED, oldBlockStartAddr, newBlock);
|
||||
program.setChanged(ProgramEvent.MEMORY_BLOCKS_JOINED, oldBlockStartAddr, newBlock);
|
||||
}
|
||||
|
||||
void fireBlockSplit(MemoryBlockDB originalBlock, MemoryBlockDB newBlock) {
|
||||
program.setChanged(ChangeManager.DOCR_MEMORY_BLOCK_SPLIT, null, null, originalBlock,
|
||||
newBlock);
|
||||
program.setChanged(ProgramEvent.MEMORY_BLOCK_SPLIT, null, null, originalBlock, newBlock);
|
||||
}
|
||||
|
||||
void fireBlockChanged(MemoryBlock block) {
|
||||
if (program != null) {
|
||||
program.setChanged(ChangeManager.DOCR_MEMORY_BLOCK_CHANGED, block, null);
|
||||
program.setChanged(ProgramEvent.MEMORY_BLOCK_CHANGED, block, null);
|
||||
}
|
||||
|
||||
// name could have changed
|
||||
|
@ -535,7 +534,7 @@ public class MemoryMapDB implements Memory, ManagerDB, LiveMemoryListener {
|
|||
Address end = addr.addNoWrap(count - 1);
|
||||
|
||||
program.getCodeManager().memoryChanged(addr, end);
|
||||
program.setChanged(ChangeManager.DOCR_MEMORY_BYTES_CHANGED, addr, end, null, null);
|
||||
program.setChanged(ProgramEvent.MEMORY_BYTES_CHANGED, addr, end, null, null);
|
||||
|
||||
}
|
||||
catch (AddressOverflowException e) {
|
||||
|
|
|
@ -27,7 +27,7 @@ import ghidra.program.database.map.AddressMap;
|
|||
import ghidra.program.database.util.AddressRangeMapDB;
|
||||
import ghidra.program.model.address.*;
|
||||
import ghidra.program.model.listing.*;
|
||||
import ghidra.program.util.ChangeManager;
|
||||
import ghidra.program.util.ProgramEvent;
|
||||
import ghidra.util.Lock;
|
||||
import ghidra.util.exception.*;
|
||||
import ghidra.util.task.TaskMonitor;
|
||||
|
@ -134,8 +134,8 @@ class ModuleManager {
|
|||
}
|
||||
}
|
||||
|
||||
fragMap = new AddressRangeMapDB(handle, addrMap, lock,
|
||||
getFragAddressTableName(treeID), errHandler, LongField.INSTANCE, true);
|
||||
fragMap = new AddressRangeMapDB(handle, addrMap, lock, getFragAddressTableName(treeID),
|
||||
errHandler, LongField.INSTANCE, true);
|
||||
|
||||
if (versionExc != null) {
|
||||
throw versionExc;
|
||||
|
@ -423,7 +423,7 @@ class ModuleManager {
|
|||
treeMgr.updateTreeRecord(record);
|
||||
|
||||
// generate an event...
|
||||
getProgram().programTreeChanged(treeID, ChangeManager.DOCR_FRAGMENT_MOVED, null,
|
||||
getProgram().programTreeChanged(treeID, ProgramEvent.FRAGMENT_MOVED, null,
|
||||
new AddressRangeImpl(fromAddr, rangeEnd),
|
||||
new AddressRangeImpl(toAddr, toAddr.addNoWrap(length - 1)));
|
||||
|
||||
|
@ -439,7 +439,7 @@ class ModuleManager {
|
|||
ProgramModule parent = getModuleDB(parentID);
|
||||
nameSet.add(fragment.getName());
|
||||
treeMgr.updateTreeRecord(record);
|
||||
getProgram().programTreeChanged(treeID, ChangeManager.DOCR_GROUP_ADDED, null, parent,
|
||||
getProgram().programTreeChanged(treeID, ProgramEvent.GROUP_ADDED, null, parent,
|
||||
fragment);
|
||||
}
|
||||
catch (IOException e) {
|
||||
|
@ -457,8 +457,7 @@ class ModuleManager {
|
|||
ProgramModule parent = getModuleDB(parentID);
|
||||
nameSet.add(module.getName());
|
||||
treeMgr.updateTreeRecord(record);
|
||||
getProgram().programTreeChanged(treeID, ChangeManager.DOCR_GROUP_ADDED, null, parent,
|
||||
module);
|
||||
getProgram().programTreeChanged(treeID, ProgramEvent.GROUP_ADDED, null, parent, module);
|
||||
}
|
||||
catch (IOException e) {
|
||||
errHandler.dbError(e);
|
||||
|
@ -483,8 +482,7 @@ class ModuleManager {
|
|||
|
||||
}
|
||||
treeMgr.updateTreeRecord(record);
|
||||
getProgram().programTreeChanged(treeID, ChangeManager.DOCR_GROUP_REMOVED, null,
|
||||
parentModule,
|
||||
getProgram().programTreeChanged(treeID, ProgramEvent.GROUP_REMOVED, null, parentModule,
|
||||
childName);
|
||||
|
||||
}
|
||||
|
@ -498,7 +496,7 @@ class ModuleManager {
|
|||
try {
|
||||
treeMgr.updateTreeRecord(record);
|
||||
|
||||
getProgram().programTreeChanged(treeID, ChangeManager.DOCR_GROUP_COMMENT_CHANGED, null,
|
||||
getProgram().programTreeChanged(treeID, ProgramEvent.GROUP_COMMENT_CHANGED, null,
|
||||
oldComments, group);
|
||||
|
||||
}
|
||||
|
@ -514,7 +512,7 @@ class ModuleManager {
|
|||
nameSet.remove(oldName);
|
||||
nameSet.add(group.getName());
|
||||
treeMgr.updateTreeRecord(record);
|
||||
getProgram().programTreeChanged(treeID, ChangeManager.DOCR_GROUP_RENAMED, null, oldName,
|
||||
getProgram().programTreeChanged(treeID, ProgramEvent.GROUP_RENAMED, null, oldName,
|
||||
group);
|
||||
|
||||
}
|
||||
|
@ -667,7 +665,7 @@ class ModuleManager {
|
|||
}
|
||||
treeMgr.updateTreeRecord(record);
|
||||
|
||||
getProgram().programTreeChanged(treeID, ChangeManager.DOCR_CODE_MOVED, null, min, max);
|
||||
getProgram().programTreeChanged(treeID, ProgramEvent.FRAGMENT_CHANGED, null, min, max);
|
||||
|
||||
}
|
||||
finally {
|
||||
|
@ -696,15 +694,14 @@ class ModuleManager {
|
|||
|
||||
void childReordered(ModuleDB parentModule, Group child) {
|
||||
treeMgr.updateTreeRecord(record);
|
||||
getProgram().programTreeChanged(treeID, ChangeManager.DOCR_MODULE_REORDERED, parentModule,
|
||||
child,
|
||||
getProgram().programTreeChanged(treeID, ProgramEvent.MODULE_REORDERED, parentModule, child,
|
||||
child);
|
||||
}
|
||||
|
||||
void childReparented(Group group, String oldParentName, String newParentName) {
|
||||
treeMgr.updateTreeRecord(record);
|
||||
getProgram().programTreeChanged(treeID, ChangeManager.DOCR_GROUP_REPARENTED, group,
|
||||
oldParentName, newParentName);
|
||||
getProgram().programTreeChanged(treeID, ProgramEvent.GROUP_REPARENTED, group, oldParentName,
|
||||
newParentName);
|
||||
}
|
||||
|
||||
String[] getParentNames(long childID) {
|
||||
|
|
|
@ -28,7 +28,7 @@ import ghidra.program.model.listing.ProgramFragment;
|
|||
import ghidra.program.model.listing.ProgramModule;
|
||||
import ghidra.program.model.mem.Memory;
|
||||
import ghidra.program.model.mem.MemoryBlock;
|
||||
import ghidra.program.util.ChangeManager;
|
||||
import ghidra.program.util.ProgramEvent;
|
||||
import ghidra.util.Lock;
|
||||
import ghidra.util.exception.*;
|
||||
import ghidra.util.task.TaskMonitor;
|
||||
|
@ -131,7 +131,7 @@ public class TreeManager implements ManagerDB {
|
|||
addMemoryBlocks(m);
|
||||
if (program != null) {
|
||||
// no notification for initial default tree
|
||||
program.programTreeAdded(record.getKey(), ChangeManager.DOCR_TREE_CREATED, null,
|
||||
program.programTreeAdded(record.getKey(), ProgramEvent.PROGRAM_TREE_CREATED, null,
|
||||
treeName);
|
||||
}
|
||||
return m.getRootModule();
|
||||
|
@ -236,8 +236,8 @@ public class TreeManager implements ManagerDB {
|
|||
|
||||
treeMap.remove(oldName);
|
||||
treeMap.put(newName, moduleMgr);
|
||||
program.programTreeChanged(moduleMgr.getTreeID(), ChangeManager.DOCR_TREE_RENAMED, null,
|
||||
oldName, newName);
|
||||
program.programTreeChanged(moduleMgr.getTreeID(), ProgramEvent.PROGRAM_TREE_RENAMED,
|
||||
null, oldName, newName);
|
||||
|
||||
}
|
||||
finally {
|
||||
|
@ -258,7 +258,7 @@ public class TreeManager implements ManagerDB {
|
|||
treeAdapter.deleteRecord(rec.getKey());
|
||||
ModuleManager mm = treeMap.remove(treeName);
|
||||
mm.dispose();
|
||||
program.programTreeChanged(rec.getKey(), ChangeManager.DOCR_TREE_REMOVED, null,
|
||||
program.programTreeChanged(rec.getKey(), ProgramEvent.PROGRAM_TREE_REMOVED, null,
|
||||
treeName, null);
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -31,6 +31,7 @@ import ghidra.program.model.address.Address;
|
|||
import ghidra.program.model.listing.BookmarkManager;
|
||||
import ghidra.program.model.util.*;
|
||||
import ghidra.program.util.ChangeManager;
|
||||
import ghidra.program.util.ProgramEvent;
|
||||
import ghidra.util.*;
|
||||
import ghidra.util.exception.*;
|
||||
import ghidra.util.map.TypeMismatchException;
|
||||
|
@ -170,10 +171,10 @@ public class DBPropertyMapManager implements PropertyMapManager, ManagerDB {
|
|||
case OBJECT_PROPERTY_TYPE:
|
||||
String className = rec.getString(OBJECT_CLASS_COL);
|
||||
//boolean upgrade = (openMode == ProgramDB.UPGRADE);
|
||||
if (BookmarkManager.OLD_BOOKMARK_PROPERTY_OBJECT_CLASS1.equals(
|
||||
className) ||
|
||||
BookmarkManager.OLD_BOOKMARK_PROPERTY_OBJECT_CLASS2.equals(
|
||||
className)) {
|
||||
if (BookmarkManager.OLD_BOOKMARK_PROPERTY_OBJECT_CLASS1
|
||||
.equals(className) ||
|
||||
BookmarkManager.OLD_BOOKMARK_PROPERTY_OBJECT_CLASS2
|
||||
.equals(className)) {
|
||||
// Upgrade handled by new BookmarkManager
|
||||
if (openMode == DBConstants.UPDATE) {
|
||||
throw new VersionException(VersionException.OLDER_VERSION,
|
||||
|
@ -544,8 +545,8 @@ public class DBPropertyMapManager implements PropertyMapManager, ManagerDB {
|
|||
pm.delete();
|
||||
propertiesDBAdapter.removeRecord(propertyName);
|
||||
propertyMapCache.remove(propertyName);
|
||||
changeMgr.setObjChanged(ChangeManager.DOCR_CODE_UNIT_PROPERTY_ALL_REMOVED,
|
||||
propertyName, null, null);
|
||||
changeMgr.setObjChanged(ProgramEvent.CODE_UNIT_PROPERTY_ALL_REMOVED, propertyName,
|
||||
null, null);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -33,7 +33,7 @@ import ghidra.program.model.lang.Register;
|
|||
import ghidra.program.model.listing.*;
|
||||
import ghidra.program.model.pcode.Varnode;
|
||||
import ghidra.program.model.symbol.*;
|
||||
import ghidra.program.util.ChangeManager;
|
||||
import ghidra.program.util.ProgramEvent;
|
||||
import ghidra.util.Lock;
|
||||
import ghidra.util.Msg;
|
||||
import ghidra.util.exception.*;
|
||||
|
@ -543,8 +543,8 @@ public class ReferenceDBManager implements ReferenceManager, ManagerDB, ErrorHan
|
|||
}
|
||||
|
||||
if (badOffsetReference) {
|
||||
Msg.warn(this, "Offset Reference from " + fromAddr +
|
||||
" produces bad Xref into EXTERNAL block");
|
||||
Msg.warn(this,
|
||||
"Offset Reference from " + fromAddr + " produces bad Xref into EXTERNAL block");
|
||||
}
|
||||
|
||||
try {
|
||||
|
@ -659,8 +659,7 @@ public class ReferenceDBManager implements ReferenceManager, ManagerDB, ErrorHan
|
|||
public Variable getReferencedVariable(Reference reference) {
|
||||
RefType refType = reference.getReferenceType();
|
||||
return program.getFunctionManager()
|
||||
.getReferencedVariable(reference.getFromAddress(),
|
||||
reference.getToAddress(), 0,
|
||||
.getReferencedVariable(reference.getFromAddress(), reference.getToAddress(), 0,
|
||||
!refType.isWrite() && (refType.isRead() || refType.isIndirect()));
|
||||
}
|
||||
|
||||
|
@ -742,8 +741,8 @@ public class ReferenceDBManager implements ReferenceManager, ManagerDB, ErrorHan
|
|||
return new Scope(var.getFirstUseOffset(), outOfScopeOffset);
|
||||
}
|
||||
|
||||
private List<Reference> getScopedVariableReferences(VariableStorage storage,
|
||||
Function function, Scope scope) {
|
||||
private List<Reference> getScopedVariableReferences(VariableStorage storage, Function function,
|
||||
Scope scope) {
|
||||
|
||||
SortedMap<Address, List<Reference>> dataReferences =
|
||||
functionCacher.getFunctionDataReferences();
|
||||
|
@ -1265,8 +1264,8 @@ public class ReferenceDBManager implements ReferenceManager, ManagerDB, ErrorHan
|
|||
catch (IOException e) {
|
||||
program.dbError(e);
|
||||
}
|
||||
program.setObjChanged(ChangeManager.DOCR_SYMBOL_ASSOCIATION_ADDED, ref.getFromAddress(),
|
||||
ref, null, s);
|
||||
program.setObjChanged(ProgramEvent.SYMBOL_ASSOCIATION_ADDED, ref.getFromAddress(), ref,
|
||||
null, s);
|
||||
}
|
||||
finally {
|
||||
lock.release();
|
||||
|
@ -1278,8 +1277,8 @@ public class ReferenceDBManager implements ReferenceManager, ManagerDB, ErrorHan
|
|||
lock.acquire();
|
||||
try {
|
||||
setSymbolID(ref, -1);
|
||||
program.setObjChanged(ChangeManager.DOCR_SYMBOL_ASSOCIATION_REMOVED,
|
||||
ref.getFromAddress(), ref, null, null);
|
||||
program.setObjChanged(ProgramEvent.SYMBOL_ASSOCIATION_REMOVED, ref.getFromAddress(),
|
||||
ref, null, null);
|
||||
}
|
||||
catch (IOException e) {
|
||||
program.dbError(e);
|
||||
|
@ -1604,11 +1603,11 @@ public class ReferenceDBManager implements ReferenceManager, ManagerDB, ErrorHan
|
|||
}
|
||||
|
||||
private void externalEntryPointAdded(Address addr) {
|
||||
program.setChanged(ChangeManager.DOCR_EXTERNAL_ENTRY_POINT_ADDED, addr, addr, null, null);
|
||||
program.setChanged(ProgramEvent.EXTERNAL_ENTRY_ADDED, addr, addr, null, null);
|
||||
}
|
||||
|
||||
private void externalEntryPointRemoved(Address addr) {
|
||||
program.setChanged(ChangeManager.DOCR_EXTERNAL_ENTRY_POINT_REMOVED, addr, addr, null, null);
|
||||
program.setChanged(ProgramEvent.EXTERNAL_ENTRY_REMOVED, addr, addr, null, null);
|
||||
}
|
||||
|
||||
private RefList getFromRefs(Address from) {
|
||||
|
@ -1719,7 +1718,7 @@ public class ReferenceDBManager implements ReferenceManager, ManagerDB, ErrorHan
|
|||
addr = null;
|
||||
}
|
||||
functionCacher.clearCache();
|
||||
program.setObjChanged(ChangeManager.DOCR_MEM_REFERENCE_ADDED, addr, ref, null, ref);
|
||||
program.setObjChanged(ProgramEvent.REFERENCE_ADDED, addr, ref, null, ref);
|
||||
if (ref.getReferenceType() == RefType.FALL_THROUGH) {
|
||||
program.getCodeManager().fallThroughChanged(ref.getFromAddress(), ref);
|
||||
}
|
||||
|
@ -1727,8 +1726,7 @@ public class ReferenceDBManager implements ReferenceManager, ManagerDB, ErrorHan
|
|||
|
||||
private void referenceRemoved(Reference ref) {
|
||||
functionCacher.clearCache();
|
||||
program.setObjChanged(ChangeManager.DOCR_MEM_REFERENCE_REMOVED, ref.getFromAddress(), ref,
|
||||
ref, null);
|
||||
program.setObjChanged(ProgramEvent.REFERENCE_REMOVED, ref.getFromAddress(), ref, ref, null);
|
||||
if (ref.getReferenceType() == RefType.FALL_THROUGH) {
|
||||
program.getCodeManager().fallThroughChanged(ref.getFromAddress(), null);
|
||||
}
|
||||
|
@ -1736,7 +1734,7 @@ public class ReferenceDBManager implements ReferenceManager, ManagerDB, ErrorHan
|
|||
|
||||
private void referenceTypeChanged(Reference ref, RefType oldType, RefType newType) {
|
||||
functionCacher.clearCache();
|
||||
program.setObjChanged(ChangeManager.DOCR_MEM_REF_TYPE_CHANGED, ref.getFromAddress(), ref,
|
||||
program.setObjChanged(ProgramEvent.REFERENCE_TYPE_CHANGED, ref.getFromAddress(), ref,
|
||||
oldType, newType);
|
||||
if (oldType == RefType.FALL_THROUGH) {
|
||||
program.getCodeManager().fallThroughChanged(ref.getFromAddress(), null);
|
||||
|
@ -1745,12 +1743,12 @@ public class ReferenceDBManager implements ReferenceManager, ManagerDB, ErrorHan
|
|||
|
||||
private void referencePrimaryChanged(Reference ref) {
|
||||
if (ref.isPrimary()) {
|
||||
program.setObjChanged(ChangeManager.DOCR_MEM_REF_PRIMARY_SET, ref.getFromAddress(), ref,
|
||||
program.setObjChanged(ProgramEvent.REFERNCE_PRIMARY_SET, ref.getFromAddress(), ref,
|
||||
null, ref);
|
||||
}
|
||||
else {
|
||||
program.setObjChanged(ChangeManager.DOCR_MEM_REF_PRIMARY_REMOVED, ref.getFromAddress(),
|
||||
ref, ref, null);
|
||||
program.setObjChanged(ProgramEvent.REFERENCE_PRIMARY_REMOVED, ref.getFromAddress(), ref,
|
||||
ref, null);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1916,9 +1914,8 @@ public class ReferenceDBManager implements ReferenceManager, ManagerDB, ErrorHan
|
|||
Reference memRef;
|
||||
if (ref.isOffsetReference()) {
|
||||
OffsetReference offRef = (OffsetReference) ref;
|
||||
memRef =
|
||||
addOffsetMemReference(from, offRef.getBaseAddress(), true, offRef.getOffset(), type,
|
||||
sourceType, opIndex);
|
||||
memRef = addOffsetMemReference(from, offRef.getBaseAddress(), true, offRef.getOffset(),
|
||||
type, sourceType, opIndex);
|
||||
}
|
||||
else if (ref.isShiftedReference()) {
|
||||
ShiftedReference shiftRef = (ShiftedReference) ref;
|
||||
|
|
|
@ -31,7 +31,7 @@ import ghidra.program.model.mem.Memory;
|
|||
import ghidra.program.model.reloc.Relocation;
|
||||
import ghidra.program.model.reloc.Relocation.Status;
|
||||
import ghidra.program.model.reloc.RelocationTable;
|
||||
import ghidra.program.util.ChangeManager;
|
||||
import ghidra.program.util.ProgramEvent;
|
||||
import ghidra.util.Lock;
|
||||
import ghidra.util.exception.CancelledException;
|
||||
import ghidra.util.exception.VersionException;
|
||||
|
@ -149,12 +149,11 @@ public class RelocationManager implements RelocationTable, ManagerDB {
|
|||
byte flags = RelocationDBAdapter.getFlags(status, 0);
|
||||
adapter.add(addr, flags, type, values, bytes, symbolName);
|
||||
Relocation reloc = new Relocation(addr, status, type, values,
|
||||
getOriginalBytes(addr, status, bytes, 0),
|
||||
symbolName);
|
||||
getOriginalBytes(addr, status, bytes, 0), symbolName);
|
||||
|
||||
// fire event
|
||||
// TODO: full change support is missing
|
||||
program.setChanged(ChangeManager.DOCR_RELOCATION_ADDED, null, reloc);
|
||||
program.setChanged(ProgramEvent.RELOCATION_ADDED, null, reloc);
|
||||
|
||||
return reloc;
|
||||
}
|
||||
|
@ -175,12 +174,11 @@ public class RelocationManager implements RelocationTable, ManagerDB {
|
|||
byte flags = RelocationDBAdapter.getFlags(status, byteLength);
|
||||
adapter.add(addr, flags, type, values, null, symbolName);
|
||||
Relocation reloc = new Relocation(addr, status, type, values,
|
||||
getOriginalBytes(addr, status, null, byteLength),
|
||||
symbolName);
|
||||
getOriginalBytes(addr, status, null, byteLength), symbolName);
|
||||
|
||||
// fire event
|
||||
// TODO: full change support is missing
|
||||
program.setChanged(ChangeManager.DOCR_RELOCATION_ADDED, null, reloc);
|
||||
program.setChanged(ProgramEvent.RELOCATION_ADDED, null, reloc);
|
||||
|
||||
return reloc;
|
||||
}
|
||||
|
@ -249,12 +247,11 @@ public class RelocationManager implements RelocationTable, ManagerDB {
|
|||
int length = RelocationDBAdapter.getByteLength(flags);
|
||||
BinaryCodedField valuesField =
|
||||
new BinaryCodedField((BinaryField) rec.getFieldValue(RelocationDBAdapter.VALUE_COL));
|
||||
byte[] originalBytes =
|
||||
getOriginalBytes(addr, status, rec.getBinaryData(RelocationDBAdapter.BYTES_COL),
|
||||
length);
|
||||
byte[] originalBytes = getOriginalBytes(addr, status,
|
||||
rec.getBinaryData(RelocationDBAdapter.BYTES_COL), length);
|
||||
return new Relocation(addr, status, rec.getIntValue(RelocationDBAdapter.TYPE_COL),
|
||||
valuesField.getLongArray(),
|
||||
originalBytes, rec.getString(RelocationDBAdapter.SYMBOL_NAME_COL));
|
||||
valuesField.getLongArray(), originalBytes,
|
||||
rec.getString(RelocationDBAdapter.SYMBOL_NAME_COL));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -385,7 +382,8 @@ public class RelocationManager implements RelocationTable, ManagerDB {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void moveAddressRange(Address fromAddr, Address toAddr, long length, TaskMonitor monitor) {
|
||||
public void moveAddressRange(Address fromAddr, Address toAddr, long length,
|
||||
TaskMonitor monitor) {
|
||||
// do nothing here
|
||||
}
|
||||
|
||||
|
|
|
@ -25,8 +25,8 @@ import ghidra.program.database.map.AddressKeyAddressIterator;
|
|||
import ghidra.program.database.map.AddressMap;
|
||||
import ghidra.program.model.address.*;
|
||||
import ghidra.program.model.symbol.*;
|
||||
import ghidra.program.util.ChangeManager;
|
||||
import ghidra.program.util.EquateInfo;
|
||||
import ghidra.program.util.ProgramEvent;
|
||||
import ghidra.util.Lock;
|
||||
import ghidra.util.UniversalID;
|
||||
import ghidra.util.exception.*;
|
||||
|
@ -119,8 +119,8 @@ public class EquateManager implements EquateTable, ErrorHandler, ManagerDB {
|
|||
validateName(name);
|
||||
DBRecord record = equateAdapter.createEquate(name, value);
|
||||
EquateDB equate = new EquateDB(this, equateCache, record);
|
||||
program.setChanged(ChangeManager.DOCR_EQUATE_ADDED,
|
||||
new EquateInfo(name, value, null, 0, 0), null);
|
||||
program.setChanged(ProgramEvent.EQUATE_ADDED, new EquateInfo(name, value, null, 0, 0),
|
||||
null);
|
||||
return equate;
|
||||
|
||||
}
|
||||
|
@ -384,7 +384,7 @@ public class EquateManager implements EquateTable, ErrorHandler, ManagerDB {
|
|||
equateAdapter.removeRecord(equateID);
|
||||
equateCache.delete(equateID);
|
||||
// fire event: oldValue = equate name, newValue=null
|
||||
program.setChanged(ChangeManager.DOCR_EQUATE_REMOVED, name, null);
|
||||
program.setChanged(ProgramEvent.EQUATE_REMOVED, name, null);
|
||||
}
|
||||
finally {
|
||||
lock.release();
|
||||
|
@ -431,7 +431,7 @@ public class EquateManager implements EquateTable, ErrorHandler, ManagerDB {
|
|||
new EquateRefDB(this, refCache, record);
|
||||
|
||||
// fire event: oldValue=EquateInfo, newValue = null
|
||||
program.setChanged(ChangeManager.DOCR_EQUATE_REFERENCE_ADDED, address, address,
|
||||
program.setChanged(ProgramEvent.EQUATE_REFERENCE_ADDED, address, address,
|
||||
new EquateInfo(name, value, address, opIndex, dynamicHash), null);
|
||||
}
|
||||
finally {
|
||||
|
@ -508,7 +508,7 @@ public class EquateManager implements EquateTable, ErrorHandler, ManagerDB {
|
|||
* @param newName new name
|
||||
*/
|
||||
void equateNameChanged(String oldName, String newName) {
|
||||
program.setChanged(ChangeManager.DOCR_EQUATE_RENAMED, oldName, newName);
|
||||
program.setChanged(ProgramEvent.EQUATE_RENAMED, oldName, newName);
|
||||
}
|
||||
|
||||
DBRecord getEquateRecord(long equateID) {
|
||||
|
@ -589,7 +589,7 @@ public class EquateManager implements EquateTable, ErrorHandler, ManagerDB {
|
|||
|
||||
private void referenceRemoved(EquateDB equateDB, Address refAddr, short opIndex,
|
||||
long dynamichash) {
|
||||
program.setChanged(ChangeManager.DOCR_EQUATE_REFERENCE_REMOVED, refAddr, refAddr,
|
||||
program.setChanged(ProgramEvent.EQUATE_REFERENCE_REMOVED, refAddr, refAddr,
|
||||
new EquateInfo(equateDB.getName(), equateDB.getValue(), refAddr, opIndex, dynamichash),
|
||||
null);
|
||||
}
|
||||
|
|
|
@ -21,7 +21,7 @@ import ghidra.program.model.address.Address;
|
|||
import ghidra.program.model.listing.CircularDependencyException;
|
||||
import ghidra.program.model.listing.Library;
|
||||
import ghidra.program.model.symbol.*;
|
||||
import ghidra.program.util.ChangeManager;
|
||||
import ghidra.program.util.ProgramEvent;
|
||||
import ghidra.program.util.ProgramLocation;
|
||||
import ghidra.util.Msg;
|
||||
import ghidra.util.exception.DuplicateNameException;
|
||||
|
@ -52,8 +52,8 @@ public class LibrarySymbol extends SymbolDB {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void setName(String newName, SourceType source) throws DuplicateNameException,
|
||||
InvalidInputException {
|
||||
public void setName(String newName, SourceType source)
|
||||
throws DuplicateNameException, InvalidInputException {
|
||||
String oldName = getName();
|
||||
if (Library.UNKNOWN.equals(oldName)) {
|
||||
Msg.warn(this, "Unable to change name of " + Library.UNKNOWN + " Library");
|
||||
|
@ -64,8 +64,8 @@ public class LibrarySymbol extends SymbolDB {
|
|||
|
||||
if (!oldName.equals(getName())) {
|
||||
symbolMgr.getProgram()
|
||||
.setObjChanged(ChangeManager.DOCR_EXTERNAL_NAME_CHANGED,
|
||||
(Address) null, null, oldName, newName);
|
||||
.setObjChanged(ProgramEvent.EXTERNAL_NAME_CHANGED, (Address) null, null,
|
||||
oldName, newName);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -78,8 +78,8 @@ public class LibrarySymbol extends SymbolDB {
|
|||
|
||||
if (!oldName.equals(getName())) {
|
||||
symbolMgr.getProgram()
|
||||
.setObjChanged(ChangeManager.DOCR_EXTERNAL_NAME_CHANGED,
|
||||
(Address) null, null, oldName, newName);
|
||||
.setObjChanged(ProgramEvent.EXTERNAL_NAME_CHANGED, (Address) null, null,
|
||||
oldName, newName);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -90,8 +90,7 @@ public class LibrarySymbol extends SymbolDB {
|
|||
super.setSymbolStringData(newPath);
|
||||
|
||||
symbolMgr.getProgram()
|
||||
.setObjChanged(ChangeManager.DOCR_EXTERNAL_PATH_CHANGED, getName(),
|
||||
oldPath, newPath);
|
||||
.setObjChanged(ProgramEvent.EXTERNAL_PATH_CHANGED, getName(), oldPath, newPath);
|
||||
}
|
||||
|
||||
public SymbolType getSymbolType() {
|
||||
|
|
|
@ -29,7 +29,7 @@ import ghidra.program.model.lang.Register;
|
|||
import ghidra.program.model.listing.CircularDependencyException;
|
||||
import ghidra.program.model.listing.Program;
|
||||
import ghidra.program.model.symbol.*;
|
||||
import ghidra.program.util.ChangeManager;
|
||||
import ghidra.program.util.ProgramEvent;
|
||||
import ghidra.util.Lock;
|
||||
import ghidra.util.SystemUtilities;
|
||||
import ghidra.util.exception.DuplicateNameException;
|
||||
|
@ -94,15 +94,13 @@ public abstract class SymbolDB extends DatabaseObject implements Symbol {
|
|||
if (rec == null) {
|
||||
rec = symbolMgr.getSymbolRecord(key);
|
||||
}
|
||||
if (rec == null ||
|
||||
record.getByteValue(SymbolDatabaseAdapter.SYMBOL_TYPE_COL) != rec.getByteValue(
|
||||
SymbolDatabaseAdapter.SYMBOL_TYPE_COL)) {
|
||||
if (rec == null || record.getByteValue(SymbolDatabaseAdapter.SYMBOL_TYPE_COL) != rec
|
||||
.getByteValue(SymbolDatabaseAdapter.SYMBOL_TYPE_COL)) {
|
||||
return false;
|
||||
}
|
||||
record = rec;
|
||||
address = symbolMgr.getAddressMap()
|
||||
.decodeAddress(
|
||||
rec.getLongValue(SymbolDatabaseAdapter.SYMBOL_ADDR_COL));
|
||||
.decodeAddress(rec.getLongValue(SymbolDatabaseAdapter.SYMBOL_ADDR_COL));
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
@ -130,8 +128,8 @@ public abstract class SymbolDB extends DatabaseObject implements Symbol {
|
|||
updateRecord();
|
||||
Address oldAddr = address;
|
||||
address = addr;
|
||||
program.symbolChanged(this, ChangeManager.DOCR_SYMBOL_ADDRESS_CHANGED, oldAddr, this,
|
||||
oldAddr, addr);
|
||||
program.symbolChanged(this, ProgramEvent.SYMBOL_ADDRESS_CHANGED, oldAddr, this, oldAddr,
|
||||
addr);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -634,8 +632,7 @@ public abstract class SymbolDB extends DatabaseObject implements Symbol {
|
|||
symbolMgr.symbolNamespaceChanged(this, oldNamespace);
|
||||
}
|
||||
if (nameChange) {
|
||||
if (isExternal() &&
|
||||
(type == SymbolType.FUNCTION || type == SymbolType.LABEL)) {
|
||||
if (isExternal() && (type == SymbolType.FUNCTION || type == SymbolType.LABEL)) {
|
||||
ExternalManagerDB externalManager = symbolMgr.getExternalManager();
|
||||
ExternalLocationDB externalLocation =
|
||||
(ExternalLocationDB) externalManager.getExternalLocation(this);
|
||||
|
@ -646,13 +643,12 @@ public abstract class SymbolDB extends DatabaseObject implements Symbol {
|
|||
ProgramDB program = symbolMgr.getProgram();
|
||||
for (int i = 0; i < dynamicallyRenamedSymbols.size(); i++) {
|
||||
Symbol s = dynamicallyRenamedSymbols.get(i);
|
||||
program.symbolChanged(s, ChangeManager.DOCR_SYMBOL_RENAMED,
|
||||
s.getAddress(), s, oldDynamicallyRenamedSymbolNames.get(i),
|
||||
s.getName());
|
||||
program.symbolChanged(s, ProgramEvent.SYMBOL_RENAMED, s.getAddress(), s,
|
||||
oldDynamicallyRenamedSymbolNames.get(i), s.getName());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (type == SymbolType.NAMESPACE || type == SymbolType.CLASS) {
|
||||
// function class structure path change may impact auto-params
|
||||
symbolMgr.getProgram().getFunctionManager().invalidateCache(true);
|
||||
|
@ -780,8 +776,8 @@ public abstract class SymbolDB extends DatabaseObject implements Symbol {
|
|||
if (record == null) {
|
||||
return null;
|
||||
}
|
||||
return symbolMgr.getSymbol(
|
||||
record.getLongValue(SymbolDatabaseAdapter.SYMBOL_PARENT_COL));
|
||||
return symbolMgr
|
||||
.getSymbol(record.getLongValue(SymbolDatabaseAdapter.SYMBOL_PARENT_COL));
|
||||
}
|
||||
finally {
|
||||
lock.release();
|
||||
|
|
|
@ -37,8 +37,8 @@ import ghidra.program.model.address.*;
|
|||
import ghidra.program.model.data.DataType;
|
||||
import ghidra.program.model.listing.*;
|
||||
import ghidra.program.model.symbol.*;
|
||||
import ghidra.program.util.ChangeManager;
|
||||
import ghidra.program.util.LanguageTranslator;
|
||||
import ghidra.program.util.ProgramEvent;
|
||||
import ghidra.util.*;
|
||||
import ghidra.util.exception.*;
|
||||
import ghidra.util.task.TaskMonitor;
|
||||
|
@ -359,8 +359,8 @@ public class SymbolManager implements SymbolTable, ManagerDB {
|
|||
Msg.warn(this, "Variable symbol upgrade problem: " + parent.getName() +
|
||||
":" + rec.getString(SymbolDatabaseAdapter.SYMBOL_NAME_COL));
|
||||
curVarAddr = null;
|
||||
newVarAddr = variableStorageMgr.getVariableStorageAddress(
|
||||
VariableStorage.BAD_STORAGE, true);
|
||||
newVarAddr = variableStorageMgr
|
||||
.getVariableStorageAddress(VariableStorage.BAD_STORAGE, true);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -503,9 +503,8 @@ public class SymbolManager implements SymbolTable, ManagerDB {
|
|||
|
||||
Symbol symbol = getFirstSymbol(name, namespace, s -> !s.getSymbolType().allowsDuplicates());
|
||||
if (symbol != null) {
|
||||
throw new DuplicateNameException(
|
||||
"A " + symbol.getSymbolType() + " symbol with name " + name +
|
||||
" already exists in namespace " + symbol.getParentNamespace().getName());
|
||||
throw new DuplicateNameException("A " + symbol.getSymbolType() + " symbol with name " +
|
||||
name + " already exists in namespace " + symbol.getParentNamespace().getName());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -527,9 +526,8 @@ public class SymbolManager implements SymbolTable, ManagerDB {
|
|||
Address address = symbol.getAddress();
|
||||
symbolRemoved(symbol, address, symbol.getName(), oldKey, Namespace.GLOBAL_NAMESPACE_ID,
|
||||
null);
|
||||
DBRecord record =
|
||||
adapter.createSymbol(newName, address, newParentID, SymbolType.LABEL, null,
|
||||
null, null, source, true);
|
||||
DBRecord record = adapter.createSymbol(newName, address, newParentID, SymbolType.LABEL,
|
||||
null, null, null, source, true);
|
||||
symbol.setRecord(record);
|
||||
symbolAdded(symbol);
|
||||
}
|
||||
|
@ -1548,34 +1546,33 @@ public class SymbolManager implements SymbolTable, ManagerDB {
|
|||
createLabelHistoryRecord(addr, oldName, newName, LabelHistory.RENAME);
|
||||
}
|
||||
|
||||
program.symbolChanged(symbol, ChangeManager.DOCR_SYMBOL_RENAMED, addr, symbol, oldName,
|
||||
newName);
|
||||
program.symbolChanged(symbol, ProgramEvent.SYMBOL_RENAMED, addr, symbol, oldName, newName);
|
||||
}
|
||||
|
||||
void symbolNamespaceChanged(Symbol symbol, Namespace oldParentNamespace) {
|
||||
program.symbolChanged(symbol, ChangeManager.DOCR_SYMBOL_SCOPE_CHANGED, symbol.getAddress(),
|
||||
program.symbolChanged(symbol, ProgramEvent.SYMBOL_SCOPE_CHANGED, symbol.getAddress(),
|
||||
symbol, oldParentNamespace, symbol.getParentNamespace());
|
||||
}
|
||||
|
||||
void primarySymbolSet(Symbol symbol, Symbol oldPrimarySymbol) {
|
||||
// fire event: old Value = symbol address, new value = reference address
|
||||
program.symbolChanged(symbol, ChangeManager.DOCR_SYMBOL_SET_AS_PRIMARY, symbol.getAddress(),
|
||||
null, oldPrimarySymbol, symbol);
|
||||
program.symbolChanged(symbol, ProgramEvent.SYMBOL_PRIMARY_STATE_CHANGED,
|
||||
symbol.getAddress(), null, oldPrimarySymbol, symbol);
|
||||
}
|
||||
|
||||
void symbolSourceChanged(Symbol symbol) {
|
||||
program.symbolChanged(symbol, ChangeManager.DOCR_SYMBOL_SOURCE_CHANGED, symbol.getAddress(),
|
||||
program.symbolChanged(symbol, ProgramEvent.SYMBOL_SOURCE_CHANGED, symbol.getAddress(),
|
||||
symbol, null, null);
|
||||
}
|
||||
|
||||
void symbolAnchoredFlagChanged(Symbol symbol) {
|
||||
program.symbolChanged(symbol, ChangeManager.DOCR_SYMBOL_ANCHORED_FLAG_CHANGED,
|
||||
symbol.getAddress(), symbol, null, null);
|
||||
program.symbolChanged(symbol, ProgramEvent.SYMBOL_ANCHOR_FLAG_CHANGED, symbol.getAddress(),
|
||||
symbol, null, null);
|
||||
}
|
||||
|
||||
void symbolDataChanged(Symbol symbol) {
|
||||
program.symbolChanged(symbol, ChangeManager.DOCR_SYMBOL_DATA_CHANGED, symbol.getAddress(),
|
||||
symbol, null, null);
|
||||
program.symbolChanged(symbol, ProgramEvent.SYMBOL_DATA_CHANGED, symbol.getAddress(), symbol,
|
||||
null, null);
|
||||
}
|
||||
|
||||
SymbolDatabaseAdapter getDatabaseAdapter() {
|
||||
|
@ -1614,7 +1611,7 @@ public class SymbolManager implements SymbolTable, ManagerDB {
|
|||
refManager.symbolAdded(symbol);
|
||||
|
||||
// fire event
|
||||
program.symbolAdded(symbol, ChangeManager.DOCR_SYMBOL_ADDED, addr, null, symbol);
|
||||
program.symbolAdded(symbol, ProgramEvent.SYMBOL_ADDED, addr, null, symbol);
|
||||
}
|
||||
|
||||
private void symbolRemoved(Symbol symbol, Address addr, String name, long symbolID,
|
||||
|
@ -1627,12 +1624,11 @@ public class SymbolManager implements SymbolTable, ManagerDB {
|
|||
}
|
||||
|
||||
// fire event
|
||||
program.symbolChanged(symbol, ChangeManager.DOCR_SYMBOL_REMOVED, addr, symbol, name,
|
||||
symbolID);
|
||||
program.symbolChanged(symbol, ProgramEvent.SYMBOL_REMOVED, addr, symbol, name, symbolID);
|
||||
}
|
||||
|
||||
void externalEntryPointRemoved(Address addr) {
|
||||
program.setChanged(ChangeManager.DOCR_EXTERNAL_ENTRY_POINT_REMOVED, addr, addr, null, null);
|
||||
program.setChanged(ProgramEvent.EXTERNAL_ENTRY_REMOVED, addr, addr, null, null);
|
||||
}
|
||||
|
||||
private void createLabelHistoryRecord(Address address, String oldName, String name,
|
||||
|
@ -2500,9 +2496,8 @@ public class SymbolManager implements SymbolTable, ManagerDB {
|
|||
}
|
||||
else {
|
||||
try {
|
||||
Symbol newLabel =
|
||||
createLabel(newAddress, symbol.getName(), symbol.getParentNamespace(),
|
||||
symbol.getSource());
|
||||
Symbol newLabel = createLabel(newAddress, symbol.getName(),
|
||||
symbol.getParentNamespace(), symbol.getSource());
|
||||
newLabel.setPinned(true);
|
||||
}
|
||||
catch (InvalidInputException e) {
|
||||
|
@ -2683,8 +2678,8 @@ public class SymbolManager implements SymbolTable, ManagerDB {
|
|||
return classNamespace;
|
||||
}
|
||||
catch (DuplicateNameException | InvalidInputException | CircularDependencyException e) {
|
||||
throw new AssertException("Unexpected exception creating class from namespace: " +
|
||||
e.getMessage(), e);
|
||||
throw new AssertException(
|
||||
"Unexpected exception creating class from namespace: " + e.getMessage(), e);
|
||||
}
|
||||
finally {
|
||||
lock.release();
|
||||
|
@ -2953,9 +2948,8 @@ public class SymbolManager implements SymbolTable, ManagerDB {
|
|||
// delete any promoted symbol, dynamic symbol, and make sure all others are not primary
|
||||
cleanUpSymbols(addr, symbolToPromote, primary);
|
||||
|
||||
Symbol symbol =
|
||||
doCreateSymbol(name, addr, namespace, SymbolType.FUNCTION, stringData, null, null,
|
||||
source, true);
|
||||
Symbol symbol = doCreateSymbol(name, addr, namespace, SymbolType.FUNCTION, stringData, null,
|
||||
null, source, true);
|
||||
|
||||
if (needsPinning) {
|
||||
symbol.setPinned(true);
|
||||
|
@ -3023,9 +3017,8 @@ public class SymbolManager implements SymbolTable, ManagerDB {
|
|||
boolean isPrimary) {
|
||||
|
||||
try {
|
||||
DBRecord record =
|
||||
adapter.createSymbol(name, addr, namespace.getID(), type, stringData, dataTypeId,
|
||||
variableOffset, source, isPrimary);
|
||||
DBRecord record = adapter.createSymbol(name, addr, namespace.getID(), type, stringData,
|
||||
dataTypeId, variableOffset, source, isPrimary);
|
||||
|
||||
SymbolDB newSymbol = makeSymbol(addr, record, type);
|
||||
symbolAdded(newSymbol);
|
||||
|
@ -3037,8 +3030,7 @@ public class SymbolManager implements SymbolTable, ManagerDB {
|
|||
return null;
|
||||
}
|
||||
|
||||
private String validateName(String name, SourceType source)
|
||||
throws InvalidInputException {
|
||||
private String validateName(String name, SourceType source) throws InvalidInputException {
|
||||
if (source == SourceType.DEFAULT) {
|
||||
return "";
|
||||
}
|
||||
|
|
|
@ -23,7 +23,7 @@ import ghidra.program.database.ProgramDB;
|
|||
import ghidra.program.database.map.AddressMap;
|
||||
import ghidra.program.model.address.*;
|
||||
import ghidra.program.model.util.AddressSetPropertyMap;
|
||||
import ghidra.program.util.ChangeManager;
|
||||
import ghidra.program.util.ProgramEvent;
|
||||
import ghidra.util.Lock;
|
||||
import ghidra.util.exception.CancelledException;
|
||||
import ghidra.util.exception.DuplicateNameException;
|
||||
|
@ -99,7 +99,7 @@ public class AddressSetPropertyMapDB implements AddressSetPropertyMap {
|
|||
lock.acquire();
|
||||
try {
|
||||
propertyMap.paintRange(startAddr, endAddr, FIELD);
|
||||
program.setChanged(ChangeManager.DOCR_ADDRESS_SET_PROPERTY_MAP_CHANGED, null, mapName);
|
||||
program.setChanged(ProgramEvent.ADDRESS_PROPERTY_MAP_CHANGED, null, mapName);
|
||||
}
|
||||
finally {
|
||||
lock.release();
|
||||
|
@ -121,7 +121,7 @@ public class AddressSetPropertyMapDB implements AddressSetPropertyMap {
|
|||
AddressRange range = iter.next();
|
||||
add(range.getMinAddress(), range.getMaxAddress());
|
||||
}
|
||||
program.setChanged(ChangeManager.DOCR_ADDRESS_SET_PROPERTY_MAP_CHANGED, null, mapName);
|
||||
program.setChanged(ProgramEvent.ADDRESS_PROPERTY_MAP_CHANGED, null, mapName);
|
||||
}
|
||||
finally {
|
||||
lock.release();
|
||||
|
@ -138,7 +138,7 @@ public class AddressSetPropertyMapDB implements AddressSetPropertyMap {
|
|||
try {
|
||||
clear();
|
||||
add(addressSet);
|
||||
program.setChanged(ChangeManager.DOCR_ADDRESS_SET_PROPERTY_MAP_CHANGED, null, mapName);
|
||||
program.setChanged(ProgramEvent.ADDRESS_PROPERTY_MAP_CHANGED, null, mapName);
|
||||
}
|
||||
finally {
|
||||
lock.release();
|
||||
|
@ -154,7 +154,7 @@ public class AddressSetPropertyMapDB implements AddressSetPropertyMap {
|
|||
lock.acquire();
|
||||
try {
|
||||
propertyMap.clearRange(startAddr, endAddr);
|
||||
program.setChanged(ChangeManager.DOCR_ADDRESS_SET_PROPERTY_MAP_CHANGED, null, mapName);
|
||||
program.setChanged(ProgramEvent.ADDRESS_PROPERTY_MAP_CHANGED, null, mapName);
|
||||
}
|
||||
finally {
|
||||
lock.release();
|
||||
|
@ -175,7 +175,7 @@ public class AddressSetPropertyMapDB implements AddressSetPropertyMap {
|
|||
AddressRange range = iter.next();
|
||||
remove(range.getMinAddress(), range.getMaxAddress());
|
||||
}
|
||||
program.setChanged(ChangeManager.DOCR_ADDRESS_SET_PROPERTY_MAP_CHANGED, null, mapName);
|
||||
program.setChanged(ProgramEvent.ADDRESS_PROPERTY_MAP_CHANGED, null, mapName);
|
||||
}
|
||||
finally {
|
||||
lock.release();
|
||||
|
@ -240,7 +240,7 @@ public class AddressSetPropertyMapDB implements AddressSetPropertyMap {
|
|||
lock.acquire();
|
||||
try {
|
||||
propertyMap.dispose();
|
||||
program.setChanged(ChangeManager.DOCR_ADDRESS_SET_PROPERTY_MAP_CHANGED, null, mapName);
|
||||
program.setChanged(ProgramEvent.ADDRESS_PROPERTY_MAP_CHANGED, null, mapName);
|
||||
}
|
||||
finally {
|
||||
lock.release();
|
||||
|
|
|
@ -26,15 +26,15 @@ import ghidra.program.model.data.DataTypeManagerDomainObject;
|
|||
public interface DataTypeArchive extends DataTypeManagerDomainObject {
|
||||
|
||||
/** Name of data type archive information property list */
|
||||
public static final String DATA_TYPE_ARCHIVE_INFO = "Data Type Archive Information";
|
||||
/** Name of data type archive settings property list */
|
||||
public static final String DATA_TYPE_ARCHIVE_SETTINGS = "Data Type Archive Settings";
|
||||
/** Name of date created property */
|
||||
public static final String DATE_CREATED = "Date Created";
|
||||
public static final String DATA_TYPE_ARCHIVE_INFO = "Data Type Archive Information";
|
||||
/** Name of data type archive settings property list */
|
||||
public static final String DATA_TYPE_ARCHIVE_SETTINGS = "Data Type Archive Settings";
|
||||
/** Name of date created property */
|
||||
public static final String DATE_CREATED = "Date Created";
|
||||
/** Name of ghidra version property */
|
||||
public static final String CREATED_WITH_GHIDRA_VERSION = "Created With Ghidra Version";
|
||||
public static final String CREATED_WITH_GHIDRA_VERSION = "Created With Ghidra Version";
|
||||
/** A date from January 1, 1970 */
|
||||
public static final Date JANUARY_1_1970 = new Date(0);
|
||||
public static final Date JANUARY_1_1970 = new Date(0);
|
||||
|
||||
/**
|
||||
* Determine if this archive has exclusive-write access which may be neccessary for some
|
||||
|
@ -48,42 +48,20 @@ public interface DataTypeArchive extends DataTypeManagerDomainObject {
|
|||
* @return default pointer size.
|
||||
*/
|
||||
public int getDefaultPointerSize();
|
||||
|
||||
/**
|
||||
* Returns the creation date of this data type archive.
|
||||
* existed, then Jan 1, 1970 is returned.
|
||||
* @return the creation date of this data type archive
|
||||
*/
|
||||
public Date getCreationDate();
|
||||
|
||||
/**
|
||||
* Get the data type archive changes since the last save as a set of addresses.
|
||||
* @return set of changed addresses within program.
|
||||
*/
|
||||
public DataTypeArchiveChangeSet getChanges();
|
||||
|
||||
/**
|
||||
* Mark the state this data type archive as having changed and generate
|
||||
* the event. Any or all parameters may be null.
|
||||
* @param type event type
|
||||
* @param oldValue original value
|
||||
* @param newValue new value
|
||||
*/
|
||||
public void setChanged(int type, Object oldValue, Object newValue);
|
||||
* Returns the creation date of this data type archive.
|
||||
* existed, then Jan 1, 1970 is returned.
|
||||
* @return the creation date of this data type archive
|
||||
*/
|
||||
public Date getCreationDate();
|
||||
|
||||
/**
|
||||
* Get the data type archive changes since the last save as a set of addresses.
|
||||
* @return set of changed addresses within program.
|
||||
*/
|
||||
public DataTypeArchiveChangeSet getChanges();
|
||||
|
||||
/**
|
||||
* Mark the state of a data type archive as having changed and generate
|
||||
* the event. Any or all parameters may be null.
|
||||
* @param type event type
|
||||
* @param affectedObj object that is the subject of the event
|
||||
* @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
|
||||
* the event
|
||||
*/
|
||||
public void setObjChanged(int type, Object affectedObj, Object oldValue,
|
||||
Object newValue);
|
||||
|
||||
/**
|
||||
* Invalidates any caching in a data type archive.
|
||||
* NOTE: Over-using this method can adversely affect system performance.
|
||||
|
@ -91,5 +69,5 @@ public interface DataTypeArchive extends DataTypeManagerDomainObject {
|
|||
public void invalidate();
|
||||
|
||||
public void updateID();
|
||||
|
||||
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -16,7 +16,6 @@
|
|||
package ghidra.program.util;
|
||||
|
||||
import ghidra.program.model.address.Address;
|
||||
import ghidra.program.model.address.AddressSetView;
|
||||
import ghidra.program.model.lang.Register;
|
||||
|
||||
/**
|
||||
|
@ -24,45 +23,6 @@ import ghidra.program.model.lang.Register;
|
|||
*/
|
||||
public class ChangeManagerAdapter implements ChangeManager {
|
||||
|
||||
@Override
|
||||
public void setChanged(int type, Address start, Address end, Object oldValue, Object newValue) {
|
||||
// Default implementation does nothing.
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setChanged(int type, Object oldValue, Object newValue) {
|
||||
// Default implementation does nothing.
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setObjChanged(int type, Address addr, Object affectedObj, Object oldValue,
|
||||
Object newValue) {
|
||||
// Default implementation does nothing.
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setObjChanged(int type, int subType, Address addr, Object affectedObj,
|
||||
Object oldValue, Object newValue) {
|
||||
// Default implementation does nothing.
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setObjChanged(int type, AddressSetView addrSet, Object affectedObj, Object oldValue,
|
||||
Object newValue) {
|
||||
// Default implementation does nothing.
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setObjChanged(int type, Object affectedObj, Object oldValue, Object newValue) {
|
||||
// Default implementation does nothing.
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setObjChanged(int type, int subType, Object affectedObj, Object oldValue,
|
||||
Object newValue) {
|
||||
// Default implementation does nothing.
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPropertyChanged(String propertyName, Address codeUnitAddr, Object oldValue,
|
||||
Object newValue) {
|
||||
|
@ -79,4 +39,27 @@ public class ChangeManagerAdapter implements ChangeManager {
|
|||
// Default implementation does nothing.
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setChanged(ProgramEvent event, Object oldValue, Object newValue) {
|
||||
// Default implementation does nothing.
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setChanged(ProgramEvent event, Address start, Address end, Object oldValue,
|
||||
Object newValue) {
|
||||
// Default implementation does nothing.
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setObjChanged(ProgramEvent event, Object affected, Object oldValue,
|
||||
Object newValue) {
|
||||
// Default implementation does nothing.
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setObjChanged(ProgramEvent eventType, Address addr, Object affected,
|
||||
Object oldValue, Object newValue) {
|
||||
// Default implementation does nothing.
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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,97 +15,66 @@
|
|||
*/
|
||||
package ghidra.program.util;
|
||||
|
||||
import ghidra.framework.model.DomainObjectChangeRecord;
|
||||
import ghidra.program.model.address.Address;
|
||||
|
||||
/**
|
||||
* Change record generated when a property on a code unit changes.
|
||||
*/
|
||||
public class CodeUnitPropertyChangeRecord extends DomainObjectChangeRecord {
|
||||
public class CodeUnitPropertyChangeRecord extends ProgramChangeRecord {
|
||||
private String propertyName;
|
||||
|
||||
private final static long serialVersionUID = 1;
|
||||
private Object oldValue;
|
||||
private Object newValue;
|
||||
private String propertyName;
|
||||
private Address addr;
|
||||
private Address startAddr;
|
||||
private Address endAddr;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
* @param propertyName name of the property
|
||||
* @param codeUnitAddr address of the code unit
|
||||
* @param oldValue old value
|
||||
* @param newValue new value
|
||||
*/
|
||||
public CodeUnitPropertyChangeRecord(String propertyName,
|
||||
Address codeUnitAddr,
|
||||
Object oldValue,
|
||||
Object newValue) {
|
||||
super(ChangeManager.DOCR_CODE_UNIT_PROPERTY_CHANGED);
|
||||
this.propertyName = propertyName;
|
||||
addr = codeUnitAddr;
|
||||
this.oldValue = oldValue;
|
||||
this.newValue = newValue;
|
||||
}
|
||||
/**
|
||||
* Constructor for change record for removing a range of properties.
|
||||
* @param propertyName name of the property
|
||||
* @param start start of the range of properties being removed
|
||||
* @param end end of the range of properties being removed
|
||||
* Constructor
|
||||
* @param type the program event type
|
||||
* @param propertyName the name of the code unit property
|
||||
* @param start the start address of the effected range
|
||||
* @param end the end address of the effected range
|
||||
* @param oldValue the old property value
|
||||
* @param newValue the new property value
|
||||
*/
|
||||
public CodeUnitPropertyChangeRecord(String propertyName,
|
||||
Address start, Address end) {
|
||||
super(ChangeManager.DOCR_CODE_UNIT_PROPERTY_RANGE_REMOVED);
|
||||
private CodeUnitPropertyChangeRecord(ProgramEvent type, String propertyName, Address start,
|
||||
Address end, Object oldValue, Object newValue) {
|
||||
super(type, start, end, null, oldValue, newValue);
|
||||
this.propertyName = propertyName;
|
||||
startAddr = start;
|
||||
endAddr = end;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the name of the property being changed.
|
||||
*/
|
||||
public String getPropertyName() {
|
||||
return propertyName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the address of the code unit for this property change.
|
||||
*/
|
||||
public Address getAddress() {
|
||||
return addr;
|
||||
}
|
||||
/**
|
||||
* Constructor for a property change at an address
|
||||
* @param type the program event type
|
||||
* @param propertyName the name of the code unit property
|
||||
* @param address the address of the of the property that was changed.
|
||||
* @param oldValue the old property value
|
||||
* @param newValue the new property value
|
||||
*/
|
||||
public CodeUnitPropertyChangeRecord(ProgramEvent type, String propertyName, Address address,
|
||||
Object oldValue, Object newValue) {
|
||||
this(type, propertyName, address, address, oldValue, newValue);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the original value.
|
||||
*/
|
||||
@Override
|
||||
public Object getOldValue() {
|
||||
return oldValue;
|
||||
}
|
||||
/**
|
||||
* Constructor for events that affect a range of values
|
||||
* @param type the program event type
|
||||
* @param propertyName the name of the code unit property
|
||||
* @param start the start address of the range affected
|
||||
* @param end the end address of the range affected
|
||||
*/
|
||||
public CodeUnitPropertyChangeRecord(ProgramEvent type, String propertyName, Address start,
|
||||
Address end) {
|
||||
this(type, propertyName, start, end, null, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the new value.
|
||||
*/
|
||||
@Override
|
||||
public Object getNewValue() {
|
||||
return newValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the start address of the range of properties that were removed.
|
||||
* @return null if the event type is not
|
||||
* ChangeManager.DOCR_CODE_UNIT_PROPERTY_RANGE_REMOVED
|
||||
*/
|
||||
public Address getStartAddress() {
|
||||
return startAddr;
|
||||
}
|
||||
/**
|
||||
* Get the end address of the range of properties that were removed.
|
||||
* @return null if the event type is not
|
||||
* ChangeManager.DOCR_CODE_UNIT_PROPERTY_RANGE_REMOVED
|
||||
*/
|
||||
public Address getEndAddress() {
|
||||
return endAddr;
|
||||
}
|
||||
/**
|
||||
* Get the name of the property being changed.
|
||||
* @return the name of the property being changed
|
||||
*/
|
||||
public String getPropertyName() {
|
||||
return propertyName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder builder = new StringBuilder(super.toString());
|
||||
builder.append(", property = " + propertyName);
|
||||
return builder.toString();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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.
|
||||
|
@ -21,58 +20,48 @@ import ghidra.program.model.address.Address;
|
|||
|
||||
public class CodeUnitUserDataChangeRecord extends DomainObjectChangeRecord {
|
||||
|
||||
private final static long serialVersionUID = 1;
|
||||
private Object oldValue;
|
||||
private Object newValue;
|
||||
private String propertyName;
|
||||
private Address addr;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
* @param propertyName name of the property
|
||||
* @param codeUnitAddr address of the code unit
|
||||
* @param oldValue old value
|
||||
* @param newValue new value
|
||||
*/
|
||||
public CodeUnitUserDataChangeRecord(String propertyName,
|
||||
Address codeUnitAddr,
|
||||
Object oldValue,
|
||||
Object newValue) {
|
||||
super(ChangeManager.DOCR_CODE_UNIT_USER_DATA_CHANGED);
|
||||
this.propertyName = propertyName;
|
||||
addr = codeUnitAddr;
|
||||
this.oldValue = oldValue;
|
||||
this.newValue = newValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the name of the property being changed.
|
||||
*/
|
||||
public String getPropertyName() {
|
||||
return propertyName;
|
||||
}
|
||||
private String propertyName;
|
||||
private Address address;
|
||||
|
||||
/**
|
||||
* Get the address of the code unit for this property change.
|
||||
*/
|
||||
public Address getAddress() {
|
||||
return addr;
|
||||
}
|
||||
/**
|
||||
* Constructor
|
||||
* @param propertyName name of the property
|
||||
* @param codeUnitAddr address of the code unit
|
||||
* @param oldValue old value
|
||||
* @param newValue new value
|
||||
*/
|
||||
public CodeUnitUserDataChangeRecord(String propertyName, Address codeUnitAddr, Object oldValue,
|
||||
Object newValue) {
|
||||
super(ProgramEvent.CODE_UNIT_USER_DATA_CHANGED, oldValue, newValue);
|
||||
this.propertyName = propertyName;
|
||||
address = codeUnitAddr;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the original value.
|
||||
*/
|
||||
@Override
|
||||
public Object getOldValue() {
|
||||
return oldValue;
|
||||
}
|
||||
/**
|
||||
* Get the name of the property being changed.
|
||||
* @return the name of the property being changed
|
||||
*/
|
||||
public String getPropertyName() {
|
||||
return propertyName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the address of the code unit for this property change.
|
||||
* @return the address of the code unit for this property change
|
||||
*/
|
||||
public Address getAddress() {
|
||||
return address;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder builder = new StringBuilder(super.toString());
|
||||
builder.append(", property = " + propertyName);
|
||||
if (address != null) {
|
||||
builder.append(", address = ");
|
||||
builder.append(address);
|
||||
}
|
||||
return builder.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the new value.
|
||||
*/
|
||||
@Override
|
||||
public Object getNewValue() {
|
||||
return newValue;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,65 @@
|
|||
/* ###
|
||||
* 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.program.util;
|
||||
|
||||
import ghidra.program.model.address.Address;
|
||||
import ghidra.program.model.listing.CodeUnit;
|
||||
|
||||
/**
|
||||
* Change record for comment changes
|
||||
*/
|
||||
public class CommentChangeRecord extends ProgramChangeRecord {
|
||||
|
||||
// types defined in CodeUnit
|
||||
private int commentType;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
* @param commentType the type of comment (as defined in {@link CodeUnit})
|
||||
* @param address the address of the comment change
|
||||
* @param oldValue the old comment (may be null for a new comment)
|
||||
* @param newValue the new comment (may be null if the comment was deleted)
|
||||
*/
|
||||
public CommentChangeRecord(int commentType, Address address, String oldValue, String newValue) {
|
||||
super(ProgramEvent.COMMENT_CHANGED, address, address, null, oldValue, newValue);
|
||||
this.commentType = commentType;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the comment type as defined in {@link CodeUnit}.
|
||||
* @return the comment type
|
||||
*/
|
||||
public int getCommentType() {
|
||||
return commentType;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the previous comment or null if there was no previous comment.
|
||||
* @return the previous comment or null if there was no previous comment.
|
||||
*/
|
||||
public String getOldComment() {
|
||||
return (String) getOldValue();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the new comment or null if this is a result of deleting the comment.
|
||||
* @return the new comment or null if this is a result of deleting the comment
|
||||
*/
|
||||
public String getNewComment() {
|
||||
return (String) getNewValue();
|
||||
}
|
||||
|
||||
}
|
|
@ -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,108 +15,95 @@
|
|||
*/
|
||||
package ghidra.program.util;
|
||||
|
||||
import static ghidra.program.util.ProgramEvent.*;
|
||||
|
||||
/**
|
||||
* Interface to define event types and the method to generate an
|
||||
* event within Program.
|
||||
*/
|
||||
public interface DataTypeArchiveChangeManager {
|
||||
|
||||
// event types
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// CATEGORY and DATA
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
* Category was added.
|
||||
*/
|
||||
public static final int DOCR_CATEGORY_ADDED = 100;
|
||||
|
||||
/**
|
||||
* Category was removed.
|
||||
*/
|
||||
public static final int DOCR_CATEGORY_REMOVED = 101;
|
||||
|
||||
/**
|
||||
* Category was renamed.
|
||||
*/
|
||||
public static final int DOCR_CATEGORY_RENAMED = 102;
|
||||
|
||||
/**
|
||||
* Category was moved.
|
||||
*/
|
||||
public static final int DOCR_CATEGORY_MOVED = 103;
|
||||
|
||||
/**
|
||||
* Data type was added to a category.
|
||||
*/
|
||||
public static final int DOCR_DATA_TYPE_ADDED = 104;
|
||||
|
||||
/**
|
||||
* Data type was removed from a category.
|
||||
*/
|
||||
public static final int DOCR_DATA_TYPE_REMOVED = 105;
|
||||
|
||||
/**
|
||||
* Data Type was renamed.
|
||||
*/
|
||||
public static final int DOCR_DATA_TYPE_RENAMED = 106;
|
||||
|
||||
/**
|
||||
* Data type was moved to another category.
|
||||
*/
|
||||
public static final int DOCR_DATA_TYPE_MOVED = 107;
|
||||
|
||||
/**
|
||||
* Data type was updated.
|
||||
*/
|
||||
public static final int DOCR_DATA_TYPE_CHANGED = 108;
|
||||
|
||||
/**
|
||||
* The settings on a data type were updated.
|
||||
*/
|
||||
public static final int DOCR_DATA_TYPE_SETTING_CHANGED = 109;
|
||||
|
||||
/**
|
||||
* Data type was replaced in a category.
|
||||
*/
|
||||
public static final int DOCR_DATA_TYPE_REPLACED = 110;
|
||||
|
||||
/**
|
||||
* A custom format for a data type was added.
|
||||
*/
|
||||
public final static int DOCR_CUSTOM_FORMAT_ADDED = 163;
|
||||
|
||||
/**
|
||||
* A custom format for a data type was removed.
|
||||
*/
|
||||
public final static int DOCR_CUSTOM_FORMAT_REMOVED = 164;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Deprecated data type archive event types
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
* Mark the state of a Data Type Archive 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
|
||||
* the event
|
||||
*/
|
||||
public void setChanged(int type, Object oldValue, Object newValue);
|
||||
|
||||
/**
|
||||
* Mark the state of a Data Type Archive as having changed and generate
|
||||
* the event of the specified type. Any or all parameters may be null.
|
||||
* @param type event type
|
||||
* @param affectedObj object that is the subject of the event
|
||||
* @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
|
||||
* the event
|
||||
*/
|
||||
public void setObjChanged(int type,
|
||||
Object affectedObj, Object oldValue, Object newValue);
|
||||
|
||||
* Category was added.
|
||||
* @deprecated Event type numeric constants have been changed to enums. Use the enum directly.
|
||||
*/
|
||||
@Deprecated
|
||||
public static final ProgramEvent DOCR_CATEGORY_ADDED = DATA_TYPE_CATEGORY_ADDED;
|
||||
|
||||
/**
|
||||
* Category was removed.
|
||||
* @deprecated Event type numeric constants have been changed to enums. Use the enum directly.
|
||||
*/
|
||||
@Deprecated
|
||||
public static final ProgramEvent DOCR_CATEGORY_REMOVED = DATA_TYPE_CATEGORY_REMOVED;
|
||||
|
||||
/**
|
||||
* Category was renamed.
|
||||
* @deprecated Event type numeric constants have been changed to enums. Use the enum directly.
|
||||
*/
|
||||
@Deprecated
|
||||
public static final ProgramEvent DOCR_CATEGORY_RENAMED = DATA_TYPE_CATEGORY_RENAMED;
|
||||
|
||||
/**
|
||||
* Category was moved.
|
||||
* @deprecated Event type numeric constants have been changed to enums. Use the enum directly.
|
||||
*/
|
||||
@Deprecated
|
||||
public static final ProgramEvent DOCR_CATEGORY_MOVED = DATA_TYPE_CATEGORY_MOVED;
|
||||
|
||||
/**
|
||||
* Data type was added to a category.
|
||||
* @deprecated Event type numeric constants have been changed to enums. Use the enum directly.
|
||||
*/
|
||||
@Deprecated
|
||||
public static final ProgramEvent DOCR_DATA_TYPE_ADDED = DATA_TYPE_ADDED;
|
||||
|
||||
/**
|
||||
* Data type was removed from a category.
|
||||
* @deprecated Event type numeric constants have been changed to enums. Use the enum directly.
|
||||
*/
|
||||
@Deprecated
|
||||
public static final ProgramEvent DOCR_DATA_TYPE_REMOVED = DATA_TYPE_REMOVED;
|
||||
|
||||
/**
|
||||
* Data Type was renamed.
|
||||
* @deprecated Event type numeric constants have been changed to enums. Use the enum directly.
|
||||
*/
|
||||
@Deprecated
|
||||
public static final ProgramEvent DOCR_DATA_TYPE_RENAMED = DATA_TYPE_RENAMED;
|
||||
|
||||
/**
|
||||
* Data type was moved to another category.
|
||||
* @deprecated Event type numeric constants have been changed to enums. Use the enum directly.
|
||||
*/
|
||||
@Deprecated
|
||||
public static final ProgramEvent DOCR_DATA_TYPE_MOVED = DATA_TYPE_MOVED;
|
||||
|
||||
/**
|
||||
* Data type was updated.
|
||||
* @deprecated Event type numeric constants have been changed to enums. Use the enum directly.
|
||||
*/
|
||||
@Deprecated
|
||||
public static final ProgramEvent DOCR_DATA_TYPE_CHANGED = DATA_TYPE_CHANGED;
|
||||
|
||||
/**
|
||||
* The settings on a data type were updated.
|
||||
* @deprecated Event type numeric constants have been changed to enums. Use the enum directly.
|
||||
*/
|
||||
@Deprecated
|
||||
public static final ProgramEvent DOCR_DATA_TYPE_SETTING_CHANGED = DATA_TYPE_SETTING_CHANGED;
|
||||
|
||||
/**
|
||||
* Data type was replaced in a category.
|
||||
* @deprecated Event type numeric constants have been changed to enums. Use the enum directly.
|
||||
*/
|
||||
@Deprecated
|
||||
public static final ProgramEvent DOCR_DATA_TYPE_REPLACED = DATA_TYPE_REPLACED;
|
||||
|
||||
}
|
||||
|
|
|
@ -1,55 +0,0 @@
|
|||
/* ###
|
||||
* 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.
|
||||
* 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.program.util;
|
||||
|
||||
import ghidra.framework.model.DomainObjectChangeRecord;
|
||||
|
||||
/**
|
||||
* Event data for a DomainObjectChangeEvent generated by a Data Type Archive.
|
||||
* <p>See <a href="doc-files/events.html">Data Type Archive Events</a> for more
|
||||
* information on event data.
|
||||
*</p>
|
||||
*/
|
||||
public class DataTypeArchiveChangeRecord extends DomainObjectChangeRecord {
|
||||
private final static long serialVersionUID = 1;
|
||||
|
||||
private Object affectedObj; // may be null
|
||||
|
||||
/**
|
||||
* Construct a new DataTypeArchiveChangeRecord;
|
||||
* the <code>affectedObj</code> parameter may be null,
|
||||
* depending on what the <code>type</code> parameter is.
|
||||
* @param type event type
|
||||
* @param affectedObj the object affected by the change
|
||||
* @param oldValue original value
|
||||
* @param newValue new value
|
||||
*/
|
||||
public DataTypeArchiveChangeRecord(int type, Object affectedObj, Object oldValue, Object newValue) {
|
||||
super(type, oldValue, newValue);
|
||||
this.affectedObj = affectedObj;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the object that is the subject of this change record.
|
||||
*
|
||||
* @return Object null if this change record does not have the
|
||||
* affected object
|
||||
*/
|
||||
public Object getObject() {
|
||||
return affectedObj;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,86 @@
|
|||
/* ###
|
||||
* 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.program.util;
|
||||
|
||||
import ghidra.program.model.listing.Function;
|
||||
|
||||
public class FunctionChangeRecord extends ProgramChangeRecord {
|
||||
/**
|
||||
* Specific function changes types for when the ProgramEvent is FUNCTION_CHANGED
|
||||
*/
|
||||
public enum FunctionChangeType {
|
||||
PURGE_CHANGED, // a function's purge value changed
|
||||
INLINE_CHANGED, // a function's inline status changed
|
||||
NO_RETURN_CHANGED, // a function's no return status changed
|
||||
CALL_FIXUP_CHANGED, // a function's call fixup changed
|
||||
RETURN_TYPE_CHANGED, // a function's return type changed
|
||||
PARAMETERS_CHANGED, // a function's parameters changed
|
||||
THUNK_CHANGED, // a function's thunk status changed
|
||||
UNSPECIFIED // a specific function change was not specified
|
||||
}
|
||||
|
||||
private FunctionChangeType changeType;
|
||||
|
||||
/**
|
||||
* Constructs a new Function change record.
|
||||
* @param function the function that was changed
|
||||
* @param changeType the specific type of change that was applied to the function
|
||||
*/
|
||||
public FunctionChangeRecord(Function function, FunctionChangeType changeType) {
|
||||
super(ProgramEvent.FUNCTION_CHANGED, function.getEntryPoint(), function.getEntryPoint(),
|
||||
function, null, null);
|
||||
this.changeType = changeType == null ? FunctionChangeType.UNSPECIFIED : changeType;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the specific type of function change.
|
||||
* @return the specific type of function change
|
||||
*/
|
||||
public FunctionChangeType getSpecificChangeType() {
|
||||
return changeType;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the function that was changed.
|
||||
* @return the function that was changed
|
||||
*/
|
||||
public Function getFunction() {
|
||||
return (Function) getObject();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the specific change was related to the function signature.
|
||||
* @return true if the specific change was related to the function signature
|
||||
*/
|
||||
public boolean isFunctionSignatureChange() {
|
||||
return changeType == FunctionChangeType.PARAMETERS_CHANGED ||
|
||||
changeType == FunctionChangeType.RETURN_TYPE_CHANGED;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the specific change was to one of the function's modifier properties.
|
||||
* @return true if the specific change was to one of the function's modifier properties
|
||||
*/
|
||||
public boolean isFunctionModifierChange() {
|
||||
// @formatter:off
|
||||
return changeType == FunctionChangeType.THUNK_CHANGED ||
|
||||
changeType == FunctionChangeType.INLINE_CHANGED ||
|
||||
changeType == FunctionChangeType.NO_RETURN_CHANGED ||
|
||||
changeType == FunctionChangeType.CALL_FIXUP_CHANGED ||
|
||||
changeType == FunctionChangeType.PURGE_CHANGED;
|
||||
// @formatter:on
|
||||
}
|
||||
}
|
|
@ -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.
|
||||
|
@ -17,65 +16,50 @@
|
|||
package ghidra.program.util;
|
||||
|
||||
import ghidra.framework.model.DomainObjectChangeRecord;
|
||||
import ghidra.framework.model.EventType;
|
||||
import ghidra.program.model.address.Address;
|
||||
|
||||
/**
|
||||
* Event data for a DomainObjectChangeEvent generated by a Program.
|
||||
* <p>See <a href="doc-files/events.html">Program Events</a> for more
|
||||
* information on event data.
|
||||
*</p>
|
||||
*/
|
||||
public class ProgramChangeRecord extends DomainObjectChangeRecord {
|
||||
private final static long serialVersionUID = 1;
|
||||
|
||||
private Address start;
|
||||
private Address end;
|
||||
private Object affectedObj; // may be null
|
||||
private Object affectedObj;
|
||||
|
||||
/**
|
||||
* Construct a new ProgramChangeRecord; any of the Address or
|
||||
* Object params may be null, depending on what the type param is.
|
||||
* @param type event type
|
||||
* @param eventType event type
|
||||
* @param start starting address that is affected by the event
|
||||
* @param end ending address that is affected by the event
|
||||
* @param affected the object that was affected by this change, if applicable
|
||||
* @param oldValue original value
|
||||
* @param newValue new value
|
||||
*/
|
||||
public ProgramChangeRecord(int type, Address start, Address end, Object affectedObj,
|
||||
public ProgramChangeRecord(ProgramEvent eventType, Address start, Address end, Object affected,
|
||||
Object oldValue, Object newValue) {
|
||||
super(type, oldValue, newValue);
|
||||
super(eventType, oldValue, newValue);
|
||||
this.start = start;
|
||||
this.end = end;
|
||||
this.affectedObj = affectedObj;
|
||||
this.affectedObj = affected;
|
||||
}
|
||||
|
||||
public ProgramChangeRecord(ProgramEvent eventType, Object oldValue, Object newValue) {
|
||||
this(eventType, null, null, null, oldValue, newValue);
|
||||
}
|
||||
|
||||
/**
|
||||
* Construct a new ProgramChangeRecord; any of the Address or
|
||||
* Object params may be null, depending on what the type param is.
|
||||
* @param type event type
|
||||
* @param subType event sub-type
|
||||
* @param start starting address that is affected by the event
|
||||
* @param end ending address that is affected by the event
|
||||
* @param oldValue original value
|
||||
* @param newValue new value
|
||||
*/
|
||||
public ProgramChangeRecord(int type, int subType, Address start, Address end,
|
||||
Object affectedObj, Object oldValue, Object newValue) {
|
||||
super(type, subType, oldValue, newValue);
|
||||
this.start = start;
|
||||
this.end = end;
|
||||
this.affectedObj = affectedObj;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the start address.
|
||||
* Get the start address of the affected addresses of this change or null if not applicable.
|
||||
* @return the start address of the effected address of this change
|
||||
*/
|
||||
public Address getStart() {
|
||||
return start;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the end address.
|
||||
* Get the end address of the affected addresses of this change or null if not applicable.
|
||||
* @return the end address of the effected address of this change
|
||||
*/
|
||||
public Address getEnd() {
|
||||
return end;
|
||||
|
@ -83,11 +67,28 @@ public class ProgramChangeRecord extends DomainObjectChangeRecord {
|
|||
|
||||
/**
|
||||
* Return the object that is the subject of this change record.
|
||||
*
|
||||
* @return Object null if this change record does not have the
|
||||
* affected object
|
||||
* @return the object affected or null if not applicable
|
||||
*/
|
||||
public Object getObject() {
|
||||
return affectedObj;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder builder = new StringBuilder(super.toString());
|
||||
if (affectedObj != null) {
|
||||
builder.append(", affected = " + affectedObj);
|
||||
}
|
||||
if (start != null) {
|
||||
builder.append(", start = ");
|
||||
builder.append(start);
|
||||
}
|
||||
if (end != null) {
|
||||
builder.append(", end = ");
|
||||
builder.append(end);
|
||||
|
||||
}
|
||||
return builder.toString();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,159 @@
|
|||
/* ###
|
||||
* 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.program.util;
|
||||
|
||||
import ghidra.framework.model.DomainObjectEventIdGenerator;
|
||||
import ghidra.framework.model.EventType;
|
||||
import ghidra.program.model.listing.Program;
|
||||
|
||||
/**
|
||||
* Event types for {@link Program} changes.
|
||||
*/
|
||||
public enum ProgramEvent implements EventType {
|
||||
MEMORY_BLOCK_ADDED, // memory block added
|
||||
MEMORY_BLOCK_REMOVED, // memory block removed
|
||||
MEMORY_BLOCK_CHANGED, // memory block property changed
|
||||
MEMORY_BLOCK_MOVED, // memory block start address changed
|
||||
MEMORY_BLOCK_SPLIT, // memory block split into two blocks
|
||||
MEMORY_BLOCKS_JOINED, // memory blocks joined into one block
|
||||
MEMORY_BYTES_CHANGED, // memory bytes changed
|
||||
|
||||
IMAGE_BASE_CHANGED, // image base changed
|
||||
|
||||
CODE_ADDED, // instructions or data set at an address
|
||||
CODE_REMOVED, // instructions or data cleared at an address
|
||||
CODE_REPLACED, // the instruction or data type at an address was changed
|
||||
|
||||
COMPOSITE_ADDED, // a non-primitive data type was added
|
||||
COMPOSITE_REMOVED, // a non-primitive data type was removed
|
||||
|
||||
CODE_UNIT_PROPERTY_CHANGED, // a property map value changed
|
||||
CODE_UNIT_PROPERTY_ALL_REMOVED, // a property map was removed
|
||||
CODE_UNIT_PROPERTY_RANGE_REMOVED, // a ranges of values was removed
|
||||
|
||||
SYMBOL_ADDED, // a symbol was added
|
||||
SYMBOL_REMOVED, // a symbol was removed
|
||||
SYMBOL_SOURCE_CHANGED, // a symbol's source was changed
|
||||
SYMBOL_ANCHOR_FLAG_CHANGED, // a symbol's pinned status was changed
|
||||
SYMBOL_PRIMARY_STATE_CHANGED, // a symbol primary status changed
|
||||
SYMBOL_RENAMED, // a symbol was renamed
|
||||
SYMBOL_SCOPE_CHANGED, // the set of addresses associated with a symbol changed
|
||||
SYMBOL_ASSOCIATION_ADDED, // a symbol association was added to a reference
|
||||
SYMBOL_ASSOCIATION_REMOVED, // a symbol association was removed from a reference
|
||||
SYMBOL_DATA_CHANGED, // some symbol property was changed
|
||||
SYMBOL_ADDRESS_CHANGED, // the symbol's address changed (only applies to param and variables)
|
||||
|
||||
EXTERNAL_ENTRY_ADDED, // an external entry point was added
|
||||
EXTERNAL_ENTRY_REMOVED, // an external entry point was removed
|
||||
EXTERNAL_PATH_CHANGED, // the external path name changed for an external program
|
||||
EXTERNAL_NAME_ADDED, // an external program name was added
|
||||
EXTERNAL_NAME_REMOVED, // an external program name was removed
|
||||
EXTERNAL_NAME_CHANGED, // the name of an external program was changed
|
||||
EXTERNAL_REFERENCE_ADDED, // an external reference was added
|
||||
EXTERNAL_REFERENCE_REMOVED, // an external reference was removed
|
||||
|
||||
REFERENCE_ADDED, // a memory reference was added
|
||||
REFERENCE_REMOVED, // a memory reference was removed
|
||||
REFERENCE_TYPE_CHANGED, // a memory reference's type was changed
|
||||
REFERNCE_PRIMARY_SET, // a memory reference was made to be primary
|
||||
REFERENCE_PRIMARY_REMOVED, // a memory reference was made to be no longer primary
|
||||
|
||||
EQUATE_ADDED, // an equate was created
|
||||
EQUATE_REMOVED, // an equate was deleted
|
||||
EQUATE_REFERENCE_ADDED, // a reference to an equate was created
|
||||
EQUATE_REFERENCE_REMOVED, // a reference to an equate was deleted
|
||||
EQUATE_RENAMED, // an equate was renamed
|
||||
|
||||
PROGRAM_TREE_CREATED, // a new program tree was created
|
||||
PROGRAM_TREE_REMOVED, // a program tree was deleted
|
||||
PROGRAM_TREE_RENAMED,
|
||||
GROUP_ADDED, // a module or fragment was created in a program tree
|
||||
GROUP_REMOVED, // a module or fragment was removed from a program tree
|
||||
GROUP_RENAMED, // a module or fragment was renamed
|
||||
GROUP_COMMENT_CHANGED, // the comment for a module or fragment was changed
|
||||
GROUP_ALIAS_CHANGED, // the alias for a module or fragment was changed
|
||||
GROUP_REPARENTED, // a module or fragment's parent changed
|
||||
MODULE_REORDERED, // the children of a module changed order
|
||||
FRAGMENT_MOVED, // a fragment was moved
|
||||
FRAGMENT_CHANGED, // the addresses in a fragment were changed
|
||||
|
||||
COMMENT_CHANGED, // a comment was changed
|
||||
|
||||
DATA_TYPE_CATEGORY_ADDED, // a new data type category was created
|
||||
DATA_TYPE_CATEGORY_REMOVED, // a data type category was deleted
|
||||
DATA_TYPE_CATEGORY_RENAMED, // a data type category was renamed
|
||||
DATA_TYPE_CATEGORY_MOVED, // a data type category was moved (reparented)
|
||||
DATA_TYPE_ADDED, // a data type was created
|
||||
DATA_TYPE_REMOVED, // a data type was deleted
|
||||
DATA_TYPE_RENAMED, // a data type was renamed
|
||||
DATA_TYPE_MOVED, // a data type was moved
|
||||
DATA_TYPE_CHANGED, // a data type was changed
|
||||
DATA_TYPE_SETTING_CHANGED, // a data type's settings changed
|
||||
DATA_TYPE_REPLACED, // a data type was replaced
|
||||
SOURCE_ARCHIVE_ADDED, // a new data type source archive was defined
|
||||
SOURCE_ARCHIVE_CHANGED, // a data type source archive was changed
|
||||
|
||||
BOOKMARK_TYPE_ADDED, // a new bookmark type was defined
|
||||
BOOKMARK_TYPE_REMOVED, // a bookmark type was deleted
|
||||
BOOKMARK_ADDED, // a bookmark was added
|
||||
BOOKMARK_REMOVED, // a bookmark was removed
|
||||
BOOKMARK_CHANGED, // a bookmark was changed
|
||||
|
||||
LANGUAGE_CHANGED, // the program's language was changed
|
||||
REGISTER_VALUES_CHANGED, // the value of a register changed over some address range
|
||||
OVERLAY_SPACE_ADDED, // a new overlay address space was created
|
||||
OVERLAY_SPACE_REMOVED, // an overlay address space was deleted
|
||||
OVERLAY_SPACE_RENAMED, // an overlay address space was renamed
|
||||
|
||||
FUNCTION_TAG_CREATED, // a function tag was created
|
||||
FUNCTION_TAG_CHANGED, // a function tag was changed
|
||||
FUNCTION_TAG_DELETED, // a function tag was deleted
|
||||
FUNCTION_TAG_APPLIED, // a function tag was applied to a function
|
||||
FUNCTION_TAG_UNAPPLIED, // a function tag was removed from a function
|
||||
|
||||
FUNCTION_ADDED, // a function was created
|
||||
FUNCTION_REMOVED, // a function was removed
|
||||
FUNCTION_BODY_CHANGED, // a function's body (address set) changed
|
||||
FUNCTION_CHANGED, // one of many function attributes changed. See FunctionSubEvents Enum
|
||||
|
||||
VARIABLE_REFERENCE_ADDED, // a function variable reference was added
|
||||
VARIABLE_REFERENCE_REMOVED, // a function variable reference was removed
|
||||
|
||||
FALLTHROUGH_CHANGED, // a fallthrough address was changed for an instruction
|
||||
FLOW_OVERRIDE_CHANGED, // the flow override was changed for an instruction
|
||||
LENGTH_OVERRIDE_CHANGED, // the instruction length override was changed for an instruction
|
||||
|
||||
ADDRESS_PROPERTY_MAP_ADDED, // an address set property map was created
|
||||
ADDRESS_PROPERTY_MAP_REMOVED, // an address set property map was deleted
|
||||
ADDRESS_PROPERTY_MAP_CHANGED, // an address set property map was changed
|
||||
|
||||
INT_PROPERTY_MAP_ADDED, // an int property map was created
|
||||
INT_PROPERTY_MAP_REMOVED, // an int property map was removed
|
||||
INT_PROPERTY_MAP_CHANGED, // an int property map was changed
|
||||
|
||||
CODE_UNIT_USER_DATA_CHANGED, // user data has changed for some code unit
|
||||
USER_DATA_CHANGED, // general user data has changed at some address
|
||||
|
||||
RELOCATION_ADDED; // a relocation entry was added
|
||||
|
||||
private final int id = DomainObjectEventIdGenerator.next();
|
||||
|
||||
@Override
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
}
|
|
@ -19,56 +19,40 @@ import ghidra.framework.model.DomainObjectChangeRecord;
|
|||
|
||||
public class UserDataChangeRecord extends DomainObjectChangeRecord {
|
||||
|
||||
private final static long serialVersionUID = 1;
|
||||
private Object oldValue;
|
||||
private Object newValue;
|
||||
private String propertyName;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
* @param propertyName name of the property
|
||||
* @param oldValue old value
|
||||
* @param newValue new value
|
||||
*/
|
||||
public UserDataChangeRecord(String propertyName,
|
||||
Object oldValue,
|
||||
Object newValue) {
|
||||
super(ChangeManager.DOCR_USER_DATA_CHANGED);
|
||||
this.propertyName = propertyName;
|
||||
this.oldValue = oldValue;
|
||||
this.newValue = newValue;
|
||||
}
|
||||
|
||||
private final static long serialVersionUID = 1;
|
||||
private String propertyName;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
* @param propertyName name of the property
|
||||
* @param oldValue old value
|
||||
* @param newValue new value
|
||||
*/
|
||||
public UserDataChangeRecord(String propertyName, Object oldValue, Object newValue) {
|
||||
super(ProgramEvent.USER_DATA_CHANGED, oldValue, newValue);
|
||||
this.propertyName = propertyName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor for change record for removing a range of properties.
|
||||
* @param propertyName name of the property
|
||||
*/
|
||||
public UserDataChangeRecord(String propertyName) {
|
||||
super(ChangeManager.DOCR_CODE_UNIT_PROPERTY_RANGE_REMOVED);
|
||||
super(ProgramEvent.CODE_UNIT_PROPERTY_RANGE_REMOVED);
|
||||
this.propertyName = propertyName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the name of the property being changed.
|
||||
*/
|
||||
public String getPropertyName() {
|
||||
return propertyName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the original value.
|
||||
*/
|
||||
@Override
|
||||
public Object getOldValue() {
|
||||
return oldValue;
|
||||
}
|
||||
/**
|
||||
* Get the name of the property being changed.
|
||||
* @return the name of the property being changed.
|
||||
*/
|
||||
public String getPropertyName() {
|
||||
return propertyName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return super.toString() + ", property = " + propertyName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the new value.
|
||||
*/
|
||||
@Override
|
||||
public Object getNewValue() {
|
||||
return newValue;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue