mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2025-10-05 02:39:44 +02:00
Removal of old deprecated methods
This commit is contained in:
parent
37e807ea3b
commit
d05a57ae1a
16 changed files with 287 additions and 500 deletions
|
@ -36,7 +36,7 @@ import ghidra.util.exception.*;
|
|||
* <b>Assumptions for creating namespaces from a path string: </b>
|
||||
* <ul>
|
||||
* <li>All elements of a namespace path should be namespace symbols and not other
|
||||
* symbol types.
|
||||
* symbol types.
|
||||
* <li>Absolute paths can optionally start with the global namespace.
|
||||
* <li>You can provide a relative path that will start at the given
|
||||
* parent namespace (or global if there is no parent provided).
|
||||
|
@ -96,20 +96,6 @@ public class NamespaceUtils {
|
|||
return str;
|
||||
}
|
||||
|
||||
/**
|
||||
* Provide a standard method for splitting a symbol path into its
|
||||
* various namespace and symbol name elements. While the current implementation
|
||||
* uses a very simplistic approach, this may be improved upon in the future
|
||||
* to handle various grouping concepts.
|
||||
* @param path symbol namespace path (path will be trimmed before parse)
|
||||
* @return order list of namespace names
|
||||
* @deprecated use SymbolPath instead
|
||||
*/
|
||||
@Deprecated
|
||||
public static List<String> splitNamespacePath(String path) {
|
||||
return Arrays.asList(path.trim().split(Namespace.DELIMITER));
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the library associated with the specified namespace
|
||||
* @param namespace namespace
|
||||
|
@ -333,8 +319,8 @@ public class NamespaceUtils {
|
|||
*
|
||||
* <p>The root namespace can be a function.
|
||||
*
|
||||
* <p>If an address is passed, then the path can contain a function name provided the
|
||||
* address is in the body of the function; otherwise the names must all be namespaces other
|
||||
* <p>If an address is passed, then the path can contain a function name provided the
|
||||
* address is in the body of the function; otherwise the names must all be namespaces other
|
||||
* than functions.
|
||||
*
|
||||
* @param namespacePath The namespace name or path string to be parsed
|
||||
|
@ -387,11 +373,11 @@ public class NamespaceUtils {
|
|||
|
||||
/**
|
||||
* Returns the existing Function at the given address if its {@link SymbolPath} matches the
|
||||
* given path
|
||||
* given path
|
||||
*
|
||||
* @param program the program
|
||||
* @param symbolPath the path of namespace
|
||||
* @param address the address
|
||||
* @param address the address
|
||||
* @return the namespace represented by the given path, or null if no such namespace exists
|
||||
*/
|
||||
public static Namespace getFunctionNamespaceAt(Program program, SymbolPath symbolPath,
|
||||
|
@ -412,12 +398,12 @@ public class NamespaceUtils {
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns the existing Function containing the given address if its
|
||||
* {@link SymbolPath} matches the given path
|
||||
* Returns the existing Function containing the given address if its
|
||||
* {@link SymbolPath} matches the given path
|
||||
*
|
||||
* @param program the program
|
||||
* @param symbolPath the path of namespace
|
||||
* @param address the address
|
||||
* @param address the address
|
||||
* @return the namespace represented by the given path, or null if no such namespace exists
|
||||
*/
|
||||
public static Namespace getFunctionNamespaceContaining(Program program, SymbolPath symbolPath,
|
||||
|
|
|
@ -161,7 +161,7 @@ public class SymbolManager implements SymbolTable, ManagerDB {
|
|||
}
|
||||
|
||||
if (oldVariableStorageMgr != null) {
|
||||
// migrate from old variable storage table which utilized namespace-specific
|
||||
// migrate from old variable storage table which utilized namespace-specific
|
||||
// storage addresses
|
||||
migrateFromOldVariableStorageManager(monitor);
|
||||
}
|
||||
|
@ -268,7 +268,7 @@ public class SymbolManager implements SymbolTable, ManagerDB {
|
|||
|
||||
Address storageAddr = oldAddress.getNewAddress(oldAddress.getOffset());
|
||||
|
||||
// move variable references - eliminate variable symbol bindings which are no longer supported
|
||||
// move variable references - eliminate variable symbol bindings no longer supported
|
||||
refManager.moveReferencesTo(oldAddress, storageAddr, monitor);
|
||||
|
||||
try {
|
||||
|
@ -364,7 +364,7 @@ public class SymbolManager implements SymbolTable, ManagerDB {
|
|||
}
|
||||
|
||||
/**
|
||||
* Create mem references for the external entry points; then delete the table.
|
||||
* Create memory references for the external entry points; then delete the table.
|
||||
*/
|
||||
private void processOldExternalEntryPoints(TaskMonitor monitor)
|
||||
throws IOException, CancelledException {
|
||||
|
@ -506,7 +506,7 @@ public class SymbolManager implements SymbolTable, ManagerDB {
|
|||
DBRecord record =
|
||||
adapter.createSymbol(newName, address, newParentID, SymbolType.LABEL, null,
|
||||
null, null, source, true);
|
||||
symbol.setRecord(record);// symbol object was morphed
|
||||
symbol.setRecord(record);
|
||||
symbolAdded(symbol);
|
||||
}
|
||||
catch (IOException e) {
|
||||
|
@ -798,6 +798,7 @@ public class SymbolManager implements SymbolTable, ManagerDB {
|
|||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SymbolIterator getSymbolsAsIterator(Address addr) {
|
||||
lock.acquire();
|
||||
try {
|
||||
|
@ -920,7 +921,7 @@ public class SymbolManager implements SymbolTable, ManagerDB {
|
|||
}
|
||||
|
||||
private Symbol searchNamespaceForSymbol(Namespace namespace, String name, Address address) {
|
||||
for (Symbol symbol : getSymbols(namespace)) {
|
||||
for (Symbol symbol : getSymbols(namespace)) {// NOTE: thunks do not exist in external space
|
||||
if (address.equals(symbol.getAddress()) && name.equals(symbol.getName())) {
|
||||
return symbol;
|
||||
}
|
||||
|
@ -933,36 +934,11 @@ public class SymbolManager implements SymbolTable, ManagerDB {
|
|||
((FunctionSymbol) sym).isThunk();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Symbol getSymbol(String name, Namespace namespace) {
|
||||
List<Symbol> symbols = getSymbols(name, namespace);
|
||||
return symbols.isEmpty() ? null : symbols.get(0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Symbol getGlobalSymbol(String name, Address addr) {
|
||||
return getSymbol(name, addr, program.getGlobalNamespace());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Symbol getSymbol(String name) {
|
||||
lock.acquire();
|
||||
try {
|
||||
Namespace global = namespaceMgr.getGlobalNamespace();
|
||||
SymbolIterator it = getSymbols(name);
|
||||
while (it.hasNext()) {
|
||||
Symbol s = it.next();
|
||||
if (s.getParentNamespace().equals(global)) {
|
||||
return s;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
finally {
|
||||
lock.release();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Symbol> getGlobalSymbols(String name) {
|
||||
return getSymbols(name, namespaceMgr.getGlobalNamespace());
|
||||
|
@ -1057,7 +1033,7 @@ public class SymbolManager implements SymbolTable, ManagerDB {
|
|||
return null;
|
||||
}
|
||||
|
||||
// note: this could be public; adding it may be confusing due to the potential for having
|
||||
// note: this could be public; adding it may be confusing due to the potential for having
|
||||
// multiple symbols and not knowing when to call which method.
|
||||
private Symbol getFirstSymbol(String name, Namespace namespace, Predicate<Symbol> test) {
|
||||
if (namespace == null) {
|
||||
|
@ -1417,9 +1393,9 @@ public class SymbolManager implements SymbolTable, ManagerDB {
|
|||
|
||||
@Override
|
||||
public long getDynamicSymbolID(Address addr) {
|
||||
// Unique dynamic symbol ID produced from a dynamic symbol address map which has
|
||||
// a high-order bit set to avoid potential conflict
|
||||
// with stored symbol ID's which are assigned starting at 0.
|
||||
// Unique dynamic symbol ID produced from a dynamic symbol address map which has a
|
||||
// high-order bit set to avoid potential conflict with stored symbol ID's which are
|
||||
// assigned starting at 0.
|
||||
return dynamicSymbolAddressMap.getKey(addr);
|
||||
}
|
||||
|
||||
|
@ -1502,7 +1478,7 @@ public class SymbolManager implements SymbolTable, ManagerDB {
|
|||
}
|
||||
|
||||
void primarySymbolSet(Symbol symbol, Symbol oldPrimarySymbol) {
|
||||
// fire event: oldValue=symbol address, newvalue = reference address
|
||||
// fire event: old Value = symbol address, new value = reference address
|
||||
program.symbolChanged(symbol, ChangeManager.DOCR_SYMBOL_SET_AS_PRIMARY, symbol.getAddress(),
|
||||
null, oldPrimarySymbol, symbol);
|
||||
}
|
||||
|
@ -2116,7 +2092,9 @@ public class SymbolManager implements SymbolTable, ManagerDB {
|
|||
program.dbError(e);
|
||||
it = new EmptyRecordIterator();
|
||||
}
|
||||
return new SymbolRecordIterator(it, true, true); // NOTE: thunks do not exist in external space
|
||||
|
||||
// NOTE: thunks do not exist in external space
|
||||
return new SymbolRecordIterator(it, true, true);
|
||||
}
|
||||
|
||||
Lock getLock() {
|
||||
|
@ -2211,13 +2189,14 @@ public class SymbolManager implements SymbolTable, ManagerDB {
|
|||
}
|
||||
Address newAddress = toAddr.add(symbol.getAddress().subtract(fromAddr));
|
||||
|
||||
// any address that has symbols added or removed may have a corrupted primary (too many or non-existent)
|
||||
// any address that has symbols added or removed may have a corrupted primary
|
||||
// (too many or non-existent)
|
||||
primaryFixups.add(symbol.getAddress());
|
||||
primaryFixups.add(newAddress);
|
||||
|
||||
moveSymbolForMemoryBlockMove((SymbolDB) symbol, newAddress);
|
||||
}
|
||||
// go back and make sure there is a valid primary symbol at touched addressess
|
||||
// go back and make sure there is a valid primary symbol at touched addresses
|
||||
fixupPrimarySymbols(primaryFixups);
|
||||
}
|
||||
finally {
|
||||
|
@ -2665,7 +2644,7 @@ public class SymbolManager implements SymbolTable, ManagerDB {
|
|||
return (Namespace) namespaceSymbol.getObject();
|
||||
}
|
||||
|
||||
// Note: We know there are no namespaces with the name; do we still have to check for
|
||||
// Note: We know there are no namespaces with the name; do we still have to check for
|
||||
// duplicates? Assuming yes, as another symbol type may exist with this name.
|
||||
SymbolDB s =
|
||||
doCreateSpecialSymbol(Address.NO_ADDRESS, name, parent, SymbolType.NAMESPACE, null,
|
||||
|
@ -2687,8 +2666,8 @@ public class SymbolManager implements SymbolTable, ManagerDB {
|
|||
* @param name the name of the symbol
|
||||
* @param parent the namespace for the symbol
|
||||
* @param symbolType the type of the symbol
|
||||
* @param dataTypeId the id for an associated datatype or null
|
||||
* @param variableOffset this is the ordinal for params and firstUseOffset for locals
|
||||
* @param dataTypeId the id for an associated datatype or null
|
||||
* @param variableOffset this is the ordinal for params and firstUseOffset for locals
|
||||
* @param stringData value whose meaning depends on the symbol type.
|
||||
* @param source the SourceType for the new symbol
|
||||
* @return the newly created symbol
|
||||
|
@ -2729,12 +2708,6 @@ public class SymbolManager implements SymbolTable, ManagerDB {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Symbol createSymbol(Address addr, String name, SourceType source)
|
||||
throws InvalidInputException {
|
||||
return createLabel(addr, name, source);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Symbol createLabel(Address addr, String name, SourceType source)
|
||||
throws InvalidInputException {
|
||||
|
@ -2742,12 +2715,6 @@ public class SymbolManager implements SymbolTable, ManagerDB {
|
|||
return createLabel(addr, name, null, source);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Symbol createSymbol(Address addr, String name, Namespace namespace, SourceType source)
|
||||
throws InvalidInputException, DuplicateNameException {
|
||||
return createLabel(addr, name, namespace, source);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Symbol createLabel(Address addr, String name, Namespace namespace, SourceType source)
|
||||
throws InvalidInputException {
|
||||
|
|
|
@ -29,21 +29,20 @@ import ghidra.program.model.symbol.Reference;
|
|||
*/
|
||||
public interface Data extends CodeUnit, Settings {
|
||||
|
||||
// TODO: Fix javadocs !!
|
||||
|
||||
/**
|
||||
* Returns the value of the data item. The value may be an address, a scalar,
|
||||
* register or null if no value.
|
||||
* @return the value
|
||||
*/
|
||||
public Object getValue();
|
||||
|
||||
/**
|
||||
* Get the class used to express the value of this data.
|
||||
* NOTE: This determination is made based upon data type
|
||||
* and settings only and does not examine memory bytes
|
||||
* which are used to construct the data value object.
|
||||
* @return value class or null if a consistent class is not
|
||||
* utilized.
|
||||
*
|
||||
* <p>NOTE: This determination is made based upon data type and settings only and does not
|
||||
* examine memory bytes which are used to construct the data value object.
|
||||
*
|
||||
* @return value class or null if a consistent class is not utilized.
|
||||
*/
|
||||
public Class<?> getValueClass();
|
||||
|
||||
|
@ -67,24 +66,28 @@ public interface Data extends CodeUnit, Settings {
|
|||
public boolean isVolatile();
|
||||
|
||||
/**
|
||||
* Returns true if the data type is defined. Any address that has not been
|
||||
* defined to be code or data is treated as undefined data.
|
||||
* Returns true if the data type is defined. Any address that has not been defined to be code
|
||||
* or data is treated as undefined data.
|
||||
* @return true if is defined
|
||||
*/
|
||||
public boolean isDefined();
|
||||
|
||||
/**
|
||||
* Get the Data type for the data.
|
||||
* @return the data type
|
||||
*/
|
||||
public DataType getDataType();
|
||||
|
||||
/**
|
||||
* If the dataType is a typeDef, then the typeDef's base type is returned,
|
||||
* otherwise, the datatType is returned.
|
||||
* If the dataType is a typeDef, then the typeDef's base type is returned, otherwise, the
|
||||
* datatType is returned.
|
||||
* @return the data type
|
||||
*/
|
||||
public DataType getBaseDataType();
|
||||
|
||||
/**
|
||||
* Get the references for the value.
|
||||
* @return the references
|
||||
*/
|
||||
public Reference[] getValueReferences();
|
||||
|
||||
|
@ -102,126 +105,136 @@ public interface Data extends CodeUnit, Settings {
|
|||
public void removeValueReference(Address refAddr);
|
||||
|
||||
/**
|
||||
* Get the field name of this data item if it is "inside" another data item,
|
||||
* otherwise return null.
|
||||
* Get the field name of this data item if it is "inside" another data item, otherwise return
|
||||
* null.
|
||||
* @return the name of this data as known from some parent data item or
|
||||
* null if this data item is not a component of another data item.
|
||||
*/
|
||||
public String getFieldName();
|
||||
|
||||
/**
|
||||
* Returns the full path name (dot notation) for this field. This includes
|
||||
* the symbol name at this address.
|
||||
* Returns the full path name (dot notation) for this field. This includes the symbol name at
|
||||
* this address.
|
||||
* @return the path name
|
||||
*/
|
||||
public String getPathName();
|
||||
|
||||
/**
|
||||
* Returns the component path name (dot notation) for this field
|
||||
* @return the component path name
|
||||
*/
|
||||
public String getComponentPathName();
|
||||
|
||||
/**
|
||||
* Returns true if this is a pointer, implies getValue() will
|
||||
* will return an Object that is an Address.
|
||||
* Returns true if this is a pointer, implies getValue() will will return an Object that is an
|
||||
* Address.
|
||||
* @return true if a pointer
|
||||
*/
|
||||
public boolean isPointer();
|
||||
|
||||
/**
|
||||
* Returns true if this data item is a Union.
|
||||
* @return true if a union
|
||||
*/
|
||||
public boolean isUnion();
|
||||
|
||||
/**
|
||||
* Returns true if this data item is a Structure.
|
||||
* @return true if a structure
|
||||
*/
|
||||
public boolean isStructure();
|
||||
|
||||
/**
|
||||
* Returns true if this data item is an Array of DataTypes
|
||||
* @return true if an array
|
||||
*/
|
||||
public boolean isArray();
|
||||
|
||||
/**
|
||||
* Returns true if this data item is a dynamic DataType.
|
||||
* @return true if is dynamic
|
||||
*/
|
||||
public boolean isDynamic();
|
||||
|
||||
/**
|
||||
* Get the immediate parent data item of this data item or null if this data
|
||||
* item is not contained in another data item.
|
||||
* Get the immediate parent data item of this data item or null if this data item is not
|
||||
* contained in another data item.
|
||||
* @return the data
|
||||
*/
|
||||
public Data getParent();
|
||||
|
||||
/**
|
||||
* Get the highest level Data item in a hierarchy of structures
|
||||
* containing this component.
|
||||
* Get the highest level Data item in a hierarchy of structures containing this component.
|
||||
* @return the data
|
||||
*/
|
||||
public Data getRoot();
|
||||
|
||||
/**
|
||||
* Get the offset of this Data item from the start of the root data item of
|
||||
* some hierarchy of structures.
|
||||
* Get the offset of this Data item from the start of the root data item of some hierarchy of
|
||||
* structures.
|
||||
* @return the offset
|
||||
*/
|
||||
int getRootOffset();
|
||||
public int getRootOffset();
|
||||
|
||||
/**
|
||||
* Get the offset of this Data item from the start of its immediate
|
||||
* parent.
|
||||
* Get the offset of this Data item from the start of its immediate parent.
|
||||
* @return the offset
|
||||
*/
|
||||
int getParentOffset();
|
||||
public int getParentOffset();
|
||||
|
||||
/**
|
||||
* Returns the immediate n'th component or null if none exists.
|
||||
* @param index the index of the component to get.
|
||||
* @return the component
|
||||
*/
|
||||
public Data getComponent(int index);
|
||||
|
||||
/**
|
||||
* Get a data item given the index path. Each integer in the array represents
|
||||
* an index into the data item at that level.
|
||||
* Get a data item given the index path. Each integer in the array represents an index into
|
||||
* the data item at that level.
|
||||
* @param componentPath the array of indexes to use to find the requested data item.
|
||||
* @return the component
|
||||
*/
|
||||
public Data getComponent(int[] componentPath);
|
||||
|
||||
/**
|
||||
* Get the component path if this is a component. The component path is an
|
||||
* array of integers that represent each index in the tree of data items. Top
|
||||
* level data items have an empty array for thier component path.
|
||||
* Get the component path if this is a component. The component path is an array of integers
|
||||
* that represent each index in the tree of data items. Top level data items have an empty
|
||||
* array for their component path.
|
||||
* @return the path
|
||||
*/
|
||||
public int[] getComponentPath();
|
||||
|
||||
/**
|
||||
* Return the number of components that make up this data item.
|
||||
* if this is an Array, return the number of elements in the array.
|
||||
* @return the number of components
|
||||
*/
|
||||
public int getNumComponents();
|
||||
|
||||
/**
|
||||
* Return the first immediate child component that contains the byte
|
||||
* at the given offset. It is important to note that with certain
|
||||
* datatypes there may be more than one component containing the specified offset
|
||||
* (see {@link #getComponentsContaining(int)}).
|
||||
* Return the first immediate child component that contains the byte at the given offset. It
|
||||
* is important to note that with certain datatypes there may be more than one component
|
||||
* containing the specified offset (see {@link #getComponentsContaining(int)}).
|
||||
*
|
||||
* @param offset the amount to add to this data items address to get the
|
||||
* address of the requested data item.
|
||||
* @param offset the amount to add to this data items address to get the address of the
|
||||
* requested data item.
|
||||
* @return first data component containing offset or null
|
||||
* @deprecated method name has been changed to better reflect behavior. The method
|
||||
* @deprecated method name has been changed to better reflect behavior. The method
|
||||
* {@link #getComponentContaining(int)} should be used instead.
|
||||
*/
|
||||
@Deprecated
|
||||
Data getComponentAt(int offset);
|
||||
@Deprecated(forRemoval = true, since = "10.1")
|
||||
public Data getComponentAt(int offset);
|
||||
|
||||
/**
|
||||
* RReturn the first immediate child component that contains the byte
|
||||
* at the given offset. It is important to note that with certain
|
||||
* datatypes there may be more than one component containing the specified offset
|
||||
* (see {@link #getComponentsContaining(int)}).
|
||||
* RReturn the first immediate child component that contains the byte at the given offset. It
|
||||
* is important to note that with certain datatypes there may be more than one component
|
||||
* containing the specified offset (see {@link #getComponentsContaining(int)}).
|
||||
*
|
||||
* @param offset the amount to add to this data items address to get the
|
||||
* @return first data component containing offset or null
|
||||
* address of the requested data item.
|
||||
* @return first data component containing offset or null address of the requested data item.
|
||||
*/
|
||||
Data getComponentContaining(int offset);
|
||||
public Data getComponentContaining(int offset);
|
||||
|
||||
/**
|
||||
* Returns a list of all the immediate child components that contain the byte at the
|
||||
|
@ -234,39 +247,42 @@ public interface Data extends CodeUnit, Settings {
|
|||
* @return a list of all the immediate child components that contain the byte at the
|
||||
* given offset or null if offset is out of bounds.
|
||||
*/
|
||||
List<Data> getComponentsContaining(int offset);
|
||||
public List<Data> getComponentsContaining(int offset);
|
||||
|
||||
/**
|
||||
* Returns the primitive component containing this offset (i.e., one that does not
|
||||
* have sub-components). This is useful for data items which are made up of multiple
|
||||
* layers of other data items. This method immediately goes to the lowest level data item.
|
||||
* If the minimum offset of a component is specified, the only first component containing
|
||||
* have sub-components). This is useful for data items which are made up of multiple
|
||||
* layers of other data items. This method immediately goes to the lowest level data item.
|
||||
* If the minimum offset of a component is specified, the only first component containing
|
||||
* the offset will be considered (e.g., 0-element array).
|
||||
* @param offset the offset
|
||||
* @return primitive component containing this offset
|
||||
*/
|
||||
Data getPrimitiveAt(int offset);
|
||||
public Data getPrimitiveAt(int offset);
|
||||
|
||||
/**
|
||||
* Get the index of this component in its parent
|
||||
* @return -1 if this data item is not a component of another data item.
|
||||
*/
|
||||
int getComponentIndex();
|
||||
public int getComponentIndex();
|
||||
|
||||
/**
|
||||
* Get this data's component level in its hierarchy of components.
|
||||
* @return the level of this data item with 0 being the level of top data items.
|
||||
*/
|
||||
int getComponentLevel();
|
||||
public int getComponentLevel();
|
||||
|
||||
/**
|
||||
* Returns a string that represents the data value without markup.
|
||||
* @return the string
|
||||
*/
|
||||
public String getDefaultValueRepresentation();
|
||||
|
||||
/**
|
||||
* Returns the appropriate string to use as the default label prefix or null if it has no
|
||||
* prefered default label prefix;
|
||||
* @param options
|
||||
* preferred default label prefix;
|
||||
* @param options the options
|
||||
* @return the prefix
|
||||
*/
|
||||
public String getDefaultLabelPrefix(DataTypeDisplayOptions options);
|
||||
}
|
||||
|
|
|
@ -68,10 +68,6 @@ public abstract class RefType {
|
|||
static final byte __WRITE_IND = 105;
|
||||
static final byte __READ_WRITE_IND = 106;
|
||||
static final byte __UNKNOWNPARAM = 107;
|
||||
@Deprecated
|
||||
static final byte __STACK_READ = 110; // Use __READ instead
|
||||
@Deprecated
|
||||
static final byte __STACK_WRITE = 111; // Use __WRITE instead
|
||||
static final byte __EXTERNAL_REF = 113;
|
||||
static final byte __UNKNOWNDATA_IND = 114;
|
||||
|
||||
|
@ -247,23 +243,8 @@ public abstract class RefType {
|
|||
DataRefType.READX | DataRefType.WRITEX | DataRefType.INDX);
|
||||
|
||||
/**
|
||||
* Reference type assigned for stack variable being read.
|
||||
* @deprecated use {@link RefType#READ} instead
|
||||
*/
|
||||
@Deprecated
|
||||
public static final RefType STACK_READ =
|
||||
new DataRefType(__STACK_READ, "STACK_READ", DataRefType.READX);
|
||||
|
||||
/**
|
||||
* Reference type assigned for stack variable being written.
|
||||
* @deprecated use {@link RefType#WRITE} instead
|
||||
*/
|
||||
@Deprecated
|
||||
public static final RefType STACK_WRITE =
|
||||
new DataRefType(__STACK_WRITE, "STACK_WRITE", DataRefType.WRITEX);
|
||||
/**
|
||||
* Reference type used internally to identify external entry points.
|
||||
* The use of this RefType for references to external library data or functions
|
||||
* Reference type used internally to identify external entry points.
|
||||
* The use of this RefType for references to external library data or functions
|
||||
* is deprecated and should not be used for that purpose.
|
||||
*/
|
||||
public static final RefType EXTERNAL_REF = new DataRefType(__EXTERNAL_REF, "EXTERNAL", 0);
|
||||
|
|
|
@ -31,7 +31,6 @@ import ghidra.util.datastruct.IntObjectHashtable;
|
|||
/**
|
||||
* Factory class to create RefType objects.
|
||||
*/
|
||||
@SuppressWarnings("deprecation")
|
||||
public class RefTypeFactory {
|
||||
|
||||
private static final IntObjectHashtable<RefType> REFTYPE_LOOKUP_BY_TYPE_MAP =
|
||||
|
@ -74,8 +73,6 @@ public class RefTypeFactory {
|
|||
REFTYPE_LOOKUP_BY_TYPE_MAP.put(RefType.READ_IND.getValue(), RefType.READ_IND);
|
||||
REFTYPE_LOOKUP_BY_TYPE_MAP.put(RefType.WRITE_IND.getValue(), RefType.WRITE_IND);
|
||||
REFTYPE_LOOKUP_BY_TYPE_MAP.put(RefType.READ_WRITE_IND.getValue(), RefType.READ_WRITE_IND);
|
||||
REFTYPE_LOOKUP_BY_TYPE_MAP.put(RefType.STACK_READ.getValue(), RefType.STACK_READ);
|
||||
REFTYPE_LOOKUP_BY_TYPE_MAP.put(RefType.STACK_WRITE.getValue(), RefType.STACK_WRITE);
|
||||
REFTYPE_LOOKUP_BY_TYPE_MAP.put(RefType.EXTERNAL_REF.getValue(), RefType.EXTERNAL_REF);
|
||||
REFTYPE_LOOKUP_BY_TYPE_MAP.put(RefType.__CALL_OVERRIDE_UNCONDITIONAL,
|
||||
RefType.CALL_OVERRIDE_UNCONDITIONAL);
|
||||
|
@ -148,10 +145,10 @@ public class RefTypeFactory {
|
|||
}
|
||||
|
||||
/**
|
||||
* Get the default statck data RefType for the specified code-unit/opIndex and register
|
||||
* @param cu
|
||||
* @param reg
|
||||
* @param opIndex
|
||||
* Get the default stack data RefType for the specified code-unit/opIndex and register
|
||||
* @param cu the code unit
|
||||
* @param reg the register
|
||||
* @param opIndex the op index
|
||||
* @return default RefType
|
||||
*/
|
||||
public static RefType getDefaultRegisterRefType(CodeUnit cu, Register reg, int opIndex) {
|
||||
|
@ -307,7 +304,7 @@ public class RefTypeFactory {
|
|||
boolean simpleFlow =
|
||||
(instr.getFlowType() != RefType.INVALID && instr.getDefaultFlows().length <= 1);
|
||||
if (simpleFlow) {
|
||||
// only use default if simple flow
|
||||
// only use default if simple flow
|
||||
flowType = getDefaultJumpOrCallFlowType(instr);
|
||||
}
|
||||
|
||||
|
@ -321,7 +318,7 @@ public class RefTypeFactory {
|
|||
}
|
||||
|
||||
// Assumption - it is assumed that any complex flow type is due to the presence of
|
||||
// multiple conditional flows. Does not handle use of constant offsets since
|
||||
// multiple conditional flows. Does not handle use of constant offsets since
|
||||
// language should be using Address locations for all flow pcode!
|
||||
|
||||
// TODO: Verify that above assumption is valid !!
|
||||
|
@ -348,7 +345,7 @@ public class RefTypeFactory {
|
|||
}
|
||||
|
||||
/**
|
||||
* Determine default computed FlowType for a specified instruction. It is assumed
|
||||
* Determine default computed FlowType for a specified instruction. It is assumed
|
||||
* that all computed flows utilize a register in its destination specification/computation.
|
||||
* @param instr instruction
|
||||
* @return FlowType or null if unable to determine
|
||||
|
@ -361,7 +358,7 @@ public class RefTypeFactory {
|
|||
}
|
||||
|
||||
// Assumption - it is assumed that any complex flow type is due to the presence of
|
||||
// multiple conditional flows.
|
||||
// multiple conditional flows.
|
||||
|
||||
// TODO: Verify that above assumption is valid !!
|
||||
|
||||
|
@ -388,9 +385,9 @@ public class RefTypeFactory {
|
|||
|
||||
/**
|
||||
* Get the default memory flow/data RefType for the specified code unit and opIndex.
|
||||
* @param cu
|
||||
* @param opIndex
|
||||
* @param toAddr reference destination
|
||||
* @param cu the code unit
|
||||
* @param opIndex the op index
|
||||
* @param toAddr reference destination
|
||||
* @param ignoreExistingReferences if true existing references will not influence default
|
||||
* reference type returned.
|
||||
* @return default RefType
|
||||
|
@ -453,8 +450,10 @@ public class RefTypeFactory {
|
|||
}
|
||||
|
||||
if (!ignoreExistingReferences) {
|
||||
Reference[] refs = cu.getProgram().getReferenceManager().getReferencesFrom(
|
||||
cu.getMinAddress(), opIndex);
|
||||
Reference[] refs = cu.getProgram()
|
||||
.getReferenceManager()
|
||||
.getReferencesFrom(
|
||||
cu.getMinAddress(), opIndex);
|
||||
for (Reference ref : refs) {
|
||||
if (ref.getToAddress().equals(toAddr)) {
|
||||
return ref.getReferenceType();
|
||||
|
@ -486,7 +485,7 @@ public class RefTypeFactory {
|
|||
|
||||
/**
|
||||
* Return default flow-type without terminator
|
||||
* @param inst
|
||||
* @param inst the instruction
|
||||
* @return call/jump flow type or null
|
||||
*/
|
||||
private static FlowType getDefaultJumpOrCallFlowType(Instruction inst) {
|
||||
|
|
|
@ -69,14 +69,6 @@ public interface SymbolTable {
|
|||
public Symbol createLabel(Address addr, String name, SourceType source)
|
||||
throws InvalidInputException;
|
||||
|
||||
/**
|
||||
* @deprecated use {@link #createLabel(Address, String, SourceType)} instead.
|
||||
* Deprecated in version 7.5, will be removed a few versions later.
|
||||
*/
|
||||
@Deprecated
|
||||
public Symbol createSymbol(Address addr, String name, SourceType source)
|
||||
throws InvalidInputException;
|
||||
|
||||
/**
|
||||
* Create a label symbol with the given name associated to the given
|
||||
* Address and namespace. The symbol will be of type SymbolType.CODE.
|
||||
|
@ -99,14 +91,6 @@ public interface SymbolTable {
|
|||
public Symbol createLabel(Address addr, String name, Namespace namespace, SourceType source)
|
||||
throws InvalidInputException;
|
||||
|
||||
/**
|
||||
* @deprecated use {@link #createLabel(Address, String, Namespace, SourceType)} instead.
|
||||
* Deprecated in version 7.5, will be removed a few versions later.
|
||||
*/
|
||||
@Deprecated
|
||||
public Symbol createSymbol(Address addr, String name, Namespace namespace, SourceType source)
|
||||
throws DuplicateNameException, InvalidInputException;
|
||||
|
||||
/**
|
||||
* Removes the specified symbol from the symbol table. If removing any <b>non-function</b>
|
||||
* symbol the behavior will be the same as invoking {@link Symbol#delete()} on the
|
||||
|
@ -128,21 +112,10 @@ public interface SymbolTable {
|
|||
* symbol specific binding.
|
||||
*
|
||||
* @param sym the symbol to be removed.
|
||||
*
|
||||
* @return false, if removal of the symbol fails
|
||||
*/
|
||||
public boolean removeSymbolSpecial(Symbol sym);
|
||||
|
||||
// /**
|
||||
// * This method is just a pass-through for {@link #removeSymbolSpecial(Symbol)}.
|
||||
// *
|
||||
// * @see #removeSymbolSpecial(Symbol)
|
||||
// * @deprecated Call instead {@link #removeSymbolSpecial(Symbol)} or {@link Symbol#delete()}.
|
||||
// * Deprecated in version 7.4, will be removed a few versions later.
|
||||
// */
|
||||
// @Deprecated
|
||||
// public boolean removeSymbol(Symbol sym);
|
||||
|
||||
/**
|
||||
* Get the symbol for the given symbol ID.
|
||||
* @param symbolID the id of the symbol to be retrieved.
|
||||
|
@ -153,16 +126,19 @@ public interface SymbolTable {
|
|||
/**
|
||||
* Get the symbol with the given name, address, and namespace.
|
||||
* <P>
|
||||
* Note that for a symbol to be uniquely specified, all these parameters are required. Any method
|
||||
* that queries for symbols using just one or two of these parameters will return a list of symbols.
|
||||
* This method will not return a default thunk (i.e., thunk function symbol with default source type)
|
||||
* since it mirrors the name and parent namespace of the function it thunks.
|
||||
* </P>
|
||||
* Note that for a symbol to be uniquely specified, all these parameters are required. Any
|
||||
* method that queries for symbols using just one or two of these parameters will return a list
|
||||
* of symbols. This method will not return a default thunk (i.e., thunk function symbol with
|
||||
* default source type) since it mirrors the name and parent namespace of the function it
|
||||
* thunks.
|
||||
*
|
||||
* @param name the name of the symbol to retrieve
|
||||
* @param addr the address of the symbol to retrieve
|
||||
* @param namespace the namespace of the symbol to retrieve. May be null which indicates global namespace.
|
||||
* @return the symbol which matches the specified crieria or null if not found
|
||||
* @see #getGlobalSymbol(String, Address) for a convenience method if the namespace is the global namespace.
|
||||
* @param namespace the namespace of the symbol to retrieve. May be null which indicates global
|
||||
* namespace.
|
||||
* @return the symbol which matches the specified criteria or null if not found
|
||||
* @see #getGlobalSymbol(String, Address) for a convenience method if the namespace is the
|
||||
* global namespace.
|
||||
*/
|
||||
public Symbol getSymbol(String name, Address addr, Namespace namespace);
|
||||
|
||||
|
@ -172,56 +148,24 @@ public interface SymbolTable {
|
|||
* at the same address and namespace (in this case the global namespace).
|
||||
*
|
||||
* <P>This is just a convenience method for {@link #getSymbol(String, Address, Namespace)} where
|
||||
* the namespace is the global namespace.</P>
|
||||
* the namespace is the global namespace.
|
||||
*
|
||||
* <p>NOTE: This method will not return a default thunk (i.e., thunk function symbol with default source type)
|
||||
* since it mirrors the name and parent namespace of the function it thunks.</p>
|
||||
* <p>NOTE: This method will not return a default thunk (i.e., thunk function symbol with
|
||||
* default source type) since it mirrors the name and parent namespace of the function it
|
||||
* thunks.
|
||||
*
|
||||
* @param name the name of the symbol to retrieve
|
||||
* @param addr the address of the symbol to retrieve
|
||||
* @return the symbol which matches the specified crieria in the global namespace or null if not found
|
||||
* @see #getSymbol(String, Address, Namespace)
|
||||
* @return the symbol which matches the specified criteria in the global namespace or null if
|
||||
* not found
|
||||
* @see #getSymbol(String, Address, Namespace)
|
||||
*/
|
||||
public Symbol getGlobalSymbol(String name, Address addr);
|
||||
|
||||
/**
|
||||
* Returns the first symbol with the given name found in the given namespace. Ghidra now
|
||||
* allows multiple symbols with the same name in the same namespace, so using this method
|
||||
* is likely to produce unintended results. Use {@link #getSymbols(String, Namespace)} instead.
|
||||
*
|
||||
* <p>NOTE: This method will not return a default thunk (i.e.,
|
||||
* thunk function symbol with default source type).</p>
|
||||
*
|
||||
* @param name the name of the symbol to retreive
|
||||
* @param namespace the namespace of the symbol to retrieve (null assumes global namespace)
|
||||
* @return the first symbol which satisifies specified criteria or null if not found
|
||||
* @deprecated This method is no longer useful as Ghidra allows duplicate symbol names in
|
||||
* the same namespace. Use {@link #getSymbols(String, Namespace)} instead.
|
||||
* Deprecated in version 7.5, will be removed a few versions later.
|
||||
*/
|
||||
@Deprecated
|
||||
public Symbol getSymbol(String name, Namespace namespace);
|
||||
|
||||
/**
|
||||
* Returns the first global symbol that it finds with the given name. Now that Ghidra
|
||||
* allows duplicate symbol names, this method is practically useless.
|
||||
*
|
||||
* <p>NOTE: This method will not return a default thunk (i.e.,
|
||||
* thunk function symbol with default source type).</p>
|
||||
*
|
||||
* @param name the name of the symbol to be retrieved.
|
||||
* @return first symbol found with specified name or null if no global symbol has that name
|
||||
* @deprecated Use {@link #getGlobalSymbols(String)} instead. Ghidra now allows
|
||||
* multiple symbols in any namespace to have the same name. Deprecated in Ghidra 7.5
|
||||
* Deprecated in version 7.5, will be removed a few versions later.
|
||||
*/
|
||||
@Deprecated
|
||||
public Symbol getSymbol(String name);
|
||||
|
||||
/**
|
||||
* Returns a list of all global symbols with the given name.
|
||||
*
|
||||
* <p>NOTE: This method will not return default thunks (i.e.,
|
||||
* <p>NOTE: This method will not return default thunks (i.e.,
|
||||
* thunk function symbol with default source type).</p>
|
||||
*
|
||||
* @param name the name of the symbols to retrieve.
|
||||
|
@ -283,7 +227,7 @@ public interface SymbolTable {
|
|||
/**
|
||||
* Returns a list of all symbols with the given name in the given namespace.
|
||||
*
|
||||
* <p>NOTE: The resulting iterator will not return default thunks (i.e.,
|
||||
* <p>NOTE: The resulting iterator will not return default thunks (i.e.,
|
||||
* thunk function symbol with default source type).</p>
|
||||
*
|
||||
* @param name the name of the symbols to retrieve.
|
||||
|
@ -295,7 +239,7 @@ public interface SymbolTable {
|
|||
/**
|
||||
* Returns a symbol that is either a parameter or local variable. There can be only
|
||||
* one because these symbol types have a unique name requirement.
|
||||
* @param name the naem of the variable.
|
||||
* @param name the name of the variable.
|
||||
* @param function the function to search.
|
||||
* @return a parameter or local variable symbol with the given name.
|
||||
*/
|
||||
|
@ -314,7 +258,7 @@ public interface SymbolTable {
|
|||
/**
|
||||
* Returns all the symbols with the given name.
|
||||
*
|
||||
* <p>NOTE: The resulting iterator will not return default thunks (i.e.,
|
||||
* <p>NOTE: The resulting iterator will not return default thunks (i.e.,
|
||||
* thunk function symbol with default source type).</p>
|
||||
*
|
||||
* @param name the name of symbols to search for.
|
||||
|
@ -353,8 +297,8 @@ public interface SymbolTable {
|
|||
* the primary symbol will be returned in array slot 0.
|
||||
* WARNING! Use of this method with a Variable address is highly discouraged since
|
||||
* a single Variable address could be used multiple times by many functions.
|
||||
* Note that unless all the symbols are needed at once, you should consider using
|
||||
* the {@link #getSymbolsAsIterator(Address)} method instead.
|
||||
* Note that unless all the symbols are needed at once, you should consider using
|
||||
* the {@link #getSymbolsAsIterator(Address)} method instead.
|
||||
* @param addr the address at which to retrieve all symbols.
|
||||
* @return a zero-length array when no symbols are defined at address.
|
||||
* @see #getSymbolsAsIterator(Address)
|
||||
|
@ -362,8 +306,8 @@ public interface SymbolTable {
|
|||
public Symbol[] getSymbols(Address addr);
|
||||
|
||||
/**
|
||||
* Returns a symbol iterator over all the symbols at the given address. Use this instead of
|
||||
* {@link #getSymbols(Address)} when you do not need to get all symbols, but rather are
|
||||
* Returns a symbol iterator over all the symbols at the given address. Use this instead of
|
||||
* {@link #getSymbols(Address)} when you do not need to get all symbols, but rather are
|
||||
* searching for a particular symbol. This method prevents all symbols at the given address
|
||||
* from being loaded up front.
|
||||
*
|
||||
|
@ -383,7 +327,7 @@ public interface SymbolTable {
|
|||
/**
|
||||
* Returns an iterator over all the symbols in the given namespace
|
||||
*
|
||||
* <p>NOTE: The resulting iterator will not return default thunks (i.e.,
|
||||
* <p>NOTE: The resulting iterator will not return default thunks (i.e.,
|
||||
* thunk function symbol with default source type).</p>
|
||||
*
|
||||
* @param namespace the namespace to search for symbols.
|
||||
|
@ -394,7 +338,7 @@ public interface SymbolTable {
|
|||
/**
|
||||
* Returns an iterator over all the symbols in the given namespace
|
||||
*
|
||||
* <p>NOTE: This method will not return a default thunk (i.e.,
|
||||
* <p>NOTE: This method will not return a default thunk (i.e.,
|
||||
* thunk function symbol with default source type).</p>
|
||||
*
|
||||
* @param namespaceID the namespace ID to search for symbols.
|
||||
|
@ -410,8 +354,8 @@ public interface SymbolTable {
|
|||
public boolean hasSymbol(Address addr);
|
||||
|
||||
/**
|
||||
* Get the unique symbol ID for a dynamic symbol associated with the speified addr.
|
||||
* The generation of this symbol ID does not reflect the presence of a dyanmic symbol
|
||||
* Get the unique symbol ID for a dynamic symbol associated with the specified addr.
|
||||
* The generation of this symbol ID does not reflect the presence of a dynamic symbol
|
||||
* at the specified addr. This symbol ID should not be permanently stored since the encoding
|
||||
* may change between software releases.
|
||||
* @param addr dynamic symbol address
|
||||
|
@ -422,9 +366,9 @@ public interface SymbolTable {
|
|||
/**
|
||||
* Returns a an iterator over all symbols that match the given search string.
|
||||
*
|
||||
* <p>NOTE: The iterator is in the forward direction only and will not return default thunk functions.
|
||||
* The resulting iterator will not return default thunks (i.e.,
|
||||
* thunk function symbol with default source type).</p>
|
||||
* <p>NOTE: The iterator is in the forward direction only and will not return default thunk
|
||||
* functions. The resulting iterator will not return default thunks (i.e.,
|
||||
* thunk function symbol with default source type).
|
||||
*
|
||||
* @param searchStr the string to search for (may contain * to match any sequence
|
||||
* or ? to match a single char)
|
||||
|
@ -575,8 +519,7 @@ public interface SymbolTable {
|
|||
public Namespace getNamespace(Address addr);
|
||||
|
||||
/**
|
||||
* Returns all Class Namespaces defined within the program in an
|
||||
* arbitrary ordering.
|
||||
* Returns all Class Namespaces defined within the program in an arbitrary ordering.
|
||||
* @return iterator of {@link GhidraClass}
|
||||
*/
|
||||
public Iterator<GhidraClass> getClassNamespaces();
|
||||
|
@ -587,8 +530,8 @@ public interface SymbolTable {
|
|||
* @param name name of the namespace
|
||||
* @param source the source of this class namespace's symbol
|
||||
* @return new class namespace
|
||||
* @throws DuplicateNameException thrown if another non function or label symbol
|
||||
* exists with the given name
|
||||
* @throws DuplicateNameException thrown if another non function or label symbol exists with
|
||||
* the given name
|
||||
* @throws InvalidInputException throw if the name has invalid characters or is null
|
||||
* @throws IllegalArgumentException if you try to set the source to 'Symbol.DEFAULT'.
|
||||
*/
|
||||
|
@ -598,8 +541,8 @@ public interface SymbolTable {
|
|||
/**
|
||||
* Returns an iterator over all symbols that have the given symbol as its parent.
|
||||
*
|
||||
* <p>NOTE: The resulting iterator will not return default thunks (i.e.,
|
||||
* thunk function symbol with default source type).</p>
|
||||
* <p>NOTE: The resulting iterator will not return default thunks (i.e., thunk function symbol
|
||||
* with default source type).
|
||||
*
|
||||
* @param parentSymbol the parent symbol
|
||||
* @return symbol iterator
|
||||
|
@ -613,7 +556,7 @@ public interface SymbolTable {
|
|||
* @return the new Library namespace.
|
||||
* @throws InvalidInputException if the name is invalid.
|
||||
* @throws IllegalArgumentException if you try to set the source to 'Symbol.DEFAULT'.
|
||||
* @throws DuplicateNameException thrown if another non function or label
|
||||
* @throws DuplicateNameException thrown if another non function or label
|
||||
* symbol exists with the given name
|
||||
*/
|
||||
public Library createExternalLibrary(String name, SourceType source)
|
||||
|
@ -625,7 +568,7 @@ public interface SymbolTable {
|
|||
* @param name the name of the new namespace
|
||||
* @param source the source of this namespace's symbol
|
||||
* @return the new Namespace object.
|
||||
* @throws DuplicateNameException thrown if another non function or label symbol
|
||||
* @throws DuplicateNameException thrown if another non function or label symbol
|
||||
* exists with the given name
|
||||
* @throws InvalidInputException if the name is invalid.
|
||||
* @throws IllegalArgumentException if you try to set the source to 'Symbol.DEFAULT'.
|
||||
|
@ -647,12 +590,12 @@ public interface SymbolTable {
|
|||
/**
|
||||
* Gets an existing namespace with the given name in the given parent. If no namespace exists,
|
||||
* then one will be created.
|
||||
*
|
||||
*
|
||||
* @param parent the parent namespace
|
||||
* @param name the namespace name
|
||||
* @param source the source type for the namespace if one is created
|
||||
* @return the namespace
|
||||
* @throws DuplicateNameException thrown if another non function or label symbol exists with
|
||||
* @throws DuplicateNameException thrown if another non function or label symbol exists with
|
||||
* the given name
|
||||
* @throws InvalidInputException if the name is invalid
|
||||
* @throws IllegalArgumentException if the given parent namespace is from a different program
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue