Documentation for interacting with basic blocks . More...
Documentation for interacting with basic blocks .
Classes | |
struct | BinaryNinja::BasicBlockEdge |
struct | BinaryNinja::PendingBasicBlockEdge |
class | BinaryNinja::BasicBlock |
struct BinaryNinja::BasicBlockEdge |
Class Members | ||
---|---|---|
BNBranchType | type | |
Ref< BasicBlock > | target | |
bool | backEdge | The source or destination of the edge, depending on context. |
bool | fallThrough |
struct BinaryNinja::PendingBasicBlockEdge |
Class Members | ||
---|---|---|
BNBranchType | type | |
Ref< Architecture > | arch | |
uint64_t | target | |
bool | fallThrough |
class BinaryNinja::BasicBlock |
Public Member Functions | |
BasicBlock (BNBasicBlock *block) | |
Ref< Function > | GetFunction () const |
Basic block function. | |
Ref< Architecture > | GetArchitecture () const |
Basic block architecture. | |
uint64_t | GetStart () const |
Starting address of the basic block. | |
void | SetEnd (uint64_t end) |
Set the end of a basic block. | |
uint64_t | GetEnd () const |
Ending address of the basic block. | |
uint64_t | GetLength () const |
Length of the basic block. | |
size_t | GetIndex () const |
Basic block index in list of blocks for the function. | |
std::vector< BasicBlockEdge > | GetOutgoingEdges () const |
List of basic block outgoing edges. | |
std::vector< BasicBlockEdge > | GetIncomingEdges () const |
List of basic block incoming edges. | |
bool | HasUndeterminedOutgoingEdges () const |
Whether basic block has undetermined outgoing edges. | |
bool | HasInvalidInstructions () const |
Whether the basic block has invalid instructions. | |
void | SetHasInvalidInstructions (bool value) |
Set whether the basic block has invalid instructions. | |
void | AddPendingOutgoingEdge (BNBranchType type, uint64_t addr, Ref< Architecture > arch=nullptr, bool fallThrough=false) |
Add a pending outgoing edge to this basic block. | |
std::vector< PendingBasicBlockEdge > | GetPendingOutgoingEdges () const |
Get a list of pending outgoing edges for this basic block. | |
void | ClearPendingOutgoingEdges () |
Clear the pending outgoing edges for this basic block. | |
void | SetUndeterminedOutgoingEdges (bool value) |
Set whether basic block has undetermined outgoing edges. | |
const uint8_t * | GetInstructionData (uint64_t addr, size_t *len) const |
Get the instruction data for a specific address in this basic block. | |
void | AddInstructionData (const void *data, size_t len) |
Add instruction data to the basic block. | |
void | SetFallThroughToFunction (bool value) |
Set whether the basic blocks falls through to a function. | |
bool | IsFallThroughToFunction () const |
Determine whether the basic block falls through to a function. | |
bool | CanExit () const |
Whether basic block can return or is tagged as 'No Return'. | |
void | SetCanExit (bool value) |
Sets whether basic block can return or is tagged as 'No Return'. | |
std::set< Ref< BasicBlock > > | GetDominators (bool post=false) const |
List of dominators for this basic block. | |
std::set< Ref< BasicBlock > > | GetStrictDominators (bool post=false) const |
List of dominators for this basic block. | |
Ref< BasicBlock > | GetImmediateDominator (bool post=false) const |
Get the immediate dominator of this basic block. | |
std::set< Ref< BasicBlock > > | GetDominatorTreeChildren (bool post=false) const |
List of child blocks in the dominator tree for this basic block. | |
std::set< Ref< BasicBlock > > | GetDominanceFrontier (bool post=false) const |
Get the dominance frontier for this basic block. | |
void | MarkRecentUse () |
std::vector< std::vector< InstructionTextToken > > | GetAnnotations () |
List of automatic annotations for the start of this block. | |
std::vector< DisassemblyTextLine > | GetDisassemblyText (DisassemblySettings *settings) |
property which returns a list of DisassemblyTextLine objects for the current basic block. | |
BNHighlightColor | GetBasicBlockHighlight () |
Get the current highlight color for the Basic Block. | |
void | SetAutoBasicBlockHighlight (BNHighlightColor color) |
Set the analysis basic block highlight color. | |
void | SetAutoBasicBlockHighlight (BNHighlightStandardColor color, uint8_t alpha=255) |
Set the analysis basic block highlight color. | |
void | SetAutoBasicBlockHighlight (BNHighlightStandardColor color, BNHighlightStandardColor mixColor, uint8_t mix, uint8_t alpha=255) |
Set the analysis basic block highlight color. | |
void | SetAutoBasicBlockHighlight (uint8_t r, uint8_t g, uint8_t b, uint8_t alpha=255) |
Set the analysis basic block highlight color. | |
void | SetUserBasicBlockHighlight (BNHighlightColor color) |
Set the basic block highlight color. | |
void | SetUserBasicBlockHighlight (BNHighlightStandardColor color, uint8_t alpha=255) |
Set the basic block highlight color. | |
void | SetUserBasicBlockHighlight (BNHighlightStandardColor color, BNHighlightStandardColor mixColor, uint8_t mix, uint8_t alpha=255) |
Set the basic block highlight color. | |
void | SetUserBasicBlockHighlight (uint8_t r, uint8_t g, uint8_t b, uint8_t alpha=255) |
Set the basic block highlight color. | |
bool | IsILBlock () const |
Whether the basic block contains IL. | |
bool | IsLowLevelILBlock () const |
Whether the basic block contains Low Level IL. | |
bool | IsMediumLevelILBlock () const |
Whether the basic block contains Medium Level IL. | |
bool | IsHighLevelILBlock () const |
Whether the basic block contains High Level IL. | |
Ref< LowLevelILFunction > | GetLowLevelILFunction () const |
Get the Low Level IL Function for this basic block. | |
Ref< MediumLevelILFunction > | GetMediumLevelILFunction () const |
Get the Medium Level IL Function for this basic block. | |
Ref< HighLevelILFunction > | GetHighLevelILFunction () const |
Get the High Level IL Function for this basic block. | |
bool | GetInstructionContainingAddress (uint64_t addr, uint64_t *start) |
Ref< BasicBlock > | GetSourceBlock () const |
Gets the corresponding assembly-level basic block for this basic block (which is itself, if called on an assembly-level basic block). | |
![]() | |
CoreRefCountObject () | |
virtual | ~CoreRefCountObject () |
BNBasicBlock * | GetObject () const |
void | AddRef () |
void | Release () |
void | AddRefForRegistration () |
void | ReleaseForRegistration () |
void | AddRefForCallback () |
void | ReleaseForCallback () |
Static Public Member Functions | |
static std::set< Ref< BasicBlock > > | GetIteratedDominanceFrontier (const std::set< Ref< BasicBlock > > &blocks) |
static bool | IsBackEdge (BasicBlock *source, BasicBlock *target) |
![]() | |
static BNBasicBlock * | GetObject (CoreRefCountObject *obj) |
static BNBasicBlock * | GetObject (const CoreRefCountObject *obj) |
Additional Inherited Members | |
![]() | |
std::atomic< int > | m_refs |
bool | m_registeredRef |
BNBasicBlock * | m_object |
BasicBlock::BasicBlock | ( | BNBasicBlock * | block | ) |
Basic block function.
Ref< Architecture > BasicBlock::GetArchitecture | ( | ) | const |
Basic block architecture.
uint64_t BasicBlock::GetStart | ( | ) | const |
Starting address of the basic block.
void BasicBlock::SetEnd | ( | uint64_t | end | ) |
Set the end of a basic block.
end | Ending address of the basic block |
uint64_t BasicBlock::GetEnd | ( | ) | const |
Ending address of the basic block.
uint64_t BasicBlock::GetLength | ( | ) | const |
Length of the basic block.
size_t BasicBlock::GetIndex | ( | ) | const |
Basic block index in list of blocks for the function.
vector< BasicBlockEdge > BasicBlock::GetOutgoingEdges | ( | ) | const |
List of basic block outgoing edges.
vector< BasicBlockEdge > BasicBlock::GetIncomingEdges | ( | ) | const |
List of basic block incoming edges.
bool BasicBlock::HasUndeterminedOutgoingEdges | ( | ) | const |
Whether basic block has undetermined outgoing edges.
bool BasicBlock::HasInvalidInstructions | ( | ) | const |
Whether the basic block has invalid instructions.
void BasicBlock::SetHasInvalidInstructions | ( | bool | value | ) |
Set whether the basic block has invalid instructions.
value | true if the basic block has invalid instructions, false otherwise |
void BasicBlock::AddPendingOutgoingEdge | ( | BNBranchType | type, |
uint64_t | addr, | ||
Ref< Architecture > | arch = nullptr, | ||
bool | fallThrough = false ) |
Add a pending outgoing edge to this basic block.
type | Type of the branch |
addr | Address of the target basic block |
arch | Optional architecture for the target basic block, default is nullptr |
fallThrough | Whether this is a fall-through edge, default false |
vector< PendingBasicBlockEdge > BasicBlock::GetPendingOutgoingEdges | ( | ) | const |
Get a list of pending outgoing edges for this basic block.
void BasicBlock::ClearPendingOutgoingEdges | ( | ) |
Clear the pending outgoing edges for this basic block.
void BasicBlock::SetUndeterminedOutgoingEdges | ( | bool | value | ) |
Set whether basic block has undetermined outgoing edges.
value | Whether basic block has undetermined outgoing edges |
const uint8_t * BasicBlock::GetInstructionData | ( | uint64_t | addr, |
size_t * | len ) const |
Get the instruction data for a specific address in this basic block.
addr | Address of the instruction |
len | Pointer to a size_t variable to store the length of the instruction data |
void BasicBlock::AddInstructionData | ( | const void * | data, |
size_t | len ) |
Add instruction data to the basic block.
data | Pointer to the instruction data |
len | Length of the instruction data |
void BasicBlock::SetFallThroughToFunction | ( | bool | value | ) |
Set whether the basic blocks falls through to a function.
value | Whether the basic block falls through to a function |
bool BasicBlock::IsFallThroughToFunction | ( | ) | const |
Determine whether the basic block falls through to a function.
bool BasicBlock::CanExit | ( | ) | const |
Whether basic block can return or is tagged as 'No Return'.
void BasicBlock::SetCanExit | ( | bool | value | ) |
Sets whether basic block can return or is tagged as 'No Return'.
value | Sets whether basic block can return or is tagged as 'No Return' |
set< Ref< BasicBlock > > BasicBlock::GetDominators | ( | bool | post = false | ) | const |
List of dominators for this basic block.
post | Whether to get post dominators (default: false) |
set< Ref< BasicBlock > > BasicBlock::GetStrictDominators | ( | bool | post = false | ) | const |
List of dominators for this basic block.
post | Whether to get post dominators (default: false) |
Ref< BasicBlock > BasicBlock::GetImmediateDominator | ( | bool | post = false | ) | const |
Get the immediate dominator of this basic block.
post | Whether to get the immediate post dominator |
set< Ref< BasicBlock > > BasicBlock::GetDominatorTreeChildren | ( | bool | post = false | ) | const |
List of child blocks in the dominator tree for this basic block.
post | Whether to get the post dominator tree children |
set< Ref< BasicBlock > > BasicBlock::GetDominanceFrontier | ( | bool | post = false | ) | const |
Get the dominance frontier for this basic block.
post | Whether to get the post dominance frontier |
|
static |
void BasicBlock::MarkRecentUse | ( | ) |
vector< vector< InstructionTextToken > > BasicBlock::GetAnnotations | ( | ) |
List of automatic annotations for the start of this block.
vector< DisassemblyTextLine > BasicBlock::GetDisassemblyText | ( | DisassemblySettings * | settings | ) |
property which returns a list of DisassemblyTextLine objects for the current basic block.
settings | Disassembly settings to use when fetching the text |
BNHighlightColor BasicBlock::GetBasicBlockHighlight | ( | ) |
Get the current highlight color for the Basic Block.
void BasicBlock::SetAutoBasicBlockHighlight | ( | BNHighlightColor | color | ) |
Set the analysis basic block highlight color.
color | Highlight Color |
void BasicBlock::SetAutoBasicBlockHighlight | ( | BNHighlightStandardColor | color, |
uint8_t | alpha = 255 ) |
Set the analysis basic block highlight color.
color | Highlight Color |
alpha | Transparency for the color |
void BasicBlock::SetAutoBasicBlockHighlight | ( | BNHighlightStandardColor | color, |
BNHighlightStandardColor | mixColor, | ||
uint8_t | mix, | ||
uint8_t | alpha = 255 ) |
Set the analysis basic block highlight color.
color | Highlight Color |
mixColor | Highlight Color to mix with `color` |
mix | Mix point |
alpha | Transparency of the colors |
void BasicBlock::SetAutoBasicBlockHighlight | ( | uint8_t | r, |
uint8_t | g, | ||
uint8_t | b, | ||
uint8_t | alpha = 255 ) |
Set the analysis basic block highlight color.
r | Red value, 0-255 |
g | Green value, 0-255 |
b | Blue value, 0-255 |
alpha | Transparency of the color |
void BasicBlock::SetUserBasicBlockHighlight | ( | BNHighlightColor | color | ) |
Set the basic block highlight color.
color | Highlight color |
void BasicBlock::SetUserBasicBlockHighlight | ( | BNHighlightStandardColor | color, |
uint8_t | alpha = 255 ) |
Set the basic block highlight color.
color | Highlight color |
alpha | Transparency of the color |
void BasicBlock::SetUserBasicBlockHighlight | ( | BNHighlightStandardColor | color, |
BNHighlightStandardColor | mixColor, | ||
uint8_t | mix, | ||
uint8_t | alpha = 255 ) |
Set the basic block highlight color.
color | Highlight Color |
mixColor | Highlight Color to mix with `color` |
mix | Mix point |
alpha | Transparency of the colors |
void BasicBlock::SetUserBasicBlockHighlight | ( | uint8_t | r, |
uint8_t | g, | ||
uint8_t | b, | ||
uint8_t | alpha = 255 ) |
Set the basic block highlight color.
r | Red value, 0-255 |
g | Green value, 0-255 |
b | Blue value, 0-255 |
alpha | Transparency of the color |
|
static |
bool BasicBlock::IsILBlock | ( | ) | const |
Whether the basic block contains IL.
bool BasicBlock::IsLowLevelILBlock | ( | ) | const |
Whether the basic block contains Low Level IL.
bool BasicBlock::IsMediumLevelILBlock | ( | ) | const |
Whether the basic block contains Medium Level IL.
bool BasicBlock::IsHighLevelILBlock | ( | ) | const |
Whether the basic block contains High Level IL.
Ref< LowLevelILFunction > BasicBlock::GetLowLevelILFunction | ( | ) | const |
Ref< MediumLevelILFunction > BasicBlock::GetMediumLevelILFunction | ( | ) | const |
Ref< HighLevelILFunction > BasicBlock::GetHighLevelILFunction | ( | ) | const |
bool BasicBlock::GetInstructionContainingAddress | ( | uint64_t | addr, |
uint64_t * | start ) |
Ref< BasicBlock > BasicBlock::GetSourceBlock | ( | ) | const |
Gets the corresponding assembly-level basic block for this basic block (which is itself, if called on an assembly-level basic block).