Removal of old deprecated methods

This commit is contained in:
dragonmacher 2021-10-22 13:14:17 -04:00
parent 37e807ea3b
commit d05a57ae1a
16 changed files with 287 additions and 500 deletions

View file

@ -87,12 +87,6 @@ public class DBTraceProgramViewSymbolTable implements SymbolTable {
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
public Symbol createLabel(Address addr, String name, Namespace namespace, SourceType source)
throws InvalidInputException {
@ -101,12 +95,6 @@ public class DBTraceProgramViewSymbolTable implements SymbolTable {
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
public boolean removeSymbolSpecial(Symbol sym) {
// 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);
}
@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
public List<Symbol> getSymbols(String name, Namespace namespace) {
TraceNamespaceSymbol parent = assertTraceNamespace(namespace);

View file

@ -88,7 +88,9 @@ public class PropagateExternalParametersScript extends GhidraScript {
String newComment = new String(
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);
}
@ -101,7 +103,9 @@ public class PropagateExternalParametersScript extends GhidraScript {
}
if ((data != null) &&
(listing.getCodeUnitAt(dataAddress).getMnemonicString().startsWith(
(listing.getCodeUnitAt(dataAddress)
.getMnemonicString()
.startsWith(
"undefined"))) {
clearListing(dataAddress);
}

View file

@ -56,16 +56,14 @@ import ghidra.util.task.TaskMonitor;
* <p>
* NOTE:
* <ol>
* <li>NO METHODS SHOULD EVER BE REMOVED FROM THIS CLASS.
* <li>NO METHOD SIGNATURES SHOULD EVER BE CHANGED IN THIS CLASS.
* <li>NO METHODS *SHOULD* EVER BE REMOVED FROM THIS CLASS.
* <li>NO METHOD SIGNATURES *SHOULD* EVER BE CHANGED IN THIS CLASS.
* </ol>
* <p>
* This class is used by GhidraScript.
* <p>
* Changing this class will break user scripts.
* <p>
* That is bad. Don't do that.
* <p>
*/
public class FlatProgramAPI {
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.
* @param address the address to clear the code unit
* @throws CancelledException
* @throws CancelledException if cancelled
*/
public final void clearListing(Address address) throws CancelledException {
clearListing(address, address);
@ -249,7 +247,7 @@ public class FlatProgramAPI {
* Clears the code units (instructions or data) in the specified range.
* @param start the start address
* @param end the end address
* @throws CancelledException
* @throws CancelledException if cancelled
*/
public final void clearListing(Address start, Address end) throws CancelledException {
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
* @param set the set to clear
* @throws CancelledException
* @throws CancelledException if cancelled
*/
public final void clearListing(AddressSetView set) throws CancelledException {
AddressRangeIterator iter = set.getAddressRanges();
@ -320,6 +318,7 @@ public class FlatProgramAPI {
* @param length the size of the block
* @param overlay true will create an overlay, false will not
* @return the newly created memory block
* @throws Exception if there is any exception
*/
public final MemoryBlock createMemoryBlock(String name, Address start, InputStream input,
long length, boolean overlay) throws Exception {
@ -340,6 +339,7 @@ public class FlatProgramAPI {
* @param bytes the bytes of the memory block
* @param overlay true will create an overlay, false will not
* @return the newly created memory block
* @throws Exception if there is any exception
*/
public final MemoryBlock createMemoryBlock(String name, Address start, byte[] bytes,
boolean overlay) throws Exception {
@ -384,6 +384,7 @@ public class FlatProgramAPI {
* NOTE: ALL ANNOTATION (disassembly, comments, etc) defined in this
* memory block will also be removed!
* @param block the block to be removed
* @throws Exception if there is any exception
*/
public final void removeMemoryBlock(MemoryBlock block) throws Exception {
currentProgram.getMemory().removeBlock(block, monitor);
@ -396,6 +397,7 @@ public class FlatProgramAPI {
* @param name the name of the symbol
* @param makePrimary true if the symbol should be made primary
* @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)
throws Exception {
@ -422,6 +424,7 @@ public class FlatProgramAPI {
* @param makePrimary true if the symbol should be made primary
* @param sourceType the source type.
* @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,
SourceType sourceType) throws Exception {
@ -439,6 +442,7 @@ public class FlatProgramAPI {
* @param makePrimary true if the symbol should be made primary
* @param sourceType the source type.
* @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,
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}
* 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 minimumStringLength The smallest number of chars in a sequence to be considered a "string".
* @param alignment specifies any alignment requirements for the start of the string. An 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 minimumStringLength The smallest number of chars in a sequence to be considered a
* "string".
* @param alignment specifies any alignment requirements for the start of the string. An
* 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 includeAllCharWidths if true, UTF16 and UTF32 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.
* @param includeAllCharWidths if true, UTF16 and UTF32 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.
*/
public List<FoundString> findStrings(AddressSetView addressSet, int minimumStringLength,
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}
* to see exactly what chars are considered ASCII for purposes of this search.
* Search for sequences of Pascal Ascii strings in program memory. See
* {@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 minimumStringLength The smallest number of chars in a sequence to be considered a "string".
* @param alignment specifies any alignment requirements for the start of the string. An 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 minimumStringLength The smallest number of chars in a sequence to be considered a
* "string".
* @param alignment specifies any alignment requirements for the start of the string. An
* 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.
* @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,
int alignment, boolean includePascalUnicode) {
@ -1061,7 +1071,7 @@ public class FlatProgramAPI {
return null;
}
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())) {
func = null;
if (iterator.hasNext()) {
@ -1101,7 +1111,7 @@ public class FlatProgramAPI {
return null;
}
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())) {
func = null;
if (iterator.hasNext()) {
@ -1176,6 +1186,7 @@ public class FlatProgramAPI {
/**
* Returns the first instruction in the function.
* @param function the function
* @return the first instruction in the 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 datatype the Data Type that describes the type of Data object to create.
* @return the newly created Data object
* @throws Exception if there is any exception
*/
public final Data createData(Address address, DataType datatype) throws Exception {
Listing listing = currentProgram.getListing();
@ -1650,6 +1662,7 @@ public class FlatProgramAPI {
* Creates a byte datatype at the given address.
* @param address the address to create the byte
* @return the newly created Data object
* @throws Exception if there is any exception
*/
public final Data createByte(Address address) throws Exception {
return createData(address, new ByteDataType());
@ -1659,6 +1672,7 @@ public class FlatProgramAPI {
* Creates a word datatype at the given address.
* @param address the address to create the word
* @return the newly created Data object
* @throws Exception if there is any exception
*/
public final Data createWord(Address address) throws Exception {
return createData(address, new WordDataType());
@ -1668,6 +1682,7 @@ public class FlatProgramAPI {
* Creates a dword datatype at the given address.
* @param address the address to create the dword
* @return the newly created Data object
* @throws Exception if there is any exception
*/
public final Data createDWord(Address address) throws Exception {
return createData(address, new DWordDataType());
@ -1677,6 +1692,7 @@ public class FlatProgramAPI {
* Creates a list of dword datatypes starting at the given address.
* @param start the start address to create the dwords
* @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 {
for (int i = 0; i < count; ++i) {
@ -1689,6 +1705,7 @@ public class FlatProgramAPI {
* Creates a qword datatype at the given address.
* @param address the address to create the qword
* @return the newly created Data object
* @throws Exception if there is any exception
*/
public final Data createQWord(Address address) throws Exception {
return createData(address, new QWordDataType());
@ -1698,6 +1715,7 @@ public class FlatProgramAPI {
* Creates a float datatype at the given address.
* @param address the address to create the float
* @return the newly created Data object
* @throws Exception if there is any exception
*/
public final Data createFloat(Address address) throws Exception {
return createData(address, new FloatDataType());
@ -1707,6 +1725,7 @@ public class FlatProgramAPI {
* Creates a double datatype at the given address.
* @param address the address to create the double
* @return the newly created Data object
* @throws Exception if there is any exception
*/
public final Data createDouble(Address address) throws Exception {
return createData(address, new DoubleDataType());
@ -1716,6 +1735,7 @@ public class FlatProgramAPI {
* Creates a char datatype at the given address.
* @param address the address to create the char
* @return the newly created Data object
* @throws Exception if there is any exception
*/
public final Data createChar(Address address) throws Exception {
return createData(address, new CharDataType());
@ -1726,6 +1746,7 @@ public class FlatProgramAPI {
* at the specified address.
* @param address the address to create the string
* @return the newly created Data object
* @throws Exception if there is any exception
*/
public final Data createAsciiString(Address address) throws Exception {
return createData(address, new TerminatedStringDataType());
@ -1733,12 +1754,11 @@ public class FlatProgramAPI {
/**
* 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
* of dynamic null terminated string)
* @return string data created
* @throws CodeUnitInsertionException
* @throws DataTypeConflictException
* @throws CodeUnitInsertionException if there is a data conflict
*/
public final Data createAsciiString(Address address, int length)
throws CodeUnitInsertionException {
@ -1761,11 +1781,10 @@ public class FlatProgramAPI {
}
/**
* Creates a null terminated unicode string starting
* at the specified address.
* Creates a null terminated unicode string starting at the specified address.
* @param address the address to create the string
* @return the newly created Data object
* @throws Exception
* @throws Exception if there is any exception
*/
public final Data createUnicodeString(Address address) throws Exception {
return createData(address, new TerminatedUnicodeDataType());
@ -1774,6 +1793,7 @@ public class FlatProgramAPI {
/**
* Removes the given data from the current program.
* @param data the data to remove
* @throws Exception if there is any exception
*/
public final void removeData(Data data) throws Exception {
clearListing(data.getMinAddress(), data.getMaxAddress());
@ -1782,6 +1802,7 @@ public class FlatProgramAPI {
/**
* Removes the data containing the given address from the current program.
* @param address the address to remove data
* @throws Exception if there is any exception
*/
public final void removeDataAt(Address address) throws Exception {
Data data = getDataContaining(address);
@ -1793,6 +1814,7 @@ public class FlatProgramAPI {
/**
* Removes the given instruction from the current program.
* @param instruction the instruction to remove
* @throws Exception if there is any exception
*/
public final void removeInstruction(Instruction instruction) throws Exception {
clearListing(instruction.getMinAddress(), instruction.getMaxAddress());
@ -1801,6 +1823,7 @@ public class FlatProgramAPI {
/**
* Removes the instruction containing the given address from the current program.
* @param address the address to remove instruction
* @throws Exception if there is any exception
*/
public final void removeInstructionAt(Address address) throws Exception {
Instruction instruction = getInstructionContaining(address);
@ -2259,6 +2282,7 @@ public class FlatProgramAPI {
* @param equateName the name of the equate
* @return the newly created equate
* @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 {
Object value = data.getValue();
@ -2273,18 +2297,6 @@ public class FlatProgramAPI {
"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.
* @param instruction the instruction
@ -2325,17 +2337,6 @@ public class FlatProgramAPI {
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.
* @param instruction the instruction
@ -2431,6 +2432,8 @@ public class FlatProgramAPI {
* Opens a Data Type Archive
* @param archiveFile the archive file to open
* @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)
throws Exception {
@ -2445,7 +2448,7 @@ public class FlatProgramAPI {
* If a program already exists with the specified
* name, then a time stamp will be appended to the name to make it unique.
* @param program the program to save
* @throws Exception
* @throws Exception if there is any exception
*/
public void saveProgram(Program program) throws Exception {
saveProgram(program, null);
@ -2465,8 +2468,9 @@ public class FlatProgramAPI {
* <p>
* @param program the program to save
* @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" }
* @throws Exception
* the project folder to save the program info. Example: { "folder1", "subfolder2",
* "final_folder" }
* @throws Exception if there is any exception
*/
public void saveProgram(Program program, List<String> path) throws Exception {
if (program == null) {
@ -2533,12 +2537,6 @@ public class FlatProgramAPI {
return folder;
}
/**
*
* @param type
* @param text
* @return
*/
private Address findComment(int type, String text) {
Listing listing = currentProgram.getListing();
Memory memory = currentProgram.getMemory();

View file

@ -62,8 +62,8 @@ import ghidra.program.database.ProgramBuilder;
import ghidra.program.database.ProgramDB;
import ghidra.program.database.data.ProgramDataTypeManager;
import ghidra.program.model.data.*;
import ghidra.test.*;
import ghidra.util.task.TaskMonitor;
import ghidra.test.AbstractGhidraHeadedIntegrationTest;
import ghidra.test.TestEnv;
import util.CollectionUtils;
import utilities.util.FileUtilities;
@ -1088,18 +1088,6 @@ public class DataTypeManagerPluginTest extends AbstractGhidraHeadedIntegrationTe
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 {
runSwing(() -> {
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() {
URL url = getClass().getResource("TestDataType.txt");
try {

View file

@ -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();
}

View file

@ -20,7 +20,6 @@ import java.util.*;
import org.jdom.Element;
import ghidra.app.CorePluginPackage;
import ghidra.app.decompiler.component.DecompilerHighlightService;
import ghidra.app.decompiler.component.hover.DecompilerHoverService;
import ghidra.app.events.*;
import ghidra.app.plugin.PluginCategoryNames;
@ -50,7 +49,6 @@ import ghidra.util.task.SwingUpdateManager;
GoToService.class, NavigationHistoryService.class, ClipboardService.class,
DataTypeManagerService.class /*, ProgramManager.class */
},
servicesProvided = { DecompilerHighlightService.class },
eventsConsumed = {
ProgramActivatedPluginEvent.class, ProgramOpenedPluginEvent.class,
ProgramLocationPluginEvent.class, ProgramSelectionPluginEvent.class,
@ -79,17 +77,10 @@ public class DecompilePlugin extends Plugin {
});
public DecompilePlugin(PluginTool tool) {
super(tool);
disconnectedProviders = new ArrayList<>();
connectedProvider = new PrimaryDecompilerProvider(this);
registerServices();
}
private void registerServices() {
registerServiceProvided(DecompilerHighlightService.class, connectedProvider);
}
@Override

View file

@ -55,8 +55,7 @@ import resources.ResourceManager;
import utility.function.Callback;
public class DecompilerProvider extends NavigatableComponentProviderAdapter
implements DomainObjectListener, OptionsChangeListener, DecompilerCallbackHandler,
DecompilerHighlightService {
implements DomainObjectListener, OptionsChangeListener, DecompilerCallbackHandler {
final static String OPTIONS_TITLE = "Decompiler";
private static Icon REFRESH_ICON = Icons.REFRESH_ICON;
@ -1074,17 +1073,4 @@ public class DecompilerProvider extends NavigatableComponentProviderAdapter
public void programClosed(Program 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();
}
}

View file

@ -48,6 +48,7 @@
import java.io.FileOutputStream;
import java.io.PrintWriter;
import java.util.List;
import ghidra.app.cmd.label.DemanglerCmd;
import ghidra.app.script.GhidraScript;
@ -189,8 +190,11 @@ public class VxWorksSymTab_5_4 extends GhidraScript {
createLabel(symLocAddr, symName, true);
if (symDemangledName != null) {
new DemanglerCmd(symLocAddr, symName).applyTo(currentProgram, monitor);
ghidraSymTbl.removeSymbolSpecial(getSymbol(symName,
currentProgram.getGlobalNamespace()));
List<Symbol> symbols =
getSymbols(symName, currentProgram.getGlobalNamespace());
if (!symbols.isEmpty()) {
ghidraSymTbl.removeSymbolSpecial(symbols.get(0));
}
}
break;
case 4: // Local .text
@ -205,8 +209,11 @@ public class VxWorksSymTab_5_4 extends GhidraScript {
if (symDemangledName != null) {
new DemanglerCmd(symLocAddr, symName).applyTo(currentProgram,
monitor);
ghidraSymTbl.removeSymbolSpecial(getSymbol(symName,
currentProgram.getGlobalNamespace()));
List<Symbol> symbols =
getSymbols(symName, currentProgram.getGlobalNamespace());
if (!symbols.isEmpty()) {
ghidraSymTbl.removeSymbolSpecial(symbols.get(0));
}
}
}
else {
@ -216,8 +223,11 @@ public class VxWorksSymTab_5_4 extends GhidraScript {
if (symDemangledName != null) {
new DemanglerCmd(symLocAddr, symName).applyTo(currentProgram,
monitor);
ghidraSymTbl.removeSymbolSpecial(getSymbol(symName,
currentProgram.getGlobalNamespace()));
List<Symbol> symbols =
getSymbols(symName, currentProgram.getGlobalNamespace());
if (!symbols.isEmpty()) {
ghidraSymTbl.removeSymbolSpecial(symbols.get(0));
}
}
}
break;

View file

@ -46,6 +46,7 @@
import java.io.FileOutputStream;
import java.io.PrintWriter;
import java.util.List;
import ghidra.app.cmd.label.DemanglerCmd;
import ghidra.app.script.GhidraScript;
@ -185,8 +186,11 @@ public class VxWorksSymTab_6_1 extends GhidraScript {
createLabel(symLocAddr, symName, true);
if (symDemangledName != null) {
new DemanglerCmd(symLocAddr, symName).applyTo(currentProgram, monitor);
ghidraSymTbl.removeSymbolSpecial(
getSymbol(symName, currentProgram.getGlobalNamespace()));
List<Symbol> symbols =
getSymbols(symName, currentProgram.getGlobalNamespace());
if (!symbols.isEmpty()) {
ghidraSymTbl.removeSymbolSpecial(symbols.get(0));
}
}
break;
case 4: // Local .text
@ -201,8 +205,11 @@ public class VxWorksSymTab_6_1 extends GhidraScript {
if (symDemangledName != null) {
new DemanglerCmd(symLocAddr, symName).applyTo(currentProgram,
monitor);
ghidraSymTbl.removeSymbolSpecial(
getSymbol(symName, currentProgram.getGlobalNamespace()));
List<Symbol> symbols =
getSymbols(symName, currentProgram.getGlobalNamespace());
if (!symbols.isEmpty()) {
ghidraSymTbl.removeSymbolSpecial(symbols.get(0));
}
}
}
else {
@ -212,8 +219,11 @@ public class VxWorksSymTab_6_1 extends GhidraScript {
if (symDemangledName != null) {
new DemanglerCmd(symLocAddr, symName).applyTo(currentProgram,
monitor);
ghidraSymTbl.removeSymbolSpecial(
getSymbol(symName, currentProgram.getGlobalNamespace()));
List<Symbol> symbols =
getSymbols(symName, currentProgram.getGlobalNamespace());
if (!symbols.isEmpty()) {
ghidraSymTbl.removeSymbolSpecial(symbols.get(0));
}
}
}
break;

View file

@ -41,6 +41,8 @@
//
// @category VxWorks
import java.util.List;
import ghidra.app.cmd.disassemble.DisassembleCommand;
import ghidra.app.cmd.label.DemanglerCmd;
import ghidra.app.plugin.core.analysis.AutoAnalysisManager;
@ -651,9 +653,11 @@ public class VxWorksSymTab_Finder extends GhidraScript {
if (demangled != null) {
new DemanglerCmd(addr, mangled).applyTo(currentProgram, monitor);
currentProgram.getSymbolTable()
.removeSymbolSpecial(
getSymbol(mangled, currentProgram.getGlobalNamespace()));
List<Symbol> symbols =
getSymbols(mangled, currentProgram.getGlobalNamespace());
if (!symbols.isEmpty()) {
currentProgram.getSymbolTable().removeSymbolSpecial(symbols.get(0));
}
}
return;

View file

@ -96,20 +96,6 @@ public class NamespaceUtils {
return str;
}
/**
* Provide a standard method for splitting a symbol path into its
* various namespace and symbol name elements. While the current implementation
* uses a very simplistic approach, this may be improved upon in the future
* to handle various grouping concepts.
* @param path symbol namespace path (path will be trimmed before parse)
* @return order list of namespace names
* @deprecated use SymbolPath instead
*/
@Deprecated
public static List<String> splitNamespacePath(String path) {
return Arrays.asList(path.trim().split(Namespace.DELIMITER));
}
/**
* Get the library associated with the specified namespace
* @param namespace namespace

View file

@ -268,7 +268,7 @@ public class SymbolManager implements SymbolTable, ManagerDB {
Address storageAddr = oldAddress.getNewAddress(oldAddress.getOffset());
// move variable references - eliminate variable symbol bindings which are no longer supported
// move variable references - eliminate variable symbol bindings no longer supported
refManager.moveReferencesTo(oldAddress, storageAddr, monitor);
try {
@ -364,7 +364,7 @@ public class SymbolManager implements SymbolTable, ManagerDB {
}
/**
* Create mem references for the external entry points; then delete the table.
* Create memory references for the external entry points; then delete the table.
*/
private void processOldExternalEntryPoints(TaskMonitor monitor)
throws IOException, CancelledException {
@ -506,7 +506,7 @@ public class SymbolManager implements SymbolTable, ManagerDB {
DBRecord record =
adapter.createSymbol(newName, address, newParentID, SymbolType.LABEL, null,
null, null, source, true);
symbol.setRecord(record);// symbol object was morphed
symbol.setRecord(record);
symbolAdded(symbol);
}
catch (IOException e) {
@ -798,6 +798,7 @@ public class SymbolManager implements SymbolTable, ManagerDB {
return false;
}
@Override
public SymbolIterator getSymbolsAsIterator(Address addr) {
lock.acquire();
try {
@ -920,7 +921,7 @@ public class SymbolManager implements SymbolTable, ManagerDB {
}
private Symbol searchNamespaceForSymbol(Namespace namespace, String name, Address address) {
for (Symbol symbol : getSymbols(namespace)) {
for (Symbol symbol : getSymbols(namespace)) {// NOTE: thunks do not exist in external space
if (address.equals(symbol.getAddress()) && name.equals(symbol.getName())) {
return symbol;
}
@ -933,36 +934,11 @@ public class SymbolManager implements SymbolTable, ManagerDB {
((FunctionSymbol) sym).isThunk();
}
@Override
public Symbol getSymbol(String name, Namespace namespace) {
List<Symbol> symbols = getSymbols(name, namespace);
return symbols.isEmpty() ? null : symbols.get(0);
}
@Override
public Symbol getGlobalSymbol(String name, Address addr) {
return getSymbol(name, addr, program.getGlobalNamespace());
}
@Override
public Symbol getSymbol(String name) {
lock.acquire();
try {
Namespace global = namespaceMgr.getGlobalNamespace();
SymbolIterator it = getSymbols(name);
while (it.hasNext()) {
Symbol s = it.next();
if (s.getParentNamespace().equals(global)) {
return s;
}
}
return null;
}
finally {
lock.release();
}
}
@Override
public List<Symbol> getGlobalSymbols(String name) {
return getSymbols(name, namespaceMgr.getGlobalNamespace());
@ -1417,9 +1393,9 @@ public class SymbolManager implements SymbolTable, ManagerDB {
@Override
public long getDynamicSymbolID(Address addr) {
// Unique dynamic symbol ID produced from a dynamic symbol address map which has
// a high-order bit set to avoid potential conflict
// with stored symbol ID's which are assigned starting at 0.
// Unique dynamic symbol ID produced from a dynamic symbol address map which has a
// high-order bit set to avoid potential conflict with stored symbol ID's which are
// assigned starting at 0.
return dynamicSymbolAddressMap.getKey(addr);
}
@ -2116,7 +2092,9 @@ public class SymbolManager implements SymbolTable, ManagerDB {
program.dbError(e);
it = new EmptyRecordIterator();
}
return new SymbolRecordIterator(it, true, true); // NOTE: thunks do not exist in external space
// NOTE: thunks do not exist in external space
return new SymbolRecordIterator(it, true, true);
}
Lock getLock() {
@ -2211,13 +2189,14 @@ public class SymbolManager implements SymbolTable, ManagerDB {
}
Address newAddress = toAddr.add(symbol.getAddress().subtract(fromAddr));
// any address that has symbols added or removed may have a corrupted primary (too many or non-existent)
// any address that has symbols added or removed may have a corrupted primary
// (too many or non-existent)
primaryFixups.add(symbol.getAddress());
primaryFixups.add(newAddress);
moveSymbolForMemoryBlockMove((SymbolDB) symbol, newAddress);
}
// go back and make sure there is a valid primary symbol at touched addressess
// go back and make sure there is a valid primary symbol at touched addresses
fixupPrimarySymbols(primaryFixups);
}
finally {
@ -2729,12 +2708,6 @@ public class SymbolManager implements SymbolTable, ManagerDB {
}
}
@Override
public Symbol createSymbol(Address addr, String name, SourceType source)
throws InvalidInputException {
return createLabel(addr, name, source);
}
@Override
public Symbol createLabel(Address addr, String name, SourceType source)
throws InvalidInputException {
@ -2742,12 +2715,6 @@ public class SymbolManager implements SymbolTable, ManagerDB {
return createLabel(addr, name, null, source);
}
@Override
public Symbol createSymbol(Address addr, String name, Namespace namespace, SourceType source)
throws InvalidInputException, DuplicateNameException {
return createLabel(addr, name, namespace, source);
}
@Override
public Symbol createLabel(Address addr, String name, Namespace namespace, SourceType source)
throws InvalidInputException {

View file

@ -29,21 +29,20 @@ import ghidra.program.model.symbol.Reference;
*/
public interface Data extends CodeUnit, Settings {
// TODO: Fix javadocs !!
/**
* Returns the value of the data item. The value may be an address, a scalar,
* register or null if no value.
* @return the value
*/
public Object getValue();
/**
* Get the class used to express the value of this data.
* NOTE: This determination is made based upon data type
* and settings only and does not examine memory bytes
* which are used to construct the data value object.
* @return value class or null if a consistent class is not
* utilized.
*
* <p>NOTE: This determination is made based upon data type and settings only and does not
* examine memory bytes which are used to construct the data value object.
*
* @return value class or null if a consistent class is not utilized.
*/
public Class<?> getValueClass();
@ -67,24 +66,28 @@ public interface Data extends CodeUnit, Settings {
public boolean isVolatile();
/**
* Returns true if the data type is defined. Any address that has not been
* defined to be code or data is treated as undefined data.
* Returns true if the data type is defined. Any address that has not been defined to be code
* or data is treated as undefined data.
* @return true if is defined
*/
public boolean isDefined();
/**
* Get the Data type for the data.
* @return the data type
*/
public DataType getDataType();
/**
* If the dataType is a typeDef, then the typeDef's base type is returned,
* otherwise, the datatType is returned.
* If the dataType is a typeDef, then the typeDef's base type is returned, otherwise, the
* datatType is returned.
* @return the data type
*/
public DataType getBaseDataType();
/**
* Get the references for the value.
* @return the references
*/
public Reference[] getValueReferences();
@ -102,126 +105,136 @@ public interface Data extends CodeUnit, Settings {
public void removeValueReference(Address refAddr);
/**
* Get the field name of this data item if it is "inside" another data item,
* otherwise return null.
* Get the field name of this data item if it is "inside" another data item, otherwise return
* null.
* @return the name of this data as known from some parent data item or
* null if this data item is not a component of another data item.
*/
public String getFieldName();
/**
* Returns the full path name (dot notation) for this field. This includes
* the symbol name at this address.
* Returns the full path name (dot notation) for this field. This includes the symbol name at
* this address.
* @return the path name
*/
public String getPathName();
/**
* Returns the component path name (dot notation) for this field
* @return the component path name
*/
public String getComponentPathName();
/**
* Returns true if this is a pointer, implies getValue() will
* will return an Object that is an Address.
* Returns true if this is a pointer, implies getValue() will will return an Object that is an
* Address.
* @return true if a pointer
*/
public boolean isPointer();
/**
* Returns true if this data item is a Union.
* @return true if a union
*/
public boolean isUnion();
/**
* Returns true if this data item is a Structure.
* @return true if a structure
*/
public boolean isStructure();
/**
* Returns true if this data item is an Array of DataTypes
* @return true if an array
*/
public boolean isArray();
/**
* Returns true if this data item is a dynamic DataType.
* @return true if is dynamic
*/
public boolean isDynamic();
/**
* Get the immediate parent data item of this data item or null if this data
* item is not contained in another data item.
* Get the immediate parent data item of this data item or null if this data item is not
* contained in another data item.
* @return the data
*/
public Data getParent();
/**
* Get the highest level Data item in a hierarchy of structures
* containing this component.
* Get the highest level Data item in a hierarchy of structures containing this component.
* @return the data
*/
public Data getRoot();
/**
* Get the offset of this Data item from the start of the root data item of
* some hierarchy of structures.
* Get the offset of this Data item from the start of the root data item of some hierarchy of
* structures.
* @return the offset
*/
int getRootOffset();
public int getRootOffset();
/**
* Get the offset of this Data item from the start of its immediate
* parent.
* Get the offset of this Data item from the start of its immediate parent.
* @return the offset
*/
int getParentOffset();
public int getParentOffset();
/**
* Returns the immediate n'th component or null if none exists.
* @param index the index of the component to get.
* @return the component
*/
public Data getComponent(int index);
/**
* Get a data item given the index path. Each integer in the array represents
* an index into the data item at that level.
* Get a data item given the index path. Each integer in the array represents an index into
* the data item at that level.
* @param componentPath the array of indexes to use to find the requested data item.
* @return the component
*/
public Data getComponent(int[] componentPath);
/**
* Get the component path if this is a component. The component path is an
* array of integers that represent each index in the tree of data items. Top
* level data items have an empty array for thier component path.
* Get the component path if this is a component. The component path is an array of integers
* that represent each index in the tree of data items. Top level data items have an empty
* array for their component path.
* @return the path
*/
public int[] getComponentPath();
/**
* Return the number of components that make up this data item.
* if this is an Array, return the number of elements in the array.
* @return the number of components
*/
public int getNumComponents();
/**
* Return the first immediate child component that contains the byte
* at the given offset. It is important to note that with certain
* datatypes there may be more than one component containing the specified offset
* (see {@link #getComponentsContaining(int)}).
* Return the first immediate child component that contains the byte at the given offset. It
* is important to note that with certain datatypes there may be more than one component
* containing the specified offset (see {@link #getComponentsContaining(int)}).
*
* @param offset the amount to add to this data items address to get the
* address of the requested data item.
* @param offset the amount to add to this data items address to get the address of the
* requested data item.
* @return first data component containing offset or null
* @deprecated method name has been changed to better reflect behavior. The method
* {@link #getComponentContaining(int)} should be used instead.
*/
@Deprecated
Data getComponentAt(int offset);
@Deprecated(forRemoval = true, since = "10.1")
public Data getComponentAt(int offset);
/**
* RReturn the first immediate child component that contains the byte
* at the given offset. It is important to note that with certain
* datatypes there may be more than one component containing the specified offset
* (see {@link #getComponentsContaining(int)}).
* RReturn the first immediate child component that contains the byte at the given offset. It
* is important to note that with certain datatypes there may be more than one component
* containing the specified offset (see {@link #getComponentsContaining(int)}).
*
* @param offset the amount to add to this data items address to get the
* @return first data component containing offset or null
* address of the requested data item.
* @return first data component containing offset or null address of the requested data item.
*/
Data getComponentContaining(int offset);
public Data getComponentContaining(int offset);
/**
* Returns a list of all the immediate child components that contain the byte at the
@ -234,7 +247,7 @@ public interface Data extends CodeUnit, Settings {
* @return a list of all the immediate child components that contain the byte at the
* given offset or null if offset is out of bounds.
*/
List<Data> getComponentsContaining(int offset);
public List<Data> getComponentsContaining(int offset);
/**
* Returns the primitive component containing this offset (i.e., one that does not
@ -242,31 +255,34 @@ public interface Data extends CodeUnit, Settings {
* layers of other data items. This method immediately goes to the lowest level data item.
* If the minimum offset of a component is specified, the only first component containing
* the offset will be considered (e.g., 0-element array).
* @param offset the offset
* @return primitive component containing this offset
*/
Data getPrimitiveAt(int offset);
public Data getPrimitiveAt(int offset);
/**
* Get the index of this component in its parent
* @return -1 if this data item is not a component of another data item.
*/
int getComponentIndex();
public int getComponentIndex();
/**
* Get this data's component level in its hierarchy of components.
* @return the level of this data item with 0 being the level of top data items.
*/
int getComponentLevel();
public int getComponentLevel();
/**
* Returns a string that represents the data value without markup.
* @return the string
*/
public String getDefaultValueRepresentation();
/**
* Returns the appropriate string to use as the default label prefix or null if it has no
* prefered default label prefix;
* @param options
* preferred default label prefix;
* @param options the options
* @return the prefix
*/
public String getDefaultLabelPrefix(DataTypeDisplayOptions options);
}

View file

@ -68,10 +68,6 @@ public abstract class RefType {
static final byte __WRITE_IND = 105;
static final byte __READ_WRITE_IND = 106;
static final byte __UNKNOWNPARAM = 107;
@Deprecated
static final byte __STACK_READ = 110; // Use __READ instead
@Deprecated
static final byte __STACK_WRITE = 111; // Use __WRITE instead
static final byte __EXTERNAL_REF = 113;
static final byte __UNKNOWNDATA_IND = 114;
@ -246,21 +242,6 @@ public abstract class RefType {
public static final RefType READ_WRITE_IND = new DataRefType(__READ_WRITE_IND, "READ_WRITE_IND",
DataRefType.READX | DataRefType.WRITEX | DataRefType.INDX);
/**
* Reference type assigned for stack variable being read.
* @deprecated use {@link RefType#READ} instead
*/
@Deprecated
public static final RefType STACK_READ =
new DataRefType(__STACK_READ, "STACK_READ", DataRefType.READX);
/**
* Reference type assigned for stack variable being written.
* @deprecated use {@link RefType#WRITE} instead
*/
@Deprecated
public static final RefType STACK_WRITE =
new DataRefType(__STACK_WRITE, "STACK_WRITE", DataRefType.WRITEX);
/**
* Reference type used internally to identify external entry points.
* The use of this RefType for references to external library data or functions

View file

@ -31,7 +31,6 @@ import ghidra.util.datastruct.IntObjectHashtable;
/**
* Factory class to create RefType objects.
*/
@SuppressWarnings("deprecation")
public class RefTypeFactory {
private static final IntObjectHashtable<RefType> REFTYPE_LOOKUP_BY_TYPE_MAP =
@ -74,8 +73,6 @@ public class RefTypeFactory {
REFTYPE_LOOKUP_BY_TYPE_MAP.put(RefType.READ_IND.getValue(), RefType.READ_IND);
REFTYPE_LOOKUP_BY_TYPE_MAP.put(RefType.WRITE_IND.getValue(), RefType.WRITE_IND);
REFTYPE_LOOKUP_BY_TYPE_MAP.put(RefType.READ_WRITE_IND.getValue(), RefType.READ_WRITE_IND);
REFTYPE_LOOKUP_BY_TYPE_MAP.put(RefType.STACK_READ.getValue(), RefType.STACK_READ);
REFTYPE_LOOKUP_BY_TYPE_MAP.put(RefType.STACK_WRITE.getValue(), RefType.STACK_WRITE);
REFTYPE_LOOKUP_BY_TYPE_MAP.put(RefType.EXTERNAL_REF.getValue(), RefType.EXTERNAL_REF);
REFTYPE_LOOKUP_BY_TYPE_MAP.put(RefType.__CALL_OVERRIDE_UNCONDITIONAL,
RefType.CALL_OVERRIDE_UNCONDITIONAL);
@ -148,10 +145,10 @@ public class RefTypeFactory {
}
/**
* Get the default statck data RefType for the specified code-unit/opIndex and register
* @param cu
* @param reg
* @param opIndex
* Get the default stack data RefType for the specified code-unit/opIndex and register
* @param cu the code unit
* @param reg the register
* @param opIndex the op index
* @return default RefType
*/
public static RefType getDefaultRegisterRefType(CodeUnit cu, Register reg, int opIndex) {
@ -388,8 +385,8 @@ public class RefTypeFactory {
/**
* Get the default memory flow/data RefType for the specified code unit and opIndex.
* @param cu
* @param opIndex
* @param cu the code unit
* @param opIndex the op index
* @param toAddr reference destination
* @param ignoreExistingReferences if true existing references will not influence default
* reference type returned.
@ -453,7 +450,9 @@ public class RefTypeFactory {
}
if (!ignoreExistingReferences) {
Reference[] refs = cu.getProgram().getReferenceManager().getReferencesFrom(
Reference[] refs = cu.getProgram()
.getReferenceManager()
.getReferencesFrom(
cu.getMinAddress(), opIndex);
for (Reference ref : refs) {
if (ref.getToAddress().equals(toAddr)) {
@ -486,7 +485,7 @@ public class RefTypeFactory {
/**
* Return default flow-type without terminator
* @param inst
* @param inst the instruction
* @return call/jump flow type or null
*/
private static FlowType getDefaultJumpOrCallFlowType(Instruction inst) {

View file

@ -69,14 +69,6 @@ public interface SymbolTable {
public Symbol createLabel(Address addr, String name, SourceType source)
throws InvalidInputException;
/**
* @deprecated use {@link #createLabel(Address, String, SourceType)} instead.
* Deprecated in version 7.5, will be removed a few versions later.
*/
@Deprecated
public Symbol createSymbol(Address addr, String name, SourceType source)
throws InvalidInputException;
/**
* Create a label symbol with the given name associated to the given
* Address and namespace. The symbol will be of type SymbolType.CODE.
@ -99,14 +91,6 @@ public interface SymbolTable {
public Symbol createLabel(Address addr, String name, Namespace namespace, SourceType source)
throws InvalidInputException;
/**
* @deprecated use {@link #createLabel(Address, String, Namespace, SourceType)} instead.
* Deprecated in version 7.5, will be removed a few versions later.
*/
@Deprecated
public Symbol createSymbol(Address addr, String name, Namespace namespace, SourceType source)
throws DuplicateNameException, InvalidInputException;
/**
* Removes the specified symbol from the symbol table. If removing any <b>non-function</b>
* symbol the behavior will be the same as invoking {@link Symbol#delete()} on the
@ -128,21 +112,10 @@ public interface SymbolTable {
* symbol specific binding.
*
* @param sym the symbol to be removed.
*
* @return false, if removal of the symbol fails
*/
public boolean removeSymbolSpecial(Symbol sym);
// /**
// * This method is just a pass-through for {@link #removeSymbolSpecial(Symbol)}.
// *
// * @see #removeSymbolSpecial(Symbol)
// * @deprecated Call instead {@link #removeSymbolSpecial(Symbol)} or {@link Symbol#delete()}.
// * Deprecated in version 7.4, will be removed a few versions later.
// */
// @Deprecated
// public boolean removeSymbol(Symbol sym);
/**
* Get the symbol for the given symbol ID.
* @param symbolID the id of the symbol to be retrieved.
@ -153,16 +126,19 @@ public interface SymbolTable {
/**
* Get the symbol with the given name, address, and namespace.
* <P>
* Note that for a symbol to be uniquely specified, all these parameters are required. Any method
* that queries for symbols using just one or two of these parameters will return a list of symbols.
* This method will not return a default thunk (i.e., thunk function symbol with default source type)
* since it mirrors the name and parent namespace of the function it thunks.
* </P>
* Note that for a symbol to be uniquely specified, all these parameters are required. Any
* method that queries for symbols using just one or two of these parameters will return a list
* of symbols. This method will not return a default thunk (i.e., thunk function symbol with
* default source type) since it mirrors the name and parent namespace of the function it
* thunks.
*
* @param name the name of the symbol to retrieve
* @param addr the address of the symbol to retrieve
* @param namespace the namespace of the symbol to retrieve. May be null which indicates global namespace.
* @return the symbol which matches the specified crieria or null if not found
* @see #getGlobalSymbol(String, Address) for a convenience method if the namespace is the global namespace.
* @param namespace the namespace of the symbol to retrieve. May be null which indicates global
* namespace.
* @return the symbol which matches the specified criteria or null if not found
* @see #getGlobalSymbol(String, Address) for a convenience method if the namespace is the
* global namespace.
*/
public Symbol getSymbol(String name, Address addr, Namespace namespace);
@ -172,52 +148,20 @@ public interface SymbolTable {
* at the same address and namespace (in this case the global namespace).
*
* <P>This is just a convenience method for {@link #getSymbol(String, Address, Namespace)} where
* the namespace is the global namespace.</P>
* the namespace is the global namespace.
*
* <p>NOTE: This method will not return a default thunk (i.e., thunk function symbol with default source type)
* since it mirrors the name and parent namespace of the function it thunks.</p>
* <p>NOTE: This method will not return a default thunk (i.e., thunk function symbol with
* default source type) since it mirrors the name and parent namespace of the function it
* thunks.
*
* @param name the name of the symbol to retrieve
* @param addr the address of the symbol to retrieve
* @return the symbol which matches the specified crieria in the global namespace or null if not found
* @return the symbol which matches the specified criteria in the global namespace or null if
* not found
* @see #getSymbol(String, Address, Namespace)
*/
public Symbol getGlobalSymbol(String name, Address addr);
/**
* Returns the first symbol with the given name found in the given namespace. Ghidra now
* allows multiple symbols with the same name in the same namespace, so using this method
* is likely to produce unintended results. Use {@link #getSymbols(String, Namespace)} instead.
*
* <p>NOTE: This method will not return a default thunk (i.e.,
* thunk function symbol with default source type).</p>
*
* @param name the name of the symbol to retreive
* @param namespace the namespace of the symbol to retrieve (null assumes global namespace)
* @return the first symbol which satisifies specified criteria or null if not found
* @deprecated This method is no longer useful as Ghidra allows duplicate symbol names in
* the same namespace. Use {@link #getSymbols(String, Namespace)} instead.
* Deprecated in version 7.5, will be removed a few versions later.
*/
@Deprecated
public Symbol getSymbol(String name, Namespace namespace);
/**
* Returns the first global symbol that it finds with the given name. Now that Ghidra
* allows duplicate symbol names, this method is practically useless.
*
* <p>NOTE: This method will not return a default thunk (i.e.,
* thunk function symbol with default source type).</p>
*
* @param name the name of the symbol to be retrieved.
* @return first symbol found with specified name or null if no global symbol has that name
* @deprecated Use {@link #getGlobalSymbols(String)} instead. Ghidra now allows
* multiple symbols in any namespace to have the same name. Deprecated in Ghidra 7.5
* Deprecated in version 7.5, will be removed a few versions later.
*/
@Deprecated
public Symbol getSymbol(String name);
/**
* Returns a list of all global symbols with the given name.
*
@ -295,7 +239,7 @@ public interface SymbolTable {
/**
* Returns a symbol that is either a parameter or local variable. There can be only
* one because these symbol types have a unique name requirement.
* @param name the naem of the variable.
* @param name the name of the variable.
* @param function the function to search.
* @return a parameter or local variable symbol with the given name.
*/
@ -410,8 +354,8 @@ public interface SymbolTable {
public boolean hasSymbol(Address addr);
/**
* Get the unique symbol ID for a dynamic symbol associated with the speified addr.
* The generation of this symbol ID does not reflect the presence of a dyanmic symbol
* Get the unique symbol ID for a dynamic symbol associated with the specified addr.
* The generation of this symbol ID does not reflect the presence of a dynamic symbol
* at the specified addr. This symbol ID should not be permanently stored since the encoding
* may change between software releases.
* @param addr dynamic symbol address
@ -422,9 +366,9 @@ public interface SymbolTable {
/**
* Returns a an iterator over all symbols that match the given search string.
*
* <p>NOTE: The iterator is in the forward direction only and will not return default thunk functions.
* The resulting iterator will not return default thunks (i.e.,
* thunk function symbol with default source type).</p>
* <p>NOTE: The iterator is in the forward direction only and will not return default thunk
* functions. The resulting iterator will not return default thunks (i.e.,
* thunk function symbol with default source type).
*
* @param searchStr the string to search for (may contain * to match any sequence
* or ? to match a single char)
@ -575,8 +519,7 @@ public interface SymbolTable {
public Namespace getNamespace(Address addr);
/**
* Returns all Class Namespaces defined within the program in an
* arbitrary ordering.
* Returns all Class Namespaces defined within the program in an arbitrary ordering.
* @return iterator of {@link GhidraClass}
*/
public Iterator<GhidraClass> getClassNamespaces();
@ -587,8 +530,8 @@ public interface SymbolTable {
* @param name name of the namespace
* @param source the source of this class namespace's symbol
* @return new class namespace
* @throws DuplicateNameException thrown if another non function or label symbol
* exists with the given name
* @throws DuplicateNameException thrown if another non function or label symbol exists with
* the given name
* @throws InvalidInputException throw if the name has invalid characters or is null
* @throws IllegalArgumentException if you try to set the source to 'Symbol.DEFAULT'.
*/
@ -598,8 +541,8 @@ public interface SymbolTable {
/**
* Returns an iterator over all symbols that have the given symbol as its parent.
*
* <p>NOTE: The resulting iterator will not return default thunks (i.e.,
* thunk function symbol with default source type).</p>
* <p>NOTE: The resulting iterator will not return default thunks (i.e., thunk function symbol
* with default source type).
*
* @param parentSymbol the parent symbol
* @return symbol iterator