ROSE
0.9.6a
|
Represents a function within the Partitioner. More...
#include <Partitioner.h>
Public Member Functions | |
Function (rose_addr_t entry_va) | |
Function (rose_addr_t entry_va, unsigned r) | |
Function (rose_addr_t entry_va, unsigned r, const std::string &name) | |
void | clear_basic_blocks () |
Remove all basic blocks from this function w/out deleting the blocks. More... | |
void | clear_data_blocks () |
Remove all data blocks from this function w/out deleting the blocks. More... | |
void | move_basic_blocks_from (Function *other) |
Move all basic blocks from the other function to this one. More... | |
void | move_data_blocks_from (Function *other) |
Move all data blocks from the other function to this one. More... | |
bool | possible_may_return () const |
Can this function return? Returns true if it is known that this function can return to its caller. More... | |
void | promote_may_return (SgAsmFunction::MayReturn new_value) |
Increase knowledge about the returnability of this function. More... | |
Function * | init_properties (const Function &other) |
Initialize properties from another function. More... | |
void | show_properties (FILE *) const |
Emit function property values. More... | |
BasicBlock * | entry_basic_block () const |
Return the pointer to the basic block at the entry address. More... | |
SgAsmFunction::MayReturn | get_may_return () const |
Accessor for the may-return property. More... | |
void | set_may_return (SgAsmFunction::MayReturn may_return) |
Accessor for the may-return property. More... | |
bool | changed_may_return () const |
Accessor for the may-return property. More... | |
void | commit_may_return () |
Accessor for the may-return property. More... | |
Public Attributes | |
unsigned | reason |
SgAsmFunction::FunctionReason bit flags. More... | |
std::string | name |
Name of function if known. More... | |
BasicBlocks | basic_blocks |
Basic blocks belonging to this function. More... | |
DataBlocks | data_blocks |
Data blocks belonging to this function. More... | |
bool | pending |
True if we need to (re)discover the basic blocks. More... | |
rose_addr_t | entry_va |
Entry virtual address. More... | |
Disassembler::AddressSet | heads |
CFG heads, excluding func entry: addresses of additional blocks. More... | |
Private Attributes | |
SgAsmFunction::MayReturn | may_return_cur |
Is it possible for this function to return? Current value of property. More... | |
SgAsmFunction::MayReturn | may_return_old |
Is it possible for this function to return? Previous value of property. More... | |
Represents a function within the Partitioner.
Each non-empty function will become an SgAsmFunction in the AST.
Definition at line 279 of file Partitioner.h.
|
inline |
Definition at line 281 of file Partitioner.h.
|
inline |
Definition at line 284 of file Partitioner.h.
|
inline |
Definition at line 287 of file Partitioner.h.
void Partitioner::Function::clear_basic_blocks | ( | ) |
Remove all basic blocks from this function w/out deleting the blocks.
Definition at line 534 of file Partitioner.C.
Referenced by Partitioner::build_ast().
void Partitioner::Function::clear_data_blocks | ( | ) |
Remove all data blocks from this function w/out deleting the blocks.
Definition at line 543 of file Partitioner.C.
Referenced by Partitioner::build_ast().
void Partitioner::Function::move_basic_blocks_from | ( | Function * | other) |
Move all basic blocks from the other function to this one.
Definition at line 552 of file Partitioner.C.
References basic_blocks, and heads.
Referenced by Partitioner::merge_functions().
void Partitioner::Function::move_data_blocks_from | ( | Function * | other) |
Move all data blocks from the other function to this one.
Definition at line 566 of file Partitioner.C.
References data_blocks.
Referenced by Partitioner::merge_functions().
|
inline |
Accessor for the may-return property.
The may-return property indicates whether this function returns to its caller. This is a two-part property storing both the current value and the previous value; this enables us to detect transitions after the fact, when it is more efficient to process them than when they actually occur. Setting the current value does not update the old value; the old value is updated only by the commit_may_return() method.
Definition at line 309 of file Partitioner.h.
References may_return_cur.
Referenced by Partitioner::build_ast(), Partitioner::detach_thunk(), Partitioner::merge_functions(), and possible_may_return().
|
inline |
Accessor for the may-return property.
The may-return property indicates whether this function returns to its caller. This is a two-part property storing both the current value and the previous value; this enables us to detect transitions after the fact, when it is more efficient to process them than when they actually occur. Setting the current value does not update the old value; the old value is updated only by the commit_may_return() method.
Definition at line 310 of file Partitioner.h.
References may_return_cur.
Referenced by Partitioner::detach_thunk(), and Partitioner::mark_elf_plt_entries().
|
inline |
Accessor for the may-return property.
The may-return property indicates whether this function returns to its caller. This is a two-part property storing both the current value and the previous value; this enables us to detect transitions after the fact, when it is more efficient to process them than when they actually occur. Setting the current value does not update the old value; the old value is updated only by the commit_may_return() method.
Definition at line 311 of file Partitioner.h.
References may_return_cur, and may_return_old.
Referenced by Partitioner::analyze_cfg().
|
inline |
Accessor for the may-return property.
The may-return property indicates whether this function returns to its caller. This is a two-part property storing both the current value and the previous value; this enables us to detect transitions after the fact, when it is more efficient to process them than when they actually occur. Setting the current value does not update the old value; the old value is updated only by the commit_may_return() method.
Definition at line 312 of file Partitioner.h.
References may_return_cur, and may_return_old.
Referenced by Partitioner::analyze_cfg().
|
inline |
Can this function return? Returns true if it is known that this function can return to its caller.
Definition at line 316 of file Partitioner.h.
References get_may_return(), SgAsmFunction::RET_ALWAYS, and SgAsmFunction::RET_SOMETIMES.
Referenced by Partitioner::analyze_cfg(), and Partitioner::successors().
void Partitioner::Function::promote_may_return | ( | SgAsmFunction::MayReturn | new_value) |
Increase knowledge about the returnability of this function.
A current value of RET_UNKNOWN is always changed to the new_value
. A current value of RET_SOMETIMES can be changed to RET_ALWAYS or RET_NEVER. A current value of RET_ALWAYS or RET_NEVER is not modified (not even to change RET_ALWAYS to RET_NEVER or vice versa).
Definition at line 577 of file Partitioner.C.
References SgAsmFunction::RET_ALWAYS, SgAsmFunction::RET_NEVER, SgAsmFunction::RET_SOMETIMES, and SgAsmFunction::RET_UNKNOWN.
Referenced by Partitioner::analyze_cfg(), Partitioner::append(), and Partitioner::merge_functions().
Initialize properties from another function.
This causes the properties of the other
function to be copied into this function without changing this function's list of blocks or entry address. The pending
status of this function may be set if set in other
, but it will never be cleared. Returns this
.
void Partitioner::Function::show_properties | ( | FILE * | debug) | const |
Emit function property values.
This is mostly for debugging. If the file handle is null then nothing happens.
Definition at line 593 of file Partitioner.C.
References rose::stringifySgAsmFunctionMayReturn().
Referenced by Partitioner::discover_first_block().
Partitioner::BasicBlock * Partitioner::Function::entry_basic_block | ( | ) | const |
Return the pointer to the basic block at the entry address.
Returns null if there is no basic block assigned to this function at that address.
Definition at line 605 of file Partitioner.C.
Referenced by Partitioner::is_pe_dynlink_thunk(), and Partitioner::name_pe_dynlink_thunks().
unsigned Partitioner::Function::reason |
SgAsmFunction::FunctionReason bit flags.
Definition at line 339 of file Partitioner.h.
Referenced by Partitioner::add_function(), Partitioner::analyze_cfg(), Partitioner::build_ast(), Partitioner::detach_thunk(), Partitioner::discover_first_block(), Partitioner::fixup_pointers(), Partitioner::is_thunk(), Partitioner::merge_function_fragments(), Partitioner::merge_functions(), Partitioner::name_pe_dynlink_thunks(), Partitioner::FindData::operator()(), Partitioner::FindFunctionFragments::operator()(), Partitioner::FindPostFunctionInsns::operator()(), and Partitioner::post_cfg().
std::string Partitioner::Function::name |
Name of function if known.
Definition at line 340 of file Partitioner.h.
Referenced by Partitioner::add_function(), Partitioner::analyze_cfg(), Partitioner::build_ast(), Partitioner::detach_thunk(), Partitioner::discover_blocks(), Partitioner::discover_first_block(), Partitioner::merge_functions(), Partitioner::name_import_entries(), and Partitioner::name_pe_dynlink_thunks().
BasicBlocks Partitioner::Function::basic_blocks |
Basic blocks belonging to this function.
Definition at line 341 of file Partitioner.h.
Referenced by Partitioner::append(), Partitioner::build_ast(), Partitioner::detach_thunk(), Partitioner::function_extent(), Partitioner::is_pe_dynlink_thunk(), Partitioner::is_thunk(), Partitioner::merge_function_fragments(), move_basic_blocks_from(), and Partitioner::remove().
DataBlocks Partitioner::Function::data_blocks |
Data blocks belonging to this function.
Definition at line 342 of file Partitioner.h.
Referenced by Partitioner::append(), Partitioner::build_ast(), Partitioner::detach_thunk(), Partitioner::function_extent(), move_data_blocks_from(), and Partitioner::remove().
bool Partitioner::Function::pending |
True if we need to (re)discover the basic blocks.
Definition at line 343 of file Partitioner.h.
Referenced by Partitioner::analyze_cfg(), Partitioner::detach_thunk(), Partitioner::discover_blocks(), Partitioner::discover_first_block(), Partitioner::find_bb_starting(), Partitioner::merge_functions(), and Partitioner::FindPostFunctionInsns::operator()().
rose_addr_t Partitioner::Function::entry_va |
Entry virtual address.
Definition at line 344 of file Partitioner.h.
Referenced by Partitioner::add_function(), Partitioner::analyze_cfg(), Partitioner::build_ast(), Partitioner::detach_thunk(), Partitioner::discover_blocks(), Partitioner::discover_first_block(), Partitioner::merge_functions(), Partitioner::name_import_entries(), Partitioner::FindDataPadding::operator()(), Partitioner::FindData::operator()(), Partitioner::FindInsnPadding::operator()(), Partitioner::FindThunkTables::operator()(), Partitioner::FindInterPadFunctions::operator()(), and Partitioner::FindPostFunctionInsns::operator()().
Disassembler::AddressSet Partitioner::Function::heads |
CFG heads, excluding func entry: addresses of additional blocks.
Definition at line 345 of file Partitioner.h.
Referenced by Partitioner::append(), Partitioner::detach_thunk(), Partitioner::discover_blocks(), move_basic_blocks_from(), and Partitioner::post_cfg().
|
private |
Is it possible for this function to return? Current value of property.
Definition at line 349 of file Partitioner.h.
Referenced by changed_may_return(), commit_may_return(), get_may_return(), and set_may_return().
|
private |
Is it possible for this function to return? Previous value of property.
Definition at line 350 of file Partitioner.h.
Referenced by changed_may_return(), and commit_may_return().