mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2025-10-03 17:59:46 +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
|
@ -87,12 +87,6 @@ public class DBTraceProgramViewSymbolTable implements SymbolTable {
|
||||||
return symbolManager.labels().create(program.snap, null, addr, name, global, source);
|
return symbolManager.labels().create(program.snap, null, addr, name, global, source);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public Symbol createSymbol(Address addr, String name, SourceType source)
|
|
||||||
throws InvalidInputException {
|
|
||||||
return createLabel(addr, name, source);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Symbol createLabel(Address addr, String name, Namespace namespace, SourceType source)
|
public Symbol createLabel(Address addr, String name, Namespace namespace, SourceType source)
|
||||||
throws InvalidInputException {
|
throws InvalidInputException {
|
||||||
|
@ -101,12 +95,6 @@ public class DBTraceProgramViewSymbolTable implements SymbolTable {
|
||||||
assertTraceNamespace(namespace), source);
|
assertTraceNamespace(namespace), source);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public Symbol createSymbol(Address addr, String name, Namespace namespace, SourceType source)
|
|
||||||
throws DuplicateNameException, InvalidInputException {
|
|
||||||
return createLabel(addr, name, namespace, source);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean removeSymbolSpecial(Symbol sym) {
|
public boolean removeSymbolSpecial(Symbol sym) {
|
||||||
// TODO: I'm not sure I understand the point of this method...
|
// TODO: I'm not sure I understand the point of this method...
|
||||||
|
@ -196,26 +184,6 @@ public class DBTraceProgramViewSymbolTable implements SymbolTable {
|
||||||
return getSymbol(name, addr, global);
|
return getSymbol(name, addr, global);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public Symbol getSymbol(String name, Namespace namespace) {
|
|
||||||
try (LockHold hold = program.trace.lockRead()) {
|
|
||||||
for (TraceSymbol sym : symbolManager.allSymbols()
|
|
||||||
.getChildrenNamed(name,
|
|
||||||
assertTraceNamespace(namespace))) {
|
|
||||||
if (requireVisible(sym) == null) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
return sym;
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Symbol getSymbol(String name) {
|
|
||||||
return getSymbol(name, global);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<Symbol> getSymbols(String name, Namespace namespace) {
|
public List<Symbol> getSymbols(String name, Namespace namespace) {
|
||||||
TraceNamespaceSymbol parent = assertTraceNamespace(namespace);
|
TraceNamespaceSymbol parent = assertTraceNamespace(namespace);
|
||||||
|
|
|
@ -56,7 +56,7 @@ public class PropagateExternalParametersScript extends GhidraScript {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// use the 'results' to propagate param info to the local variables, data, and params of
|
// use the 'results' to propagate param info to the local variables, data, and params of
|
||||||
// the calling function
|
// the calling function
|
||||||
//println("Processing propagation results - count: " + results.size());
|
//println("Processing propagation results - count: " + results.size());
|
||||||
for (int i = 0; i < results.size(); i++) {
|
for (int i = 0; i < results.size(); i++) {
|
||||||
|
@ -68,7 +68,7 @@ public class PropagateExternalParametersScript extends GhidraScript {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
//If operand of pushed parameter points to data make a symbol and comment at that location
|
//If operand of pushed parameter points to data make a symbol and comment at that location
|
||||||
if (((opType & OperandType.ADDRESS) != 0) && (((opType & OperandType.DATA) != 0)) ||
|
if (((opType & OperandType.ADDRESS) != 0) && (((opType & OperandType.DATA) != 0)) ||
|
||||||
((opType & OperandType.SCALAR) != 0) || ((opType & OperandType.DYNAMIC) != 0)) {
|
((opType & OperandType.SCALAR) != 0) || ((opType & OperandType.DYNAMIC) != 0)) {
|
||||||
Reference[] refs = listing.getCodeUnitAt(ppi.getAddress()).getOperandReferences(0);
|
Reference[] refs = listing.getCodeUnitAt(ppi.getAddress()).getOperandReferences(0);
|
||||||
|
@ -88,7 +88,9 @@ public class PropagateExternalParametersScript extends GhidraScript {
|
||||||
String newComment = new String(
|
String newComment = new String(
|
||||||
ppi.getName() + " parameter of " + ppi.getCalledFunctionName() + "\n");
|
ppi.getName() + " parameter of " + ppi.getCalledFunctionName() + "\n");
|
||||||
|
|
||||||
if ((getSymbol(symbolName, null) == null) && (isString == false)) {
|
List<Symbol> symbols = getSymbols(symbolName, null);
|
||||||
|
|
||||||
|
if (symbols.isEmpty() && !isString) {
|
||||||
createLabel(dataAddress, symbolName, true, SourceType.USER_DEFINED);
|
createLabel(dataAddress, symbolName, true, SourceType.USER_DEFINED);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -101,8 +103,10 @@ public class PropagateExternalParametersScript extends GhidraScript {
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((data != null) &&
|
if ((data != null) &&
|
||||||
(listing.getCodeUnitAt(dataAddress).getMnemonicString().startsWith(
|
(listing.getCodeUnitAt(dataAddress)
|
||||||
"undefined"))) {
|
.getMnemonicString()
|
||||||
|
.startsWith(
|
||||||
|
"undefined"))) {
|
||||||
clearListing(dataAddress);
|
clearListing(dataAddress);
|
||||||
}
|
}
|
||||||
if (listing.isUndefined(dataAddress, dataAddress.add(dt.getLength() - 1))) {
|
if (listing.isUndefined(dataAddress, dataAddress.add(dt.getLength() - 1))) {
|
||||||
|
@ -182,7 +186,7 @@ public class PropagateExternalParametersScript extends GhidraScript {
|
||||||
* PUSH arg 2 to call func2 |
|
* PUSH arg 2 to call func2 |
|
||||||
* PUSH arg 1 to call func2 | -- want to bypass these
|
* PUSH arg 1 to call func2 | -- want to bypass these
|
||||||
* CALL func2 ___|
|
* CALL func2 ___|
|
||||||
* PUSH arg 2 to call func1 ; put arg2 of func1 here
|
* PUSH arg 2 to call func1 ; put arg2 of func1 here
|
||||||
* PUSH arg 1 to call func1 ; put arg1 of func1 here
|
* PUSH arg 1 to call func1 ; put arg1 of func1 here
|
||||||
* CALL func1
|
* CALL func1
|
||||||
*/
|
*/
|
||||||
|
@ -272,7 +276,7 @@ public class PropagateExternalParametersScript extends GhidraScript {
|
||||||
// need to take into account calls between the pushes and skip the pushes for those calls
|
// need to take into account calls between the pushes and skip the pushes for those calls
|
||||||
// skip pushes that are used for another call
|
// skip pushes that are used for another call
|
||||||
|
|
||||||
// if label, then probably a branch, allow current push to be commented and
|
// if label, then probably a branch, allow current push to be commented and
|
||||||
// next time through stop
|
// next time through stop
|
||||||
// can also be a branch if not label there but this case should still have parameters set
|
// can also be a branch if not label there but this case should still have parameters set
|
||||||
// before it as long as not an unconditional jump - this wouldn't make sense so it shouldn't happen
|
// before it as long as not an unconditional jump - this wouldn't make sense so it shouldn't happen
|
||||||
|
@ -292,7 +296,7 @@ public class PropagateExternalParametersScript extends GhidraScript {
|
||||||
else {
|
else {
|
||||||
setEOLComment(cu.getMinAddress(), params[index].getDataType().getDisplayName() +
|
setEOLComment(cu.getMinAddress(), params[index].getDataType().getDisplayName() +
|
||||||
" " + params[index].getName() + " for " + extFuncName);
|
" " + params[index].getName() + " for " + extFuncName);
|
||||||
// add the following to the EOL comment to see the value of the optype
|
// add the following to the EOL comment to see the value of the optype
|
||||||
// +" " + toHexString(currentProgram.getListing().getInstructionAt(cu.getMinAddress()).getOperandType(0), false, true)
|
// +" " + toHexString(currentProgram.getListing().getInstructionAt(cu.getMinAddress()).getOperandType(0), false, true)
|
||||||
addResult(params[index].getName(), params[index].getDataType(),
|
addResult(params[index].getName(), params[index].getDataType(),
|
||||||
cu.getMinAddress(), extFuncName);
|
cu.getMinAddress(), extFuncName);
|
||||||
|
|
|
@ -56,16 +56,14 @@ import ghidra.util.task.TaskMonitor;
|
||||||
* <p>
|
* <p>
|
||||||
* NOTE:
|
* NOTE:
|
||||||
* <ol>
|
* <ol>
|
||||||
* <li>NO METHODS SHOULD EVER BE REMOVED FROM THIS CLASS.
|
* <li>NO METHODS *SHOULD* EVER BE REMOVED FROM THIS CLASS.
|
||||||
* <li>NO METHOD SIGNATURES SHOULD EVER BE CHANGED IN THIS CLASS.
|
* <li>NO METHOD SIGNATURES *SHOULD* EVER BE CHANGED IN THIS CLASS.
|
||||||
* </ol>
|
* </ol>
|
||||||
* <p>
|
* <p>
|
||||||
* This class is used by GhidraScript.
|
* This class is used by GhidraScript.
|
||||||
* <p>
|
* <p>
|
||||||
* Changing this class will break user scripts.
|
* Changing this class will break user scripts.
|
||||||
* <p>
|
* <p>
|
||||||
* That is bad. Don't do that.
|
|
||||||
* <p>
|
|
||||||
*/
|
*/
|
||||||
public class FlatProgramAPI {
|
public class FlatProgramAPI {
|
||||||
public static final int MAX_REFERENCES_TO = 0x1000;
|
public static final int MAX_REFERENCES_TO = 0x1000;
|
||||||
|
@ -239,7 +237,7 @@ public class FlatProgramAPI {
|
||||||
/**
|
/**
|
||||||
* Clears the code unit (instruction or data) defined at the address.
|
* Clears the code unit (instruction or data) defined at the address.
|
||||||
* @param address the address to clear the code unit
|
* @param address the address to clear the code unit
|
||||||
* @throws CancelledException
|
* @throws CancelledException if cancelled
|
||||||
*/
|
*/
|
||||||
public final void clearListing(Address address) throws CancelledException {
|
public final void clearListing(Address address) throws CancelledException {
|
||||||
clearListing(address, address);
|
clearListing(address, address);
|
||||||
|
@ -249,7 +247,7 @@ public class FlatProgramAPI {
|
||||||
* Clears the code units (instructions or data) in the specified range.
|
* Clears the code units (instructions or data) in the specified range.
|
||||||
* @param start the start address
|
* @param start the start address
|
||||||
* @param end the end address
|
* @param end the end address
|
||||||
* @throws CancelledException
|
* @throws CancelledException if cancelled
|
||||||
*/
|
*/
|
||||||
public final void clearListing(Address start, Address end) throws CancelledException {
|
public final void clearListing(Address start, Address end) throws CancelledException {
|
||||||
currentProgram.getListing().clearCodeUnits(start, end, false, monitor);
|
currentProgram.getListing().clearCodeUnits(start, end, false, monitor);
|
||||||
|
@ -258,7 +256,7 @@ public class FlatProgramAPI {
|
||||||
/**
|
/**
|
||||||
* Clears the code units (instructions or data) in the specified set
|
* Clears the code units (instructions or data) in the specified set
|
||||||
* @param set the set to clear
|
* @param set the set to clear
|
||||||
* @throws CancelledException
|
* @throws CancelledException if cancelled
|
||||||
*/
|
*/
|
||||||
public final void clearListing(AddressSetView set) throws CancelledException {
|
public final void clearListing(AddressSetView set) throws CancelledException {
|
||||||
AddressRangeIterator iter = set.getAddressRanges();
|
AddressRangeIterator iter = set.getAddressRanges();
|
||||||
|
@ -320,6 +318,7 @@ public class FlatProgramAPI {
|
||||||
* @param length the size of the block
|
* @param length the size of the block
|
||||||
* @param overlay true will create an overlay, false will not
|
* @param overlay true will create an overlay, false will not
|
||||||
* @return the newly created memory block
|
* @return the newly created memory block
|
||||||
|
* @throws Exception if there is any exception
|
||||||
*/
|
*/
|
||||||
public final MemoryBlock createMemoryBlock(String name, Address start, InputStream input,
|
public final MemoryBlock createMemoryBlock(String name, Address start, InputStream input,
|
||||||
long length, boolean overlay) throws Exception {
|
long length, boolean overlay) throws Exception {
|
||||||
|
@ -340,6 +339,7 @@ public class FlatProgramAPI {
|
||||||
* @param bytes the bytes of the memory block
|
* @param bytes the bytes of the memory block
|
||||||
* @param overlay true will create an overlay, false will not
|
* @param overlay true will create an overlay, false will not
|
||||||
* @return the newly created memory block
|
* @return the newly created memory block
|
||||||
|
* @throws Exception if there is any exception
|
||||||
*/
|
*/
|
||||||
public final MemoryBlock createMemoryBlock(String name, Address start, byte[] bytes,
|
public final MemoryBlock createMemoryBlock(String name, Address start, byte[] bytes,
|
||||||
boolean overlay) throws Exception {
|
boolean overlay) throws Exception {
|
||||||
|
@ -384,6 +384,7 @@ public class FlatProgramAPI {
|
||||||
* NOTE: ALL ANNOTATION (disassembly, comments, etc) defined in this
|
* NOTE: ALL ANNOTATION (disassembly, comments, etc) defined in this
|
||||||
* memory block will also be removed!
|
* memory block will also be removed!
|
||||||
* @param block the block to be removed
|
* @param block the block to be removed
|
||||||
|
* @throws Exception if there is any exception
|
||||||
*/
|
*/
|
||||||
public final void removeMemoryBlock(MemoryBlock block) throws Exception {
|
public final void removeMemoryBlock(MemoryBlock block) throws Exception {
|
||||||
currentProgram.getMemory().removeBlock(block, monitor);
|
currentProgram.getMemory().removeBlock(block, monitor);
|
||||||
|
@ -396,6 +397,7 @@ public class FlatProgramAPI {
|
||||||
* @param name the name of the symbol
|
* @param name the name of the symbol
|
||||||
* @param makePrimary true if the symbol should be made primary
|
* @param makePrimary true if the symbol should be made primary
|
||||||
* @return the newly created code or function symbol
|
* @return the newly created code or function symbol
|
||||||
|
* @throws Exception if there is any exception
|
||||||
*/
|
*/
|
||||||
public final Symbol createLabel(Address address, String name, boolean makePrimary)
|
public final Symbol createLabel(Address address, String name, boolean makePrimary)
|
||||||
throws Exception {
|
throws Exception {
|
||||||
|
@ -422,6 +424,7 @@ public class FlatProgramAPI {
|
||||||
* @param makePrimary true if the symbol should be made primary
|
* @param makePrimary true if the symbol should be made primary
|
||||||
* @param sourceType the source type.
|
* @param sourceType the source type.
|
||||||
* @return the newly created code or function symbol
|
* @return the newly created code or function symbol
|
||||||
|
* @throws Exception if there is any exception
|
||||||
*/
|
*/
|
||||||
public final Symbol createLabel(Address address, String name, boolean makePrimary,
|
public final Symbol createLabel(Address address, String name, boolean makePrimary,
|
||||||
SourceType sourceType) throws Exception {
|
SourceType sourceType) throws Exception {
|
||||||
|
@ -439,6 +442,7 @@ public class FlatProgramAPI {
|
||||||
* @param makePrimary true if the symbol should be made primary
|
* @param makePrimary true if the symbol should be made primary
|
||||||
* @param sourceType the source type.
|
* @param sourceType the source type.
|
||||||
* @return the newly created code or function symbol
|
* @return the newly created code or function symbol
|
||||||
|
* @throws Exception if there is any exception
|
||||||
*/
|
*/
|
||||||
public final Symbol createLabel(Address address, String name, Namespace namespace,
|
public final Symbol createLabel(Address address, String name, Namespace namespace,
|
||||||
boolean makePrimary, SourceType sourceType) throws Exception {
|
boolean makePrimary, SourceType sourceType) throws Exception {
|
||||||
|
@ -936,13 +940,16 @@ public class FlatProgramAPI {
|
||||||
* Search for sequences of Ascii strings in program memory. See {@link AsciiCharSetRecognizer}
|
* Search for sequences of Ascii strings in program memory. See {@link AsciiCharSetRecognizer}
|
||||||
* to see exactly what chars are considered ASCII for purposes of this search.
|
* to see exactly what chars are considered ASCII for purposes of this search.
|
||||||
* @param addressSet The address set to search. Use null to search all memory;
|
* @param addressSet The address set to search. Use null to search all memory;
|
||||||
* @param minimumStringLength The smallest number of chars in a sequence to be considered a "string".
|
* @param minimumStringLength The smallest number of chars in a sequence to be considered a
|
||||||
* @param alignment specifies any alignment requirements for the start of the string. An alignment
|
* "string".
|
||||||
* of 1, means the string can start at any address. An alignment of 2 means the string must
|
* @param alignment specifies any alignment requirements for the start of the string. An
|
||||||
* start on an even address and so on. Only allowed values are 1,2, and 4.
|
* alignment of 1, means the string can start at any address. An alignment of 2 means the
|
||||||
|
* string must start on an even address and so on. Only allowed values are 1,2, and 4.
|
||||||
* @param requireNullTermination If true, only strings that end in a null will be returned.
|
* @param requireNullTermination If true, only strings that end in a null will be returned.
|
||||||
* @param includeAllCharWidths if true, UTF16 and UTF32 size strings will be included in addition to UTF8.
|
* @param includeAllCharWidths if true, UTF16 and UTF32 size strings will be included in
|
||||||
* @return a list of "FoundString" objects which contain the addresses, length, and type of possible strings.
|
* addition to UTF8.
|
||||||
|
* @return a list of "FoundString" objects which contain the addresses, length, and type of
|
||||||
|
* possible strings.
|
||||||
*/
|
*/
|
||||||
public List<FoundString> findStrings(AddressSetView addressSet, int minimumStringLength,
|
public List<FoundString> findStrings(AddressSetView addressSet, int minimumStringLength,
|
||||||
int alignment, boolean requireNullTermination, boolean includeAllCharWidths) {
|
int alignment, boolean requireNullTermination, boolean includeAllCharWidths) {
|
||||||
|
@ -959,15 +966,18 @@ public class FlatProgramAPI {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Search for sequences of Pascal Ascii strings in program memory. See {@link AsciiCharSetRecognizer}
|
* Search for sequences of Pascal Ascii strings in program memory. See
|
||||||
* to see exactly what chars are considered ASCII for purposes of this search.
|
* {@link AsciiCharSetRecognizer} to see exactly what chars are considered ASCII for purposes
|
||||||
|
* of this search.
|
||||||
* @param addressSet The address set to search. Use null to search all memory;
|
* @param addressSet The address set to search. Use null to search all memory;
|
||||||
* @param minimumStringLength The smallest number of chars in a sequence to be considered a "string".
|
* @param minimumStringLength The smallest number of chars in a sequence to be considered a
|
||||||
* @param alignment specifies any alignment requirements for the start of the string. An alignment
|
* "string".
|
||||||
* of 1, means the string can start at any address. An alignment of 2 means the string must
|
* @param alignment specifies any alignment requirements for the start of the string. An
|
||||||
* start on an even address and so on. Only allowed values are 1,2, and 4.
|
* alignment of 1, means the string can start at any address. An alignment of 2 means the
|
||||||
|
* string must start on an even address and so on. Only allowed values are 1,2, and 4.
|
||||||
* @param includePascalUnicode if true, UTF16 size strings will be included in addition to UTF8.
|
* @param includePascalUnicode if true, UTF16 size strings will be included in addition to UTF8.
|
||||||
* @return a list of "FoundString" objects which contain the addresses, length, and type of possible strings.
|
* @return a list of "FoundString" objects which contain the addresses, length, and type of
|
||||||
|
* possible strings.
|
||||||
*/
|
*/
|
||||||
public List<FoundString> findPascalStrings(AddressSetView addressSet, int minimumStringLength,
|
public List<FoundString> findPascalStrings(AddressSetView addressSet, int minimumStringLength,
|
||||||
int alignment, boolean includePascalUnicode) {
|
int alignment, boolean includePascalUnicode) {
|
||||||
|
@ -1061,7 +1071,7 @@ public class FlatProgramAPI {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
Function func = iterator.next();
|
Function func = iterator.next();
|
||||||
// if the function found starts at the start addres, go to the next one.
|
// if the function found starts at the start address, go to the next one.
|
||||||
if (address.equals(func.getEntryPoint())) {
|
if (address.equals(func.getEntryPoint())) {
|
||||||
func = null;
|
func = null;
|
||||||
if (iterator.hasNext()) {
|
if (iterator.hasNext()) {
|
||||||
|
@ -1101,7 +1111,7 @@ public class FlatProgramAPI {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
Function func = iterator.next();
|
Function func = iterator.next();
|
||||||
// if the function found starts at the start addres, go to the next one.
|
// if the function found starts at the start address, go to the next one.
|
||||||
if (address.equals(func.getEntryPoint())) {
|
if (address.equals(func.getEntryPoint())) {
|
||||||
func = null;
|
func = null;
|
||||||
if (iterator.hasNext()) {
|
if (iterator.hasNext()) {
|
||||||
|
@ -1176,6 +1186,7 @@ public class FlatProgramAPI {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the first instruction in the function.
|
* Returns the first instruction in the function.
|
||||||
|
* @param function the function
|
||||||
* @return the first instruction in the function
|
* @return the first instruction in the function
|
||||||
*/
|
*/
|
||||||
public final Instruction getFirstInstruction(Function function) {
|
public final Instruction getFirstInstruction(Function function) {
|
||||||
|
@ -1633,6 +1644,7 @@ public class FlatProgramAPI {
|
||||||
* @param address the address at which to create a new Data object.
|
* @param address the address at which to create a new Data object.
|
||||||
* @param datatype the Data Type that describes the type of Data object to create.
|
* @param datatype the Data Type that describes the type of Data object to create.
|
||||||
* @return the newly created Data object
|
* @return the newly created Data object
|
||||||
|
* @throws Exception if there is any exception
|
||||||
*/
|
*/
|
||||||
public final Data createData(Address address, DataType datatype) throws Exception {
|
public final Data createData(Address address, DataType datatype) throws Exception {
|
||||||
Listing listing = currentProgram.getListing();
|
Listing listing = currentProgram.getListing();
|
||||||
|
@ -1650,6 +1662,7 @@ public class FlatProgramAPI {
|
||||||
* Creates a byte datatype at the given address.
|
* Creates a byte datatype at the given address.
|
||||||
* @param address the address to create the byte
|
* @param address the address to create the byte
|
||||||
* @return the newly created Data object
|
* @return the newly created Data object
|
||||||
|
* @throws Exception if there is any exception
|
||||||
*/
|
*/
|
||||||
public final Data createByte(Address address) throws Exception {
|
public final Data createByte(Address address) throws Exception {
|
||||||
return createData(address, new ByteDataType());
|
return createData(address, new ByteDataType());
|
||||||
|
@ -1659,6 +1672,7 @@ public class FlatProgramAPI {
|
||||||
* Creates a word datatype at the given address.
|
* Creates a word datatype at the given address.
|
||||||
* @param address the address to create the word
|
* @param address the address to create the word
|
||||||
* @return the newly created Data object
|
* @return the newly created Data object
|
||||||
|
* @throws Exception if there is any exception
|
||||||
*/
|
*/
|
||||||
public final Data createWord(Address address) throws Exception {
|
public final Data createWord(Address address) throws Exception {
|
||||||
return createData(address, new WordDataType());
|
return createData(address, new WordDataType());
|
||||||
|
@ -1668,6 +1682,7 @@ public class FlatProgramAPI {
|
||||||
* Creates a dword datatype at the given address.
|
* Creates a dword datatype at the given address.
|
||||||
* @param address the address to create the dword
|
* @param address the address to create the dword
|
||||||
* @return the newly created Data object
|
* @return the newly created Data object
|
||||||
|
* @throws Exception if there is any exception
|
||||||
*/
|
*/
|
||||||
public final Data createDWord(Address address) throws Exception {
|
public final Data createDWord(Address address) throws Exception {
|
||||||
return createData(address, new DWordDataType());
|
return createData(address, new DWordDataType());
|
||||||
|
@ -1677,6 +1692,7 @@ public class FlatProgramAPI {
|
||||||
* Creates a list of dword datatypes starting at the given address.
|
* Creates a list of dword datatypes starting at the given address.
|
||||||
* @param start the start address to create the dwords
|
* @param start the start address to create the dwords
|
||||||
* @param count the number of dwords to create
|
* @param count the number of dwords to create
|
||||||
|
* @throws Exception if there is any exception
|
||||||
*/
|
*/
|
||||||
public final void createDwords(Address start, int count) throws Exception {
|
public final void createDwords(Address start, int count) throws Exception {
|
||||||
for (int i = 0; i < count; ++i) {
|
for (int i = 0; i < count; ++i) {
|
||||||
|
@ -1689,6 +1705,7 @@ public class FlatProgramAPI {
|
||||||
* Creates a qword datatype at the given address.
|
* Creates a qword datatype at the given address.
|
||||||
* @param address the address to create the qword
|
* @param address the address to create the qword
|
||||||
* @return the newly created Data object
|
* @return the newly created Data object
|
||||||
|
* @throws Exception if there is any exception
|
||||||
*/
|
*/
|
||||||
public final Data createQWord(Address address) throws Exception {
|
public final Data createQWord(Address address) throws Exception {
|
||||||
return createData(address, new QWordDataType());
|
return createData(address, new QWordDataType());
|
||||||
|
@ -1698,6 +1715,7 @@ public class FlatProgramAPI {
|
||||||
* Creates a float datatype at the given address.
|
* Creates a float datatype at the given address.
|
||||||
* @param address the address to create the float
|
* @param address the address to create the float
|
||||||
* @return the newly created Data object
|
* @return the newly created Data object
|
||||||
|
* @throws Exception if there is any exception
|
||||||
*/
|
*/
|
||||||
public final Data createFloat(Address address) throws Exception {
|
public final Data createFloat(Address address) throws Exception {
|
||||||
return createData(address, new FloatDataType());
|
return createData(address, new FloatDataType());
|
||||||
|
@ -1707,6 +1725,7 @@ public class FlatProgramAPI {
|
||||||
* Creates a double datatype at the given address.
|
* Creates a double datatype at the given address.
|
||||||
* @param address the address to create the double
|
* @param address the address to create the double
|
||||||
* @return the newly created Data object
|
* @return the newly created Data object
|
||||||
|
* @throws Exception if there is any exception
|
||||||
*/
|
*/
|
||||||
public final Data createDouble(Address address) throws Exception {
|
public final Data createDouble(Address address) throws Exception {
|
||||||
return createData(address, new DoubleDataType());
|
return createData(address, new DoubleDataType());
|
||||||
|
@ -1716,6 +1735,7 @@ public class FlatProgramAPI {
|
||||||
* Creates a char datatype at the given address.
|
* Creates a char datatype at the given address.
|
||||||
* @param address the address to create the char
|
* @param address the address to create the char
|
||||||
* @return the newly created Data object
|
* @return the newly created Data object
|
||||||
|
* @throws Exception if there is any exception
|
||||||
*/
|
*/
|
||||||
public final Data createChar(Address address) throws Exception {
|
public final Data createChar(Address address) throws Exception {
|
||||||
return createData(address, new CharDataType());
|
return createData(address, new CharDataType());
|
||||||
|
@ -1726,6 +1746,7 @@ public class FlatProgramAPI {
|
||||||
* at the specified address.
|
* at the specified address.
|
||||||
* @param address the address to create the string
|
* @param address the address to create the string
|
||||||
* @return the newly created Data object
|
* @return the newly created Data object
|
||||||
|
* @throws Exception if there is any exception
|
||||||
*/
|
*/
|
||||||
public final Data createAsciiString(Address address) throws Exception {
|
public final Data createAsciiString(Address address) throws Exception {
|
||||||
return createData(address, new TerminatedStringDataType());
|
return createData(address, new TerminatedStringDataType());
|
||||||
|
@ -1733,12 +1754,11 @@ public class FlatProgramAPI {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create an ASCII string at the specified address.
|
* Create an ASCII string at the specified address.
|
||||||
* @param address
|
* @param address the address
|
||||||
* @param length length of string (a value of 0 or negative will force use
|
* @param length length of string (a value of 0 or negative will force use
|
||||||
* of dynamic null terminated string)
|
* of dynamic null terminated string)
|
||||||
* @return string data created
|
* @return string data created
|
||||||
* @throws CodeUnitInsertionException
|
* @throws CodeUnitInsertionException if there is a data conflict
|
||||||
* @throws DataTypeConflictException
|
|
||||||
*/
|
*/
|
||||||
public final Data createAsciiString(Address address, int length)
|
public final Data createAsciiString(Address address, int length)
|
||||||
throws CodeUnitInsertionException {
|
throws CodeUnitInsertionException {
|
||||||
|
@ -1761,11 +1781,10 @@ public class FlatProgramAPI {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a null terminated unicode string starting
|
* Creates a null terminated unicode string starting at the specified address.
|
||||||
* at the specified address.
|
|
||||||
* @param address the address to create the string
|
* @param address the address to create the string
|
||||||
* @return the newly created Data object
|
* @return the newly created Data object
|
||||||
* @throws Exception
|
* @throws Exception if there is any exception
|
||||||
*/
|
*/
|
||||||
public final Data createUnicodeString(Address address) throws Exception {
|
public final Data createUnicodeString(Address address) throws Exception {
|
||||||
return createData(address, new TerminatedUnicodeDataType());
|
return createData(address, new TerminatedUnicodeDataType());
|
||||||
|
@ -1774,6 +1793,7 @@ public class FlatProgramAPI {
|
||||||
/**
|
/**
|
||||||
* Removes the given data from the current program.
|
* Removes the given data from the current program.
|
||||||
* @param data the data to remove
|
* @param data the data to remove
|
||||||
|
* @throws Exception if there is any exception
|
||||||
*/
|
*/
|
||||||
public final void removeData(Data data) throws Exception {
|
public final void removeData(Data data) throws Exception {
|
||||||
clearListing(data.getMinAddress(), data.getMaxAddress());
|
clearListing(data.getMinAddress(), data.getMaxAddress());
|
||||||
|
@ -1782,6 +1802,7 @@ public class FlatProgramAPI {
|
||||||
/**
|
/**
|
||||||
* Removes the data containing the given address from the current program.
|
* Removes the data containing the given address from the current program.
|
||||||
* @param address the address to remove data
|
* @param address the address to remove data
|
||||||
|
* @throws Exception if there is any exception
|
||||||
*/
|
*/
|
||||||
public final void removeDataAt(Address address) throws Exception {
|
public final void removeDataAt(Address address) throws Exception {
|
||||||
Data data = getDataContaining(address);
|
Data data = getDataContaining(address);
|
||||||
|
@ -1793,6 +1814,7 @@ public class FlatProgramAPI {
|
||||||
/**
|
/**
|
||||||
* Removes the given instruction from the current program.
|
* Removes the given instruction from the current program.
|
||||||
* @param instruction the instruction to remove
|
* @param instruction the instruction to remove
|
||||||
|
* @throws Exception if there is any exception
|
||||||
*/
|
*/
|
||||||
public final void removeInstruction(Instruction instruction) throws Exception {
|
public final void removeInstruction(Instruction instruction) throws Exception {
|
||||||
clearListing(instruction.getMinAddress(), instruction.getMaxAddress());
|
clearListing(instruction.getMinAddress(), instruction.getMaxAddress());
|
||||||
|
@ -1801,6 +1823,7 @@ public class FlatProgramAPI {
|
||||||
/**
|
/**
|
||||||
* Removes the instruction containing the given address from the current program.
|
* Removes the instruction containing the given address from the current program.
|
||||||
* @param address the address to remove instruction
|
* @param address the address to remove instruction
|
||||||
|
* @throws Exception if there is any exception
|
||||||
*/
|
*/
|
||||||
public final void removeInstructionAt(Address address) throws Exception {
|
public final void removeInstructionAt(Address address) throws Exception {
|
||||||
Instruction instruction = getInstructionContaining(address);
|
Instruction instruction = getInstructionContaining(address);
|
||||||
|
@ -2259,6 +2282,7 @@ public class FlatProgramAPI {
|
||||||
* @param equateName the name of the equate
|
* @param equateName the name of the equate
|
||||||
* @return the newly created equate
|
* @return the newly created equate
|
||||||
* @throws InvalidInputException if a scalar does not exist on the data
|
* @throws InvalidInputException if a scalar does not exist on the data
|
||||||
|
* @throws Exception if there is any exception
|
||||||
*/
|
*/
|
||||||
public final Equate createEquate(Data data, String equateName) throws Exception {
|
public final Equate createEquate(Data data, String equateName) throws Exception {
|
||||||
Object value = data.getValue();
|
Object value = data.getValue();
|
||||||
|
@ -2273,18 +2297,6 @@ public class FlatProgramAPI {
|
||||||
"Unable to create equate on non-scalar value at " + data.getMinAddress());
|
"Unable to create equate on non-scalar value at " + data.getMinAddress());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the equate defined at the operand index of the instruction.
|
|
||||||
* @param instruction the instruction
|
|
||||||
* @param operandIndex the operand index
|
|
||||||
* @return the equate defined at the operand index of the instruction
|
|
||||||
* @deprecated this form of getEquate is not supported and will throw a UnsupportedOperationException
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
public final Equate getEquate(Instruction instruction, int operandIndex) {
|
|
||||||
throw new UnsupportedOperationException("this form of getEquate is unsupported");
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the equate defined at the operand index of the instruction with the given value.
|
* Returns the equate defined at the operand index of the instruction with the given value.
|
||||||
* @param instruction the instruction
|
* @param instruction the instruction
|
||||||
|
@ -2325,17 +2337,6 @@ public class FlatProgramAPI {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Removes the equate defined at the operand index of the instruction.
|
|
||||||
* @param instruction the instruction
|
|
||||||
* @param operandIndex the operand index
|
|
||||||
* @deprecated this form of getEquate is not supported and will throw a UnsupportedOperationException
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
public final void removeEquate(Instruction instruction, int operandIndex) {
|
|
||||||
throw new UnsupportedOperationException("this form of removeEquate is unsupported");
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Removes the equate defined at the operand index of the instruction with the given value.
|
* Removes the equate defined at the operand index of the instruction with the given value.
|
||||||
* @param instruction the instruction
|
* @param instruction the instruction
|
||||||
|
@ -2431,6 +2432,8 @@ public class FlatProgramAPI {
|
||||||
* Opens a Data Type Archive
|
* Opens a Data Type Archive
|
||||||
* @param archiveFile the archive file to open
|
* @param archiveFile the archive file to open
|
||||||
* @param readOnly should file be opened read only
|
* @param readOnly should file be opened read only
|
||||||
|
* @return the data type manager
|
||||||
|
* @throws Exception if there is any exception
|
||||||
*/
|
*/
|
||||||
public final FileDataTypeManager openDataTypeArchive(File archiveFile, boolean readOnly)
|
public final FileDataTypeManager openDataTypeArchive(File archiveFile, boolean readOnly)
|
||||||
throws Exception {
|
throws Exception {
|
||||||
|
@ -2445,7 +2448,7 @@ public class FlatProgramAPI {
|
||||||
* If a program already exists with the specified
|
* If a program already exists with the specified
|
||||||
* name, then a time stamp will be appended to the name to make it unique.
|
* name, then a time stamp will be appended to the name to make it unique.
|
||||||
* @param program the program to save
|
* @param program the program to save
|
||||||
* @throws Exception
|
* @throws Exception if there is any exception
|
||||||
*/
|
*/
|
||||||
public void saveProgram(Program program) throws Exception {
|
public void saveProgram(Program program) throws Exception {
|
||||||
saveProgram(program, null);
|
saveProgram(program, null);
|
||||||
|
@ -2460,13 +2463,14 @@ public class FlatProgramAPI {
|
||||||
* If path is NULL, the program will be saved into the root folder. If parts of the path are
|
* If path is NULL, the program will be saved into the root folder. If parts of the path are
|
||||||
* missing, they will be created if possible.
|
* missing, they will be created if possible.
|
||||||
* <p>
|
* <p>
|
||||||
* If a program already exists with the specified name, then a time stamp will be appended
|
* If a program already exists with the specified name, then a time stamp will be appended
|
||||||
* to the name to make it unique.
|
* to the name to make it unique.
|
||||||
* <p>
|
* <p>
|
||||||
* @param program the program to save
|
* @param program the program to save
|
||||||
* @param path list of string path elements (starting at the root of the project) that specify
|
* @param path list of string path elements (starting at the root of the project) that specify
|
||||||
* the project folder to save the program info. Example: { "folder1", "subfolder2", "finalfolder" }
|
* the project folder to save the program info. Example: { "folder1", "subfolder2",
|
||||||
* @throws Exception
|
* "final_folder" }
|
||||||
|
* @throws Exception if there is any exception
|
||||||
*/
|
*/
|
||||||
public void saveProgram(Program program, List<String> path) throws Exception {
|
public void saveProgram(Program program, List<String> path) throws Exception {
|
||||||
if (program == null) {
|
if (program == null) {
|
||||||
|
@ -2533,12 +2537,6 @@ public class FlatProgramAPI {
|
||||||
return folder;
|
return folder;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @param type
|
|
||||||
* @param text
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
private Address findComment(int type, String text) {
|
private Address findComment(int type, String text) {
|
||||||
Listing listing = currentProgram.getListing();
|
Listing listing = currentProgram.getListing();
|
||||||
Memory memory = currentProgram.getMemory();
|
Memory memory = currentProgram.getMemory();
|
||||||
|
|
|
@ -62,8 +62,8 @@ import ghidra.program.database.ProgramBuilder;
|
||||||
import ghidra.program.database.ProgramDB;
|
import ghidra.program.database.ProgramDB;
|
||||||
import ghidra.program.database.data.ProgramDataTypeManager;
|
import ghidra.program.database.data.ProgramDataTypeManager;
|
||||||
import ghidra.program.model.data.*;
|
import ghidra.program.model.data.*;
|
||||||
import ghidra.test.*;
|
import ghidra.test.AbstractGhidraHeadedIntegrationTest;
|
||||||
import ghidra.util.task.TaskMonitor;
|
import ghidra.test.TestEnv;
|
||||||
import util.CollectionUtils;
|
import util.CollectionUtils;
|
||||||
import utilities.util.FileUtilities;
|
import utilities.util.FileUtilities;
|
||||||
|
|
||||||
|
@ -1088,18 +1088,6 @@ public class DataTypeManagerPluginTest extends AbstractGhidraHeadedIntegrationTe
|
||||||
waitForTree();
|
waitForTree();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void waitForActionToBeEnabled(DockingActionIf action) {
|
|
||||||
int numWaits = 0;
|
|
||||||
while (!action.isEnabled() && ++numWaits < 50) {
|
|
||||||
try {
|
|
||||||
Thread.sleep(100);
|
|
||||||
}
|
|
||||||
catch (InterruptedException e) {
|
|
||||||
// don't care; will try again
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void undo() throws Exception {
|
private void undo() throws Exception {
|
||||||
runSwing(() -> {
|
runSwing(() -> {
|
||||||
try {
|
try {
|
||||||
|
@ -1204,33 +1192,6 @@ public class DataTypeManagerPluginTest extends AbstractGhidraHeadedIntegrationTe
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void compileJavaDataType() throws Exception {
|
|
||||||
|
|
||||||
boolean success = false;
|
|
||||||
try {
|
|
||||||
File file = getTestDataTypeFile();
|
|
||||||
File binDir = getClassesDirectory();
|
|
||||||
if (!binDir.exists()) {
|
|
||||||
if (!binDir.mkdir()) {
|
|
||||||
Assert.fail("Could not create directory " + binDir.getAbsolutePath());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
File javaFile = new File(binDir, "TestDataType.java");
|
|
||||||
FileUtilities.copyFile(file, javaFile, false, TaskMonitor.DUMMY);
|
|
||||||
assertTrue(javaFile.exists());
|
|
||||||
|
|
||||||
JavaCompiler j = new JavaCompiler();
|
|
||||||
j.compile(javaFile);
|
|
||||||
success = true;
|
|
||||||
}
|
|
||||||
finally {
|
|
||||||
if (!success) {
|
|
||||||
removeBinTestDir();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private File getTestDataTypeFile() {
|
private File getTestDataTypeFile() {
|
||||||
URL url = getClass().getResource("TestDataType.txt");
|
URL url = getClass().getResource("TestDataType.txt");
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -1,37 +0,0 @@
|
||||||
/* ###
|
|
||||||
* 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.app.decompiler.component;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A poorly designed interface that does not correctly allow for modifying highlights
|
|
||||||
*/
|
|
||||||
@Deprecated // this will be removed after 9.2
|
|
||||||
public interface DecompilerHighlightService {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the layout model of the Decompiler
|
|
||||||
* @return the layout model
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
public ClangLayoutController getLayoutModel();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Clears the <b>primary</b> highlights in the Decompiler
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
public void clearHighlights();
|
|
||||||
|
|
||||||
}
|
|
|
@ -20,7 +20,6 @@ import java.util.*;
|
||||||
import org.jdom.Element;
|
import org.jdom.Element;
|
||||||
|
|
||||||
import ghidra.app.CorePluginPackage;
|
import ghidra.app.CorePluginPackage;
|
||||||
import ghidra.app.decompiler.component.DecompilerHighlightService;
|
|
||||||
import ghidra.app.decompiler.component.hover.DecompilerHoverService;
|
import ghidra.app.decompiler.component.hover.DecompilerHoverService;
|
||||||
import ghidra.app.events.*;
|
import ghidra.app.events.*;
|
||||||
import ghidra.app.plugin.PluginCategoryNames;
|
import ghidra.app.plugin.PluginCategoryNames;
|
||||||
|
@ -46,14 +45,13 @@ import ghidra.util.task.SwingUpdateManager;
|
||||||
category = PluginCategoryNames.ANALYSIS,
|
category = PluginCategoryNames.ANALYSIS,
|
||||||
shortDescription = "Decompiler",
|
shortDescription = "Decompiler",
|
||||||
description = "Plugin for producing high-level decompilation",
|
description = "Plugin for producing high-level decompilation",
|
||||||
servicesRequired = {
|
servicesRequired = {
|
||||||
GoToService.class, NavigationHistoryService.class, ClipboardService.class,
|
GoToService.class, NavigationHistoryService.class, ClipboardService.class,
|
||||||
DataTypeManagerService.class /*, ProgramManager.class */
|
DataTypeManagerService.class /*, ProgramManager.class */
|
||||||
},
|
},
|
||||||
servicesProvided = { DecompilerHighlightService.class },
|
eventsConsumed = {
|
||||||
eventsConsumed = {
|
ProgramActivatedPluginEvent.class, ProgramOpenedPluginEvent.class,
|
||||||
ProgramActivatedPluginEvent.class, ProgramOpenedPluginEvent.class,
|
ProgramLocationPluginEvent.class, ProgramSelectionPluginEvent.class,
|
||||||
ProgramLocationPluginEvent.class, ProgramSelectionPluginEvent.class,
|
|
||||||
ProgramClosedPluginEvent.class
|
ProgramClosedPluginEvent.class
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
@ -79,17 +77,10 @@ public class DecompilePlugin extends Plugin {
|
||||||
});
|
});
|
||||||
|
|
||||||
public DecompilePlugin(PluginTool tool) {
|
public DecompilePlugin(PluginTool tool) {
|
||||||
|
|
||||||
super(tool);
|
super(tool);
|
||||||
|
|
||||||
disconnectedProviders = new ArrayList<>();
|
disconnectedProviders = new ArrayList<>();
|
||||||
connectedProvider = new PrimaryDecompilerProvider(this);
|
connectedProvider = new PrimaryDecompilerProvider(this);
|
||||||
|
|
||||||
registerServices();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void registerServices() {
|
|
||||||
registerServiceProvided(DecompilerHighlightService.class, connectedProvider);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -55,8 +55,7 @@ import resources.ResourceManager;
|
||||||
import utility.function.Callback;
|
import utility.function.Callback;
|
||||||
|
|
||||||
public class DecompilerProvider extends NavigatableComponentProviderAdapter
|
public class DecompilerProvider extends NavigatableComponentProviderAdapter
|
||||||
implements DomainObjectListener, OptionsChangeListener, DecompilerCallbackHandler,
|
implements DomainObjectListener, OptionsChangeListener, DecompilerCallbackHandler {
|
||||||
DecompilerHighlightService {
|
|
||||||
final static String OPTIONS_TITLE = "Decompiler";
|
final static String OPTIONS_TITLE = "Decompiler";
|
||||||
|
|
||||||
private static Icon REFRESH_ICON = Icons.REFRESH_ICON;
|
private static Icon REFRESH_ICON = Icons.REFRESH_ICON;
|
||||||
|
@ -1074,17 +1073,4 @@ public class DecompilerProvider extends NavigatableComponentProviderAdapter
|
||||||
public void programClosed(Program closedProgram) {
|
public void programClosed(Program closedProgram) {
|
||||||
controller.programClosed(closedProgram);
|
controller.programClosed(closedProgram);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated // to be removed post 9.2; replace with an API to manipulate primary highlights
|
|
||||||
@Override
|
|
||||||
public ClangLayoutController getLayoutModel() {
|
|
||||||
return (ClangLayoutController) getDecompilerPanel().getLayoutModel();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Deprecated // to be removed post 9.2; replace with an API to manipulate primary highlights
|
|
||||||
@Override
|
|
||||||
public void clearHighlights() {
|
|
||||||
getDecompilerPanel().clearPrimaryHighlights();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,14 +15,14 @@
|
||||||
*/
|
*/
|
||||||
// VxWorksSymTab_5_4 is a copy of VxWorksSymTab_6_1 with a different value for SYM_ENTRY_SIZE
|
// VxWorksSymTab_5_4 is a copy of VxWorksSymTab_6_1 with a different value for SYM_ENTRY_SIZE
|
||||||
// It was replaced at the request of a customer who tested that it worked with the slight modification
|
// It was replaced at the request of a customer who tested that it worked with the slight modification
|
||||||
// VxWorksSymTab_6_1 is an adaptation of the vxWorksSymTab script. It was modified by a customer
|
// VxWorksSymTab_6_1 is an adaptation of the vxWorksSymTab script. It was modified by a customer
|
||||||
// to use a single loop, instead of two. It also added demangling of C++ symbol names - at least
|
// to use a single loop, instead of two. It also added demangling of C++ symbol names - at least
|
||||||
// those that Ghidra knows how to demangle.
|
// those that Ghidra knows how to demangle.
|
||||||
//
|
//
|
||||||
// Extracts all symbols in a VxWorks symbol table and disassembles
|
// Extracts all symbols in a VxWorks symbol table and disassembles
|
||||||
// the global functions. Any existing symbols in the Ghidra symbol table
|
// the global functions. Any existing symbols in the Ghidra symbol table
|
||||||
// that collide with symbols defined in the VxWorks symbol table are deleted.
|
// that collide with symbols defined in the VxWorks symbol table are deleted.
|
||||||
//
|
//
|
||||||
// The VxWorks symbol table is an array of symbol table entries [0..n-1]
|
// The VxWorks symbol table is an array of symbol table entries [0..n-1]
|
||||||
// followed by a 32-bit value that is equal to n (number of sym tbl entries).
|
// followed by a 32-bit value that is equal to n (number of sym tbl entries).
|
||||||
// Each entry in the array has the following structure:
|
// Each entry in the array has the following structure:
|
||||||
|
@ -48,6 +48,7 @@
|
||||||
|
|
||||||
import java.io.FileOutputStream;
|
import java.io.FileOutputStream;
|
||||||
import java.io.PrintWriter;
|
import java.io.PrintWriter;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import ghidra.app.cmd.label.DemanglerCmd;
|
import ghidra.app.cmd.label.DemanglerCmd;
|
||||||
import ghidra.app.script.GhidraScript;
|
import ghidra.app.script.GhidraScript;
|
||||||
|
@ -189,8 +190,11 @@ public class VxWorksSymTab_5_4 extends GhidraScript {
|
||||||
createLabel(symLocAddr, symName, true);
|
createLabel(symLocAddr, symName, true);
|
||||||
if (symDemangledName != null) {
|
if (symDemangledName != null) {
|
||||||
new DemanglerCmd(symLocAddr, symName).applyTo(currentProgram, monitor);
|
new DemanglerCmd(symLocAddr, symName).applyTo(currentProgram, monitor);
|
||||||
ghidraSymTbl.removeSymbolSpecial(getSymbol(symName,
|
List<Symbol> symbols =
|
||||||
currentProgram.getGlobalNamespace()));
|
getSymbols(symName, currentProgram.getGlobalNamespace());
|
||||||
|
if (!symbols.isEmpty()) {
|
||||||
|
ghidraSymTbl.removeSymbolSpecial(symbols.get(0));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 4: // Local .text
|
case 4: // Local .text
|
||||||
|
@ -205,8 +209,11 @@ public class VxWorksSymTab_5_4 extends GhidraScript {
|
||||||
if (symDemangledName != null) {
|
if (symDemangledName != null) {
|
||||||
new DemanglerCmd(symLocAddr, symName).applyTo(currentProgram,
|
new DemanglerCmd(symLocAddr, symName).applyTo(currentProgram,
|
||||||
monitor);
|
monitor);
|
||||||
ghidraSymTbl.removeSymbolSpecial(getSymbol(symName,
|
List<Symbol> symbols =
|
||||||
currentProgram.getGlobalNamespace()));
|
getSymbols(symName, currentProgram.getGlobalNamespace());
|
||||||
|
if (!symbols.isEmpty()) {
|
||||||
|
ghidraSymTbl.removeSymbolSpecial(symbols.get(0));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -216,8 +223,11 @@ public class VxWorksSymTab_5_4 extends GhidraScript {
|
||||||
if (symDemangledName != null) {
|
if (symDemangledName != null) {
|
||||||
new DemanglerCmd(symLocAddr, symName).applyTo(currentProgram,
|
new DemanglerCmd(symLocAddr, symName).applyTo(currentProgram,
|
||||||
monitor);
|
monitor);
|
||||||
ghidraSymTbl.removeSymbolSpecial(getSymbol(symName,
|
List<Symbol> symbols =
|
||||||
currentProgram.getGlobalNamespace()));
|
getSymbols(symName, currentProgram.getGlobalNamespace());
|
||||||
|
if (!symbols.isEmpty()) {
|
||||||
|
ghidraSymTbl.removeSymbolSpecial(symbols.get(0));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -46,6 +46,7 @@
|
||||||
|
|
||||||
import java.io.FileOutputStream;
|
import java.io.FileOutputStream;
|
||||||
import java.io.PrintWriter;
|
import java.io.PrintWriter;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import ghidra.app.cmd.label.DemanglerCmd;
|
import ghidra.app.cmd.label.DemanglerCmd;
|
||||||
import ghidra.app.script.GhidraScript;
|
import ghidra.app.script.GhidraScript;
|
||||||
|
@ -185,8 +186,11 @@ public class VxWorksSymTab_6_1 extends GhidraScript {
|
||||||
createLabel(symLocAddr, symName, true);
|
createLabel(symLocAddr, symName, true);
|
||||||
if (symDemangledName != null) {
|
if (symDemangledName != null) {
|
||||||
new DemanglerCmd(symLocAddr, symName).applyTo(currentProgram, monitor);
|
new DemanglerCmd(symLocAddr, symName).applyTo(currentProgram, monitor);
|
||||||
ghidraSymTbl.removeSymbolSpecial(
|
List<Symbol> symbols =
|
||||||
getSymbol(symName, currentProgram.getGlobalNamespace()));
|
getSymbols(symName, currentProgram.getGlobalNamespace());
|
||||||
|
if (!symbols.isEmpty()) {
|
||||||
|
ghidraSymTbl.removeSymbolSpecial(symbols.get(0));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 4: // Local .text
|
case 4: // Local .text
|
||||||
|
@ -201,8 +205,11 @@ public class VxWorksSymTab_6_1 extends GhidraScript {
|
||||||
if (symDemangledName != null) {
|
if (symDemangledName != null) {
|
||||||
new DemanglerCmd(symLocAddr, symName).applyTo(currentProgram,
|
new DemanglerCmd(symLocAddr, symName).applyTo(currentProgram,
|
||||||
monitor);
|
monitor);
|
||||||
ghidraSymTbl.removeSymbolSpecial(
|
List<Symbol> symbols =
|
||||||
getSymbol(symName, currentProgram.getGlobalNamespace()));
|
getSymbols(symName, currentProgram.getGlobalNamespace());
|
||||||
|
if (!symbols.isEmpty()) {
|
||||||
|
ghidraSymTbl.removeSymbolSpecial(symbols.get(0));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -212,8 +219,11 @@ public class VxWorksSymTab_6_1 extends GhidraScript {
|
||||||
if (symDemangledName != null) {
|
if (symDemangledName != null) {
|
||||||
new DemanglerCmd(symLocAddr, symName).applyTo(currentProgram,
|
new DemanglerCmd(symLocAddr, symName).applyTo(currentProgram,
|
||||||
monitor);
|
monitor);
|
||||||
ghidraSymTbl.removeSymbolSpecial(
|
List<Symbol> symbols =
|
||||||
getSymbol(symName, currentProgram.getGlobalNamespace()));
|
getSymbols(symName, currentProgram.getGlobalNamespace());
|
||||||
|
if (!symbols.isEmpty()) {
|
||||||
|
ghidraSymTbl.removeSymbolSpecial(symbols.get(0));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -23,13 +23,13 @@
|
||||||
//
|
//
|
||||||
// Any existing Ghidra symbol table entries that collide with VxWorks symbol
|
// Any existing Ghidra symbol table entries that collide with VxWorks symbol
|
||||||
// table entries are deleted. Mangled C++ symbol names are demangled.
|
// table entries are deleted. Mangled C++ symbol names are demangled.
|
||||||
//
|
//
|
||||||
// The VxWorks symbol table is an array [0..n-1] of (struct SYMBOL) entries.
|
// The VxWorks symbol table is an array [0..n-1] of (struct SYMBOL) entries.
|
||||||
// The table may be immediately followed or preceeded by an (int) vxSymTblLen
|
// The table may be immediately followed or preceeded by an (int) vxSymTblLen
|
||||||
// value.
|
// value.
|
||||||
//
|
//
|
||||||
// Prerequisites:
|
// Prerequisites:
|
||||||
//
|
//
|
||||||
// - Program memory block(s) is(are) aligned with actual load addresses
|
// - Program memory block(s) is(are) aligned with actual load addresses
|
||||||
// (run something like MemAlignARM_LE.java)
|
// (run something like MemAlignARM_LE.java)
|
||||||
//
|
//
|
||||||
|
@ -41,6 +41,8 @@
|
||||||
//
|
//
|
||||||
// @category VxWorks
|
// @category VxWorks
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import ghidra.app.cmd.disassemble.DisassembleCommand;
|
import ghidra.app.cmd.disassemble.DisassembleCommand;
|
||||||
import ghidra.app.cmd.label.DemanglerCmd;
|
import ghidra.app.cmd.label.DemanglerCmd;
|
||||||
import ghidra.app.plugin.core.analysis.AutoAnalysisManager;
|
import ghidra.app.plugin.core.analysis.AutoAnalysisManager;
|
||||||
|
@ -593,7 +595,7 @@ public class VxWorksSymTab_Finder extends GhidraScript {
|
||||||
* @param symTbl
|
* @param symTbl
|
||||||
* @param vxSymbol
|
* @param vxSymbol
|
||||||
* @param tableLen
|
* @param tableLen
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
private void markSymbolTableLen(Address symTbl, VxSymbol vxSymbol, int symTblLen)
|
private void markSymbolTableLen(Address symTbl, VxSymbol vxSymbol, int symTblLen)
|
||||||
throws Exception {
|
throws Exception {
|
||||||
|
@ -651,9 +653,11 @@ public class VxWorksSymTab_Finder extends GhidraScript {
|
||||||
|
|
||||||
if (demangled != null) {
|
if (demangled != null) {
|
||||||
new DemanglerCmd(addr, mangled).applyTo(currentProgram, monitor);
|
new DemanglerCmd(addr, mangled).applyTo(currentProgram, monitor);
|
||||||
currentProgram.getSymbolTable()
|
List<Symbol> symbols =
|
||||||
.removeSymbolSpecial(
|
getSymbols(mangled, currentProgram.getGlobalNamespace());
|
||||||
getSymbol(mangled, currentProgram.getGlobalNamespace()));
|
if (!symbols.isEmpty()) {
|
||||||
|
currentProgram.getSymbolTable().removeSymbolSpecial(symbols.get(0));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
@ -735,7 +739,7 @@ public class VxWorksSymTab_Finder extends GhidraScript {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Process VxWorks symbol table entries
|
// Process VxWorks symbol table entries
|
||||||
println("Processing symbol table entries.");
|
println("Processing symbol table entries.");
|
||||||
Address symEntry = symTbl;
|
Address symEntry = symTbl;
|
||||||
for (int i = 0; (i < symTblLen) && !monitor.isCancelled(); i++, symEntry =
|
for (int i = 0; (i < symTblLen) && !monitor.isCancelled(); i++, symEntry =
|
||||||
|
|
|
@ -36,7 +36,7 @@ import ghidra.util.exception.*;
|
||||||
* <b>Assumptions for creating namespaces from a path string: </b>
|
* <b>Assumptions for creating namespaces from a path string: </b>
|
||||||
* <ul>
|
* <ul>
|
||||||
* <li>All elements of a namespace path should be namespace symbols and not other
|
* <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>Absolute paths can optionally start with the global namespace.
|
||||||
* <li>You can provide a relative path that will start at the given
|
* <li>You can provide a relative path that will start at the given
|
||||||
* parent namespace (or global if there is no parent provided).
|
* parent namespace (or global if there is no parent provided).
|
||||||
|
@ -96,20 +96,6 @@ public class NamespaceUtils {
|
||||||
return str;
|
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
|
* Get the library associated with the specified namespace
|
||||||
* @param namespace namespace
|
* @param namespace namespace
|
||||||
|
@ -333,8 +319,8 @@ public class NamespaceUtils {
|
||||||
*
|
*
|
||||||
* <p>The root namespace can be a function.
|
* <p>The root namespace can be a function.
|
||||||
*
|
*
|
||||||
* <p>If an address is passed, then the path can contain a function name provided the
|
* <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
|
* address is in the body of the function; otherwise the names must all be namespaces other
|
||||||
* than functions.
|
* than functions.
|
||||||
*
|
*
|
||||||
* @param namespacePath The namespace name or path string to be parsed
|
* @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
|
* Returns the existing Function at the given address if its {@link SymbolPath} matches the
|
||||||
* given path
|
* given path
|
||||||
*
|
*
|
||||||
* @param program the program
|
* @param program the program
|
||||||
* @param symbolPath the path of namespace
|
* @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
|
* @return the namespace represented by the given path, or null if no such namespace exists
|
||||||
*/
|
*/
|
||||||
public static Namespace getFunctionNamespaceAt(Program program, SymbolPath symbolPath,
|
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
|
* Returns the existing Function containing the given address if its
|
||||||
* {@link SymbolPath} matches the given path
|
* {@link SymbolPath} matches the given path
|
||||||
*
|
*
|
||||||
* @param program the program
|
* @param program the program
|
||||||
* @param symbolPath the path of namespace
|
* @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
|
* @return the namespace represented by the given path, or null if no such namespace exists
|
||||||
*/
|
*/
|
||||||
public static Namespace getFunctionNamespaceContaining(Program program, SymbolPath symbolPath,
|
public static Namespace getFunctionNamespaceContaining(Program program, SymbolPath symbolPath,
|
||||||
|
|
|
@ -161,7 +161,7 @@ public class SymbolManager implements SymbolTable, ManagerDB {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (oldVariableStorageMgr != null) {
|
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
|
// storage addresses
|
||||||
migrateFromOldVariableStorageManager(monitor);
|
migrateFromOldVariableStorageManager(monitor);
|
||||||
}
|
}
|
||||||
|
@ -268,7 +268,7 @@ public class SymbolManager implements SymbolTable, ManagerDB {
|
||||||
|
|
||||||
Address storageAddr = oldAddress.getNewAddress(oldAddress.getOffset());
|
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);
|
refManager.moveReferencesTo(oldAddress, storageAddr, monitor);
|
||||||
|
|
||||||
try {
|
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)
|
private void processOldExternalEntryPoints(TaskMonitor monitor)
|
||||||
throws IOException, CancelledException {
|
throws IOException, CancelledException {
|
||||||
|
@ -506,7 +506,7 @@ public class SymbolManager implements SymbolTable, ManagerDB {
|
||||||
DBRecord record =
|
DBRecord record =
|
||||||
adapter.createSymbol(newName, address, newParentID, SymbolType.LABEL, null,
|
adapter.createSymbol(newName, address, newParentID, SymbolType.LABEL, null,
|
||||||
null, null, source, true);
|
null, null, source, true);
|
||||||
symbol.setRecord(record);// symbol object was morphed
|
symbol.setRecord(record);
|
||||||
symbolAdded(symbol);
|
symbolAdded(symbol);
|
||||||
}
|
}
|
||||||
catch (IOException e) {
|
catch (IOException e) {
|
||||||
|
@ -798,6 +798,7 @@ public class SymbolManager implements SymbolTable, ManagerDB {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public SymbolIterator getSymbolsAsIterator(Address addr) {
|
public SymbolIterator getSymbolsAsIterator(Address addr) {
|
||||||
lock.acquire();
|
lock.acquire();
|
||||||
try {
|
try {
|
||||||
|
@ -920,7 +921,7 @@ public class SymbolManager implements SymbolTable, ManagerDB {
|
||||||
}
|
}
|
||||||
|
|
||||||
private Symbol searchNamespaceForSymbol(Namespace namespace, String name, Address address) {
|
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())) {
|
if (address.equals(symbol.getAddress()) && name.equals(symbol.getName())) {
|
||||||
return symbol;
|
return symbol;
|
||||||
}
|
}
|
||||||
|
@ -933,36 +934,11 @@ public class SymbolManager implements SymbolTable, ManagerDB {
|
||||||
((FunctionSymbol) sym).isThunk();
|
((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
|
@Override
|
||||||
public Symbol getGlobalSymbol(String name, Address addr) {
|
public Symbol getGlobalSymbol(String name, Address addr) {
|
||||||
return getSymbol(name, addr, program.getGlobalNamespace());
|
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
|
@Override
|
||||||
public List<Symbol> getGlobalSymbols(String name) {
|
public List<Symbol> getGlobalSymbols(String name) {
|
||||||
return getSymbols(name, namespaceMgr.getGlobalNamespace());
|
return getSymbols(name, namespaceMgr.getGlobalNamespace());
|
||||||
|
@ -1057,7 +1033,7 @@ public class SymbolManager implements SymbolTable, ManagerDB {
|
||||||
return null;
|
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.
|
// multiple symbols and not knowing when to call which method.
|
||||||
private Symbol getFirstSymbol(String name, Namespace namespace, Predicate<Symbol> test) {
|
private Symbol getFirstSymbol(String name, Namespace namespace, Predicate<Symbol> test) {
|
||||||
if (namespace == null) {
|
if (namespace == null) {
|
||||||
|
@ -1417,9 +1393,9 @@ public class SymbolManager implements SymbolTable, ManagerDB {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public long getDynamicSymbolID(Address addr) {
|
public long getDynamicSymbolID(Address addr) {
|
||||||
// Unique dynamic symbol ID produced from a dynamic symbol address map which has
|
// Unique dynamic symbol ID produced from a dynamic symbol address map which has a
|
||||||
// a high-order bit set to avoid potential conflict
|
// high-order bit set to avoid potential conflict with stored symbol ID's which are
|
||||||
// with stored symbol ID's which are assigned starting at 0.
|
// assigned starting at 0.
|
||||||
return dynamicSymbolAddressMap.getKey(addr);
|
return dynamicSymbolAddressMap.getKey(addr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1502,7 +1478,7 @@ public class SymbolManager implements SymbolTable, ManagerDB {
|
||||||
}
|
}
|
||||||
|
|
||||||
void primarySymbolSet(Symbol symbol, Symbol oldPrimarySymbol) {
|
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(),
|
program.symbolChanged(symbol, ChangeManager.DOCR_SYMBOL_SET_AS_PRIMARY, symbol.getAddress(),
|
||||||
null, oldPrimarySymbol, symbol);
|
null, oldPrimarySymbol, symbol);
|
||||||
}
|
}
|
||||||
|
@ -2116,7 +2092,9 @@ public class SymbolManager implements SymbolTable, ManagerDB {
|
||||||
program.dbError(e);
|
program.dbError(e);
|
||||||
it = new EmptyRecordIterator();
|
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() {
|
Lock getLock() {
|
||||||
|
@ -2211,13 +2189,14 @@ public class SymbolManager implements SymbolTable, ManagerDB {
|
||||||
}
|
}
|
||||||
Address newAddress = toAddr.add(symbol.getAddress().subtract(fromAddr));
|
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(symbol.getAddress());
|
||||||
primaryFixups.add(newAddress);
|
primaryFixups.add(newAddress);
|
||||||
|
|
||||||
moveSymbolForMemoryBlockMove((SymbolDB) symbol, 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);
|
fixupPrimarySymbols(primaryFixups);
|
||||||
}
|
}
|
||||||
finally {
|
finally {
|
||||||
|
@ -2665,7 +2644,7 @@ public class SymbolManager implements SymbolTable, ManagerDB {
|
||||||
return (Namespace) namespaceSymbol.getObject();
|
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.
|
// duplicates? Assuming yes, as another symbol type may exist with this name.
|
||||||
SymbolDB s =
|
SymbolDB s =
|
||||||
doCreateSpecialSymbol(Address.NO_ADDRESS, name, parent, SymbolType.NAMESPACE, null,
|
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 name the name of the symbol
|
||||||
* @param parent the namespace for the symbol
|
* @param parent the namespace for the symbol
|
||||||
* @param symbolType the type of the symbol
|
* @param symbolType the type of the symbol
|
||||||
* @param dataTypeId the id for an associated datatype or null
|
* @param dataTypeId the id for an associated datatype or null
|
||||||
* @param variableOffset this is the ordinal for params and firstUseOffset for locals
|
* @param variableOffset this is the ordinal for params and firstUseOffset for locals
|
||||||
* @param stringData value whose meaning depends on the symbol type.
|
* @param stringData value whose meaning depends on the symbol type.
|
||||||
* @param source the SourceType for the new symbol
|
* @param source the SourceType for the new symbol
|
||||||
* @return the newly created 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
|
@Override
|
||||||
public Symbol createLabel(Address addr, String name, SourceType source)
|
public Symbol createLabel(Address addr, String name, SourceType source)
|
||||||
throws InvalidInputException {
|
throws InvalidInputException {
|
||||||
|
@ -2742,12 +2715,6 @@ public class SymbolManager implements SymbolTable, ManagerDB {
|
||||||
return createLabel(addr, name, null, source);
|
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
|
@Override
|
||||||
public Symbol createLabel(Address addr, String name, Namespace namespace, SourceType source)
|
public Symbol createLabel(Address addr, String name, Namespace namespace, SourceType source)
|
||||||
throws InvalidInputException {
|
throws InvalidInputException {
|
||||||
|
|
|
@ -29,21 +29,20 @@ import ghidra.program.model.symbol.Reference;
|
||||||
*/
|
*/
|
||||||
public interface Data extends CodeUnit, Settings {
|
public interface Data extends CodeUnit, Settings {
|
||||||
|
|
||||||
// TODO: Fix javadocs !!
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the value of the data item. The value may be an address, a scalar,
|
* Returns the value of the data item. The value may be an address, a scalar,
|
||||||
* register or null if no value.
|
* register or null if no value.
|
||||||
|
* @return the value
|
||||||
*/
|
*/
|
||||||
public Object getValue();
|
public Object getValue();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the class used to express the value of this data.
|
* 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
|
* <p>NOTE: This determination is made based upon data type and settings only and does not
|
||||||
* which are used to construct the data value object.
|
* examine memory bytes which are used to construct the data value object.
|
||||||
* @return value class or null if a consistent class is not
|
*
|
||||||
* utilized.
|
* @return value class or null if a consistent class is not utilized.
|
||||||
*/
|
*/
|
||||||
public Class<?> getValueClass();
|
public Class<?> getValueClass();
|
||||||
|
|
||||||
|
@ -67,24 +66,28 @@ public interface Data extends CodeUnit, Settings {
|
||||||
public boolean isVolatile();
|
public boolean isVolatile();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns true if the data type is defined. Any address that has not been
|
* Returns true if the data type is defined. Any address that has not been defined to be code
|
||||||
* defined to be code or data is treated as undefined data.
|
* or data is treated as undefined data.
|
||||||
|
* @return true if is defined
|
||||||
*/
|
*/
|
||||||
public boolean isDefined();
|
public boolean isDefined();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the Data type for the data.
|
* Get the Data type for the data.
|
||||||
|
* @return the data type
|
||||||
*/
|
*/
|
||||||
public DataType getDataType();
|
public DataType getDataType();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* If the dataType is a typeDef, then the typeDef's base type is returned,
|
* If the dataType is a typeDef, then the typeDef's base type is returned, otherwise, the
|
||||||
* otherwise, the datatType is returned.
|
* datatType is returned.
|
||||||
|
* @return the data type
|
||||||
*/
|
*/
|
||||||
public DataType getBaseDataType();
|
public DataType getBaseDataType();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the references for the value.
|
* Get the references for the value.
|
||||||
|
* @return the references
|
||||||
*/
|
*/
|
||||||
public Reference[] getValueReferences();
|
public Reference[] getValueReferences();
|
||||||
|
|
||||||
|
@ -102,126 +105,136 @@ public interface Data extends CodeUnit, Settings {
|
||||||
public void removeValueReference(Address refAddr);
|
public void removeValueReference(Address refAddr);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the field name of this data item if it is "inside" another data item,
|
* Get the field name of this data item if it is "inside" another data item, otherwise return
|
||||||
* otherwise return null.
|
* null.
|
||||||
* @return the name of this data as known from some parent data item or
|
* @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.
|
* null if this data item is not a component of another data item.
|
||||||
*/
|
*/
|
||||||
public String getFieldName();
|
public String getFieldName();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the full path name (dot notation) for this field. This includes
|
* Returns the full path name (dot notation) for this field. This includes the symbol name at
|
||||||
* the symbol name at this address.
|
* this address.
|
||||||
|
* @return the path name
|
||||||
*/
|
*/
|
||||||
public String getPathName();
|
public String getPathName();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the component path name (dot notation) for this field
|
* Returns the component path name (dot notation) for this field
|
||||||
|
* @return the component path name
|
||||||
*/
|
*/
|
||||||
public String getComponentPathName();
|
public String getComponentPathName();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns true if this is a pointer, implies getValue() will
|
* Returns true if this is a pointer, implies getValue() will will return an Object that is an
|
||||||
* will return an Object that is an Address.
|
* Address.
|
||||||
|
* @return true if a pointer
|
||||||
*/
|
*/
|
||||||
public boolean isPointer();
|
public boolean isPointer();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns true if this data item is a Union.
|
* Returns true if this data item is a Union.
|
||||||
|
* @return true if a union
|
||||||
*/
|
*/
|
||||||
public boolean isUnion();
|
public boolean isUnion();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns true if this data item is a Structure.
|
* Returns true if this data item is a Structure.
|
||||||
|
* @return true if a structure
|
||||||
*/
|
*/
|
||||||
public boolean isStructure();
|
public boolean isStructure();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns true if this data item is an Array of DataTypes
|
* Returns true if this data item is an Array of DataTypes
|
||||||
|
* @return true if an array
|
||||||
*/
|
*/
|
||||||
public boolean isArray();
|
public boolean isArray();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns true if this data item is a dynamic DataType.
|
* Returns true if this data item is a dynamic DataType.
|
||||||
|
* @return true if is dynamic
|
||||||
*/
|
*/
|
||||||
public boolean isDynamic();
|
public boolean isDynamic();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the immediate parent data item of this data item or null if this data
|
* Get the immediate parent data item of this data item or null if this data item is not
|
||||||
* item is not contained in another data item.
|
* contained in another data item.
|
||||||
|
* @return the data
|
||||||
*/
|
*/
|
||||||
public Data getParent();
|
public Data getParent();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the highest level Data item in a hierarchy of structures
|
* Get the highest level Data item in a hierarchy of structures containing this component.
|
||||||
* containing this component.
|
* @return the data
|
||||||
*/
|
*/
|
||||||
public Data getRoot();
|
public Data getRoot();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the offset of this Data item from the start of the root data item of
|
* Get the offset of this Data item from the start of the root data item of some hierarchy of
|
||||||
* some hierarchy of structures.
|
* structures.
|
||||||
|
* @return the offset
|
||||||
*/
|
*/
|
||||||
int getRootOffset();
|
public int getRootOffset();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the offset of this Data item from the start of its immediate
|
* Get the offset of this Data item from the start of its immediate parent.
|
||||||
* parent.
|
* @return the offset
|
||||||
*/
|
*/
|
||||||
int getParentOffset();
|
public int getParentOffset();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the immediate n'th component or null if none exists.
|
* Returns the immediate n'th component or null if none exists.
|
||||||
* @param index the index of the component to get.
|
* @param index the index of the component to get.
|
||||||
|
* @return the component
|
||||||
*/
|
*/
|
||||||
public Data getComponent(int index);
|
public Data getComponent(int index);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a data item given the index path. Each integer in the array represents
|
* Get a data item given the index path. Each integer in the array represents an index into
|
||||||
* an index into the data item at that level.
|
* the data item at that level.
|
||||||
* @param componentPath the array of indexes to use to find the requested data item.
|
* @param componentPath the array of indexes to use to find the requested data item.
|
||||||
|
* @return the component
|
||||||
*/
|
*/
|
||||||
public Data getComponent(int[] componentPath);
|
public Data getComponent(int[] componentPath);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the component path if this is a component. The component path is an
|
* Get the component path if this is a component. The component path is an array of integers
|
||||||
* array of integers that represent each index in the tree of data items. Top
|
* that represent each index in the tree of data items. Top level data items have an empty
|
||||||
* level data items have an empty array for thier component path.
|
* array for their component path.
|
||||||
|
* @return the path
|
||||||
*/
|
*/
|
||||||
public int[] getComponentPath();
|
public int[] getComponentPath();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the number of components that make up this data item.
|
* Return the number of components that make up this data item.
|
||||||
* if this is an Array, return the number of elements in the array.
|
* if this is an Array, return the number of elements in the array.
|
||||||
|
* @return the number of components
|
||||||
*/
|
*/
|
||||||
public int getNumComponents();
|
public int getNumComponents();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the first immediate child component that contains the byte
|
* Return the first immediate child component that contains the byte at the given offset. It
|
||||||
* at the given offset. It is important to note that with certain
|
* is important to note that with certain datatypes there may be more than one component
|
||||||
* datatypes there may be more than one component containing the specified offset
|
* containing the specified offset (see {@link #getComponentsContaining(int)}).
|
||||||
* (see {@link #getComponentsContaining(int)}).
|
|
||||||
*
|
*
|
||||||
* @param offset the amount to add to this data items address to get the
|
* @param offset the amount to add to this data items address to get the address of the
|
||||||
* address of the requested data item.
|
* requested data item.
|
||||||
* @return first data component containing offset or null
|
* @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.
|
* {@link #getComponentContaining(int)} should be used instead.
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated(forRemoval = true, since = "10.1")
|
||||||
Data getComponentAt(int offset);
|
public Data getComponentAt(int offset);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* RReturn the first immediate child component that contains the byte
|
* RReturn the first immediate child component that contains the byte at the given offset. It
|
||||||
* at the given offset. It is important to note that with certain
|
* is important to note that with certain datatypes there may be more than one component
|
||||||
* datatypes there may be more than one component containing the specified offset
|
* containing the specified offset (see {@link #getComponentsContaining(int)}).
|
||||||
* (see {@link #getComponentsContaining(int)}).
|
|
||||||
*
|
*
|
||||||
* @param offset the amount to add to this data items address to get the
|
* @param offset the amount to add to this data items address to get the
|
||||||
* @return first data component containing offset or null
|
* @return first data component containing offset or null address of the requested data item.
|
||||||
* 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
|
* 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
|
* @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.
|
* 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
|
* 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
|
* 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.
|
* 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
|
* If the minimum offset of a component is specified, the only first component containing
|
||||||
* the offset will be considered (e.g., 0-element array).
|
* the offset will be considered (e.g., 0-element array).
|
||||||
|
* @param offset the offset
|
||||||
* @return primitive component containing this 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
|
* Get the index of this component in its parent
|
||||||
* @return -1 if this data item is not a component of another data item.
|
* @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.
|
* 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.
|
* @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.
|
* Returns a string that represents the data value without markup.
|
||||||
|
* @return the string
|
||||||
*/
|
*/
|
||||||
public String getDefaultValueRepresentation();
|
public String getDefaultValueRepresentation();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the appropriate string to use as the default label prefix or null if it has no
|
* Returns the appropriate string to use as the default label prefix or null if it has no
|
||||||
* prefered default label prefix;
|
* preferred default label prefix;
|
||||||
* @param options
|
* @param options the options
|
||||||
|
* @return the prefix
|
||||||
*/
|
*/
|
||||||
public String getDefaultLabelPrefix(DataTypeDisplayOptions options);
|
public String getDefaultLabelPrefix(DataTypeDisplayOptions options);
|
||||||
}
|
}
|
||||||
|
|
|
@ -68,10 +68,6 @@ public abstract class RefType {
|
||||||
static final byte __WRITE_IND = 105;
|
static final byte __WRITE_IND = 105;
|
||||||
static final byte __READ_WRITE_IND = 106;
|
static final byte __READ_WRITE_IND = 106;
|
||||||
static final byte __UNKNOWNPARAM = 107;
|
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 __EXTERNAL_REF = 113;
|
||||||
static final byte __UNKNOWNDATA_IND = 114;
|
static final byte __UNKNOWNDATA_IND = 114;
|
||||||
|
|
||||||
|
@ -247,23 +243,8 @@ public abstract class RefType {
|
||||||
DataRefType.READX | DataRefType.WRITEX | DataRefType.INDX);
|
DataRefType.READX | DataRefType.WRITEX | DataRefType.INDX);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reference type assigned for stack variable being read.
|
* Reference type used internally to identify external entry points.
|
||||||
* @deprecated use {@link RefType#READ} instead
|
* The use of this RefType for references to external library data or functions
|
||||||
*/
|
|
||||||
@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
|
|
||||||
* is deprecated and should not be used for that purpose.
|
* is deprecated and should not be used for that purpose.
|
||||||
*/
|
*/
|
||||||
public static final RefType EXTERNAL_REF = new DataRefType(__EXTERNAL_REF, "EXTERNAL", 0);
|
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.
|
* Factory class to create RefType objects.
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("deprecation")
|
|
||||||
public class RefTypeFactory {
|
public class RefTypeFactory {
|
||||||
|
|
||||||
private static final IntObjectHashtable<RefType> REFTYPE_LOOKUP_BY_TYPE_MAP =
|
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.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.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.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.EXTERNAL_REF.getValue(), RefType.EXTERNAL_REF);
|
||||||
REFTYPE_LOOKUP_BY_TYPE_MAP.put(RefType.__CALL_OVERRIDE_UNCONDITIONAL,
|
REFTYPE_LOOKUP_BY_TYPE_MAP.put(RefType.__CALL_OVERRIDE_UNCONDITIONAL,
|
||||||
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
|
* Get the default stack data RefType for the specified code-unit/opIndex and register
|
||||||
* @param cu
|
* @param cu the code unit
|
||||||
* @param reg
|
* @param reg the register
|
||||||
* @param opIndex
|
* @param opIndex the op index
|
||||||
* @return default RefType
|
* @return default RefType
|
||||||
*/
|
*/
|
||||||
public static RefType getDefaultRegisterRefType(CodeUnit cu, Register reg, int opIndex) {
|
public static RefType getDefaultRegisterRefType(CodeUnit cu, Register reg, int opIndex) {
|
||||||
|
@ -307,7 +304,7 @@ public class RefTypeFactory {
|
||||||
boolean simpleFlow =
|
boolean simpleFlow =
|
||||||
(instr.getFlowType() != RefType.INVALID && instr.getDefaultFlows().length <= 1);
|
(instr.getFlowType() != RefType.INVALID && instr.getDefaultFlows().length <= 1);
|
||||||
if (simpleFlow) {
|
if (simpleFlow) {
|
||||||
// only use default if simple flow
|
// only use default if simple flow
|
||||||
flowType = getDefaultJumpOrCallFlowType(instr);
|
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
|
// 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!
|
// language should be using Address locations for all flow pcode!
|
||||||
|
|
||||||
// TODO: Verify that above assumption is valid !!
|
// 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.
|
* that all computed flows utilize a register in its destination specification/computation.
|
||||||
* @param instr instruction
|
* @param instr instruction
|
||||||
* @return FlowType or null if unable to determine
|
* @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
|
// 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 !!
|
// 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.
|
* Get the default memory flow/data RefType for the specified code unit and opIndex.
|
||||||
* @param cu
|
* @param cu the code unit
|
||||||
* @param opIndex
|
* @param opIndex the op index
|
||||||
* @param toAddr reference destination
|
* @param toAddr reference destination
|
||||||
* @param ignoreExistingReferences if true existing references will not influence default
|
* @param ignoreExistingReferences if true existing references will not influence default
|
||||||
* reference type returned.
|
* reference type returned.
|
||||||
* @return default RefType
|
* @return default RefType
|
||||||
|
@ -453,8 +450,10 @@ public class RefTypeFactory {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!ignoreExistingReferences) {
|
if (!ignoreExistingReferences) {
|
||||||
Reference[] refs = cu.getProgram().getReferenceManager().getReferencesFrom(
|
Reference[] refs = cu.getProgram()
|
||||||
cu.getMinAddress(), opIndex);
|
.getReferenceManager()
|
||||||
|
.getReferencesFrom(
|
||||||
|
cu.getMinAddress(), opIndex);
|
||||||
for (Reference ref : refs) {
|
for (Reference ref : refs) {
|
||||||
if (ref.getToAddress().equals(toAddr)) {
|
if (ref.getToAddress().equals(toAddr)) {
|
||||||
return ref.getReferenceType();
|
return ref.getReferenceType();
|
||||||
|
@ -486,7 +485,7 @@ public class RefTypeFactory {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return default flow-type without terminator
|
* Return default flow-type without terminator
|
||||||
* @param inst
|
* @param inst the instruction
|
||||||
* @return call/jump flow type or null
|
* @return call/jump flow type or null
|
||||||
*/
|
*/
|
||||||
private static FlowType getDefaultJumpOrCallFlowType(Instruction inst) {
|
private static FlowType getDefaultJumpOrCallFlowType(Instruction inst) {
|
||||||
|
|
|
@ -69,14 +69,6 @@ public interface SymbolTable {
|
||||||
public Symbol createLabel(Address addr, String name, SourceType source)
|
public Symbol createLabel(Address addr, String name, SourceType source)
|
||||||
throws InvalidInputException;
|
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
|
* Create a label symbol with the given name associated to the given
|
||||||
* Address and namespace. The symbol will be of type SymbolType.CODE.
|
* 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)
|
public Symbol createLabel(Address addr, String name, Namespace namespace, SourceType source)
|
||||||
throws InvalidInputException;
|
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>
|
* 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
|
* symbol the behavior will be the same as invoking {@link Symbol#delete()} on the
|
||||||
|
@ -128,21 +112,10 @@ public interface SymbolTable {
|
||||||
* symbol specific binding.
|
* symbol specific binding.
|
||||||
*
|
*
|
||||||
* @param sym the symbol to be removed.
|
* @param sym the symbol to be removed.
|
||||||
*
|
|
||||||
* @return false, if removal of the symbol fails
|
* @return false, if removal of the symbol fails
|
||||||
*/
|
*/
|
||||||
public boolean removeSymbolSpecial(Symbol sym);
|
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.
|
* Get the symbol for the given symbol ID.
|
||||||
* @param symbolID the id of the symbol to be retrieved.
|
* @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.
|
* Get the symbol with the given name, address, and namespace.
|
||||||
* <P>
|
* <P>
|
||||||
* Note that for a symbol to be uniquely specified, all these parameters are required. Any method
|
* Note that for a symbol to be uniquely specified, all these parameters are required. Any
|
||||||
* that queries for symbols using just one or two of these parameters will return a list of symbols.
|
* method that queries for symbols using just one or two of these parameters will return a list
|
||||||
* This method will not return a default thunk (i.e., thunk function symbol with default source type)
|
* of symbols. This method will not return a default thunk (i.e., thunk function symbol with
|
||||||
* since it mirrors the name and parent namespace of the function it thunks.
|
* default source type) since it mirrors the name and parent namespace of the function it
|
||||||
* </P>
|
* thunks.
|
||||||
|
*
|
||||||
* @param name the name of the symbol to retrieve
|
* @param name the name of the symbol to retrieve
|
||||||
* @param addr the address 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.
|
* @param namespace the namespace of the symbol to retrieve. May be null which indicates global
|
||||||
* @return the symbol which matches the specified crieria or null if not found
|
* namespace.
|
||||||
* @see #getGlobalSymbol(String, Address) for a convenience method if the namespace is the 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);
|
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).
|
* 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
|
* <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)
|
* <p>NOTE: This method will not return a default thunk (i.e., thunk function symbol with
|
||||||
* since it mirrors the name and parent namespace of the function it thunks.</p>
|
* 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 name the name of the symbol to retrieve
|
||||||
* @param addr the address 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
|
* @return the symbol which matches the specified criteria in the global namespace or null if
|
||||||
* @see #getSymbol(String, Address, Namespace)
|
* not found
|
||||||
|
* @see #getSymbol(String, Address, Namespace)
|
||||||
*/
|
*/
|
||||||
public Symbol getGlobalSymbol(String name, Address addr);
|
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.
|
* 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>
|
* thunk function symbol with default source type).</p>
|
||||||
*
|
*
|
||||||
* @param name the name of the symbols to retrieve.
|
* @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.
|
* 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>
|
* thunk function symbol with default source type).</p>
|
||||||
*
|
*
|
||||||
* @param name the name of the symbols to retrieve.
|
* @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
|
* 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.
|
* 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.
|
* @param function the function to search.
|
||||||
* @return a parameter or local variable symbol with the given name.
|
* @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.
|
* 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>
|
* thunk function symbol with default source type).</p>
|
||||||
*
|
*
|
||||||
* @param name the name of symbols to search for.
|
* @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.
|
* the primary symbol will be returned in array slot 0.
|
||||||
* WARNING! Use of this method with a Variable address is highly discouraged since
|
* 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.
|
* 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
|
* Note that unless all the symbols are needed at once, you should consider using
|
||||||
* the {@link #getSymbolsAsIterator(Address)} method instead.
|
* the {@link #getSymbolsAsIterator(Address)} method instead.
|
||||||
* @param addr the address at which to retrieve all symbols.
|
* @param addr the address at which to retrieve all symbols.
|
||||||
* @return a zero-length array when no symbols are defined at address.
|
* @return a zero-length array when no symbols are defined at address.
|
||||||
* @see #getSymbolsAsIterator(Address)
|
* @see #getSymbolsAsIterator(Address)
|
||||||
|
@ -362,8 +306,8 @@ public interface SymbolTable {
|
||||||
public Symbol[] getSymbols(Address addr);
|
public Symbol[] getSymbols(Address addr);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a symbol iterator over all the symbols at the given address. Use this instead of
|
* 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
|
* {@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
|
* searching for a particular symbol. This method prevents all symbols at the given address
|
||||||
* from being loaded up front.
|
* from being loaded up front.
|
||||||
*
|
*
|
||||||
|
@ -383,7 +327,7 @@ public interface SymbolTable {
|
||||||
/**
|
/**
|
||||||
* Returns an iterator over all the symbols in the given namespace
|
* 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>
|
* thunk function symbol with default source type).</p>
|
||||||
*
|
*
|
||||||
* @param namespace the namespace to search for symbols.
|
* @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
|
* 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>
|
* thunk function symbol with default source type).</p>
|
||||||
*
|
*
|
||||||
* @param namespaceID the namespace ID to search for symbols.
|
* @param namespaceID the namespace ID to search for symbols.
|
||||||
|
@ -410,8 +354,8 @@ public interface SymbolTable {
|
||||||
public boolean hasSymbol(Address addr);
|
public boolean hasSymbol(Address addr);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the unique symbol ID for a dynamic symbol associated with the speified addr.
|
* 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 dyanmic symbol
|
* 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
|
* at the specified addr. This symbol ID should not be permanently stored since the encoding
|
||||||
* may change between software releases.
|
* may change between software releases.
|
||||||
* @param addr dynamic symbol address
|
* @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.
|
* 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.
|
* <p>NOTE: The iterator is in the forward direction only and will not return default thunk
|
||||||
* The resulting iterator will not return default thunks (i.e.,
|
* functions. The resulting iterator will not return default thunks (i.e.,
|
||||||
* thunk function symbol with default source type).</p>
|
* thunk function symbol with default source type).
|
||||||
*
|
*
|
||||||
* @param searchStr the string to search for (may contain * to match any sequence
|
* @param searchStr the string to search for (may contain * to match any sequence
|
||||||
* or ? to match a single char)
|
* or ? to match a single char)
|
||||||
|
@ -575,8 +519,7 @@ public interface SymbolTable {
|
||||||
public Namespace getNamespace(Address addr);
|
public Namespace getNamespace(Address addr);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns all Class Namespaces defined within the program in an
|
* Returns all Class Namespaces defined within the program in an arbitrary ordering.
|
||||||
* arbitrary ordering.
|
|
||||||
* @return iterator of {@link GhidraClass}
|
* @return iterator of {@link GhidraClass}
|
||||||
*/
|
*/
|
||||||
public Iterator<GhidraClass> getClassNamespaces();
|
public Iterator<GhidraClass> getClassNamespaces();
|
||||||
|
@ -587,8 +530,8 @@ public interface SymbolTable {
|
||||||
* @param name name of the namespace
|
* @param name name of the namespace
|
||||||
* @param source the source of this class namespace's symbol
|
* @param source the source of this class namespace's symbol
|
||||||
* @return new class namespace
|
* @return new class namespace
|
||||||
* @throws DuplicateNameException thrown if another non function or label symbol
|
* @throws DuplicateNameException thrown if another non function or label symbol exists with
|
||||||
* exists with the given name
|
* the given name
|
||||||
* @throws InvalidInputException throw if the name has invalid characters or is null
|
* @throws InvalidInputException throw if the name has invalid characters or is null
|
||||||
* @throws IllegalArgumentException if you try to set the source to 'Symbol.DEFAULT'.
|
* @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.
|
* 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.,
|
* <p>NOTE: The resulting iterator will not return default thunks (i.e., thunk function symbol
|
||||||
* thunk function symbol with default source type).</p>
|
* with default source type).
|
||||||
*
|
*
|
||||||
* @param parentSymbol the parent symbol
|
* @param parentSymbol the parent symbol
|
||||||
* @return symbol iterator
|
* @return symbol iterator
|
||||||
|
@ -613,7 +556,7 @@ public interface SymbolTable {
|
||||||
* @return the new Library namespace.
|
* @return the new Library namespace.
|
||||||
* @throws InvalidInputException if the name is invalid.
|
* @throws InvalidInputException if the name is invalid.
|
||||||
* @throws IllegalArgumentException if you try to set the source to 'Symbol.DEFAULT'.
|
* @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
|
* symbol exists with the given name
|
||||||
*/
|
*/
|
||||||
public Library createExternalLibrary(String name, SourceType source)
|
public Library createExternalLibrary(String name, SourceType source)
|
||||||
|
@ -625,7 +568,7 @@ public interface SymbolTable {
|
||||||
* @param name the name of the new namespace
|
* @param name the name of the new namespace
|
||||||
* @param source the source of this namespace's symbol
|
* @param source the source of this namespace's symbol
|
||||||
* @return the new Namespace object.
|
* @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
|
* exists with the given name
|
||||||
* @throws InvalidInputException if the name is invalid.
|
* @throws InvalidInputException if the name is invalid.
|
||||||
* @throws IllegalArgumentException if you try to set the source to 'Symbol.DEFAULT'.
|
* @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,
|
* Gets an existing namespace with the given name in the given parent. If no namespace exists,
|
||||||
* then one will be created.
|
* then one will be created.
|
||||||
*
|
*
|
||||||
* @param parent the parent namespace
|
* @param parent the parent namespace
|
||||||
* @param name the namespace name
|
* @param name the namespace name
|
||||||
* @param source the source type for the namespace if one is created
|
* @param source the source type for the namespace if one is created
|
||||||
* @return the namespace
|
* @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
|
* the given name
|
||||||
* @throws InvalidInputException if the name is invalid
|
* @throws InvalidInputException if the name is invalid
|
||||||
* @throws IllegalArgumentException if the given parent namespace is from a different program
|
* @throws IllegalArgumentException if the given parent namespace is from a different program
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue