Package ghidra.app.cmd.function
Class CreateThunkFunctionCmd
Command for creating a thunk function at an address.
-
Constructor Summary
ConstructorDescriptionCreateThunkFunctionCmd
(Address entry, boolean checkForSideEffects) Constructs a new command for creating a thunk function that can compute the function this function is thunking to.CreateThunkFunctionCmd
(Address entry, AddressSetView body, Address referencedFunctionAddr) Constructs a new command for creating a thunk function.CreateThunkFunctionCmd
(Address entry, AddressSetView body, Address referencedFunctionAddr, List<Address> referringThunkAddresses) Constructs a new command for creating a thunk function.CreateThunkFunctionCmd
(Address entry, AddressSetView body, Symbol referencedSymbol) Constructs a new command for creating a thunk function. -
Method Summary
Modifier and TypeMethodDescriptionboolean
applyTo
(Program program, TaskMonitor monitor) Method called when this command is to apply changes to the given domain object.static Address
getThunkedAddr
(Program program, Address entry) if the code starting at entry is a thunk, return the thunked addess if known.static Address
getThunkedAddr
(Program program, Address entry, boolean checkForSideEffects) Get the address that this function would thunk if it is a valid thunkstatic boolean
Check if this is a Thunking function.Methods inherited from class ghidra.framework.cmd.BackgroundCommand
applyTo, canCancel, dispose, getName, getStatusMsg, hasProgress, isModal, run, setStatusMsg, taskCompleted, toString
-
Constructor Details
-
CreateThunkFunctionCmd
public CreateThunkFunctionCmd(Address entry, AddressSetView body, Address referencedFunctionAddr, List<Address> referringThunkAddresses) Constructs a new command for creating a thunk function.- Parameters:
entry
- entry point address for the function to be created.body
- set of addresses to associated with the function to be created. The addresses must not already be included in the body of any existing function. If null, and entry corresponds to an existing function, that function will be converted to a thunk, otherwise an error will result.referencedFunctionAddr
- the function address to which this thunk refers. If no function exists at that specified referencedFunctionAddr one will be created per the following scheme:- If referencedFunctionAddr is not contained within a memory block, an external function will
be created (a check will be done to look for an previously defined external location) - If referencedFunctionAddr corresponds to an instruction, a new function will be
created at that address.
- If referencedFunctionAddr is not contained within a memory block, an external function will
referringThunkAddresses
- provides a list of referring Thunk functions which lead to the creation of the function at entry.
-
CreateThunkFunctionCmd
Constructs a new command for creating a thunk function.- Parameters:
entry
- entry point address for the function to be created.body
- set of addresses to associated with the function to be created. The addresses must not already be included in the body of any existing function. If null, and entry corresponds to an existing function, that function will be converted to a thunk, otherwise an error will result.referencedFunctionAddr
- the function address to which this thunk refers. If no function exists at that specified referencedFunctionAddr one will be created per the following scheme:- If referencedFunctionAddr is not contained within a memory block, an external function will
be created (a check will be done to look for an previously defined external location) - If referencedFunctionAddr corresponds to an instruction, a new function will be
created at that address.
- If referencedFunctionAddr is not contained within a memory block, an external function will
-
CreateThunkFunctionCmd
Constructs a new command for creating a thunk function.- Parameters:
entry
- entry point address for the function to be created.body
- set of addresses to associated with the function to be created. The addresses must not already be included in the body of any existing function. If null, and entry corresponds to an existing function, that function will be converted to a thunk, otherwise an error will result.referencedSymbol
- the symbol which identifies the intended function to which this thunk refers. If no function exists at that specified referencedSymbol location, one will be created per the following scheme:- If referencedFunctionAddr is not contained within a memory block, an external function will
be created (a check will be done to look for an previously defined external location) - If referencedFunctionAddr corresponds to an instruction, a new function will be
created at that address. - If referencedSymbol corresponds to an external CODE symbol, it will be converted to an
external FUNCTION
- If referencedFunctionAddr is not contained within a memory block, an external function will
-
CreateThunkFunctionCmd
Constructs a new command for creating a thunk function that can compute the function this function is thunking to.- Parameters:
entry
- entry point address for the function to be created.checkForSideEffects
- true to check for side-effects that indicate it is not a pure thunk. The body may be computed. References to the thunked to function may be created. If no function exists at the location being thunked, it will be created based on the above rules.
-
-
Method Details
-
applyTo
Description copied from class:BackgroundCommand
Method called when this command is to apply changes to the given domain object. A monitor is provided to display status information about the command as it executes in the background.- Specified by:
applyTo
in classBackgroundCommand<Program>
- Parameters:
program
- domain object that will be affected by the commandmonitor
- monitor to show progress of the command- Returns:
- true if the command applied successfully
-
getThunkFunction
- Returns:
- function if create command was successful
-
getReferencedFunction
- Returns:
- the function referenced by the newly created thunk function is command was successful
-
getThunkedAddr
if the code starting at entry is a thunk, return the thunked addess if known.- Parameters:
program
- code resides inentry
- start of the code- Returns:
- the function address, Address.NO_ADDRESS if thunk but unknonw addr, null otherwise
-
getThunkedAddr
Get the address that this function would thunk if it is a valid thunk- Parameters:
program
- the programentry
- location to check for a thunkcheckForSideEffects
- true if there should be no extra registers affected- Returns:
- address that the thunk thunks,Address.NO_ADDRESS if thunk but unknown addr, null otherwise
-
isThunk
Check if this is a Thunking function.- Parameters:
program
- the programfunc
- function to check- Returns:
- true if this is a function thunking another.
-