Class ExternalSymbolResolver
java.lang.Object
ghidra.program.util.ExternalSymbolResolver
- All Implemented Interfaces:
Closeable, AutoCloseable
Moves dangling external function symbols found in the
EXTERNAL/UNKNOWN
namespace into the namespace of the external library that publishes a matching symbol.-
Constructor Summary
Constructors -
Method Summary
ChangeModifier and TypeMethodDescriptionvoidaddProgramToFixup(Loaded<Program> loaded) Queues aLoadedPrograminto this session that will be fixed whenfixUnresolvedExternalSymbols()is called.voidaddProgramToFixup(Program program) Queues a program into this session that will be fixed whenfixUnresolvedExternalSymbols()is called.voidclose()voidResolves any unresolved external symbols in each program that has been queued up viaaddProgramToFixup(Loaded)oraddProgramToFixup(Program).protected ProgramgetLibraryProgram(String libPath) Fetches a program from a cache of Program instances.booleanReturns true if there was an error encountered when trying to open an external library.voidLogs information about the libraries and symbols that were found during the fixup.protected ProgramopenLibraryFile(DomainFile libDf, String libPath) Opens a library binary.REMOVEDStringgetRequiredLibraryProperty(int libraryIndex) RemovedREMOVEDList<String>getOrderedRequiredLibraryNames(Program program) Removed
-
Constructor Details
-
ExternalSymbolResolver
-
-
Method Details
-
addProgramToFixup
Queues a program into this session that will be fixed whenfixUnresolvedExternalSymbols()is called.The program should be fully persisted to the project if using this method, otherwise use
addProgramToFixup(Loaded).- Parameters:
program-Programto fix
-
addProgramToFixup
-
hasProblemLibraries
public boolean hasProblemLibraries()Returns true if there was an error encountered when trying to open an external library.- Returns:
- boolean flag, true if there was a problem opening an external library
-
close
public void close()- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable
-
fixUnresolvedExternalSymbols
Resolves any unresolved external symbols in each program that has been queued up viaaddProgramToFixup(Loaded)oraddProgramToFixup(Program).- Throws:
CancelledException- if cancelled
-
logInfo
-
getLibraryProgram
Fetches a program from a cache of Program instances. If the requested program isn't currently in the cache, it will be opened (if possible).This cache of programs are pinned by registering a consumer on the program, and will be released during
close()of this ExternalSymbolServer instance.This cache is shared between all ProgramSymbolResolver instances (that were created by calling
addProgramToFixup(Loaded)oraddProgramToFixup(Program)).- Parameters:
libPath- project path to a library program- Returns:
Program, or null if not found or other error during opening- Throws:
CancelledException- if cancelled
-
openLibraryFile
Opens a library binary.- Parameters:
libDf- optional, reference to a the DomainFile that was found in a project. If null (meaning a lookup in the project failed to find a matching file), libPath will be used when creating error strings that reference the problematic filelibPath- project path for the DomainFile- Returns:
- a opened
Program - Throws:
CancelledException- if cancelled
-