Package ghidra.app.cmd.function
Class CallDepthChangeInfo
java.lang.Object
ghidra.app.cmd.function.CallDepthChangeInfo
Given a function in a program or the start of a function, record information
about the change to a stack pointer from a subroutine call. The routine
getCallChange() can be called with the address of a call instruction. If the
stack could be tracked, the call instruction will return the change in the
stack pointer that would result from a call to the function.
The computation is based on a set of equations that are generated and solved.
Each equation represents the stack change for a given basic flow block or
call instruction within the function.
-
Constructor Summary
ConstructorDescriptionCallDepthChangeInfo
(Function func) Construct a new CallDepthChangeInfo object.CallDepthChangeInfo
(Function function, AddressSetView restrictSet, Register frameReg, TaskMonitor monitor) Construct a new CallDepthChangeInfo object.CallDepthChangeInfo
(Function func, TaskMonitor monitor) Construct a new CallDepthChangeInfo object.CallDepthChangeInfo
(Program program, Address addr, AddressSetView restrictSet, Register frameReg, TaskMonitor monitor) Construct a new CallDepthChangeInfo object. -
Method Summary
Modifier and TypeMethodDescriptionint
getCallChange
(Address addr) int
int
Inspect the instruction and return how it affects the stack depth.int
getRegDepth
(Address addr, Register reg) getRegValueRepresentation
(Address addr, Register reg) int
getSPDepth
(Address addr) static Integer
getStackDepthChange
(Program program, Address address) Gets the stack depth change value that has been set at the indicated address.static AddressIterator
getStackDepthChanges
(Program program, AddressSetView addressSet) Gets an iterator indicating all the addresses that have a stack depth change value specified within a program's indicated address set.int
getStackOffset
(Instruction cu, int opIndex) int
static boolean
removeStackDepthChange
(Program program, Address address) Removes the value for the stack depth change at the indicated address.static void
setStackDepthChange
(Program program, Address address, int stackDepthChange) Sets a new value for the stack depth change at the indicated address.
-
Constructor Details
-
CallDepthChangeInfo
Construct a new CallDepthChangeInfo object.- Parameters:
func
- function to examine
-
CallDepthChangeInfo
Construct a new CallDepthChangeInfo object.- Parameters:
func
- function to examinemonitor
- monitor used to cancel the operation- Throws:
CancelledException
- if the operation was canceled
-
CallDepthChangeInfo
public CallDepthChangeInfo(Function function, AddressSetView restrictSet, Register frameReg, TaskMonitor monitor) throws CancelledException Construct a new CallDepthChangeInfo object.- Parameters:
function
- function to examinerestrictSet
- set of addresses to restrict flow flowing to.frameReg
- register that is to have it's depth(value) change trackedmonitor
- monitor used to cancel the operation- Throws:
CancelledException
- if the operation was canceled
-
CallDepthChangeInfo
public CallDepthChangeInfo(Program program, Address addr, AddressSetView restrictSet, Register frameReg, TaskMonitor monitor) throws CancelledException Construct a new CallDepthChangeInfo object.- Parameters:
program
- program containing the function to examimeaddr
- address within the function to examinerestrictSet
- set of addresses to restrict flow flowing to.frameReg
- register that is to have it's depth(value) change trackedmonitor
- monitor used to cancel the operation- Throws:
CancelledException
- if the operation was canceled
-
-
Method Details
-
getCallChange
-
getDepth
-
getInstructionStackDepthChange
Inspect the instruction and return how it affects the stack depth. If the depth cannot be determined, then return that the stack depth change is unknown.- Parameters:
instr
- instruction to analyze- Returns:
- int change to stack depth if it can be determined, Function.UNKNOWN_STACK_DEPTH_CHANGE otherwise.
-
getStackDepthChange
Gets the stack depth change value that has been set at the indicated address.- Parameters:
program
- the program to be checkedaddress
- the program address- Returns:
- the stack depth change value or null if value has not been set
-
setStackDepthChange
public static void setStackDepthChange(Program program, Address address, int stackDepthChange) throws DuplicateNameException Sets a new value for the stack depth change at the indicated address.- Parameters:
program
- the program where the value will be setaddress
- the program addressstackDepthChange
- the new stack depth change value- Throws:
DuplicateNameException
- if the property name for stack depth changes conflicted with another property tha has the same name.
-
removeStackDepthChange
Removes the value for the stack depth change at the indicated address.- Parameters:
program
- the program where the value will be removedaddress
- the program address- Returns:
- true if a stack depth change existed at the indicated at the address and it was removed.
-
getStackDepthChanges
Gets an iterator indicating all the addresses that have a stack depth change value specified within a program's indicated address set.- Parameters:
program
- the program to be checkedaddressSet
- the set of addresses to check for a stack depth change value- Returns:
- the address iterator indicating where stack depth change values have been set
-
getStackPurge
public int getStackPurge() -
getStackOffset
-
getSPDepth
- Parameters:
addr
- the address to get the stack pointer depth at.- Returns:
- the stack pointer depth at the address.
-
getRegDepth
- Parameters:
addr
- the address to get the register depth at.reg
- the register to get the depth of.- Returns:
- the depth of the register at the address.
-
getRegValueRepresentation
- Parameters:
addr
- the address of the register value to get the representation of.reg
- the register to get the representation of.- Returns:
- the string representation of the register value.
-