summaryrefslogtreecommitdiff
path: root/python/basicblock.py
diff options
context:
space:
mode:
authorJordan Wiens <jordan@psifertex.com>2024-02-19 15:04:00 -0500
committerJordan Wiens <jordan@psifertex.com>2024-02-23 11:14:06 -0500
commit448f40be71dffa86a6581c3696627ccc1bdf74f2 (patch)
treecd79923c85986c0135b41eb7432e54218f1a56e5 /python/basicblock.py
parent748c2295e31c03afa1d4b1b776a59f9fa9a48d34 (diff)
4.0 documentation
- Refactored Type Documentation - Added Projects - Added Type Archives - Added New Sidebar Documentation - Added String Concepts - Added Light/Dark Mode - Added New Tab Documentation - Added BNIL Guide: HLIL docs - Added new cookbook examples - Added migration guide - Added script for building docsets - Added documentation for themes - Updated all images to Ninja Edit - API Docs : Documents BasicBlockEdge and BasicBlock - API Docs : Documents CoreVariable, Variable, and VariableNameAndType - API Docs : Corrects note on `BinaryView.update_analysis` and `BinaryView.update_analysis_and_wait` to represent that analysis is run by default for you now. - Many, many other changes
Diffstat (limited to 'python/basicblock.py')
-rw-r--r--python/basicblock.py25
1 files changed, 24 insertions, 1 deletions
diff --git a/python/basicblock.py b/python/basicblock.py
index a22b540f..6c03fe32 100644
--- a/python/basicblock.py
+++ b/python/basicblock.py
@@ -33,6 +33,18 @@ from . import function as _function
@dataclass(frozen=True)
class BasicBlockEdge:
+ """
+ ``class BasicBlockEdge`` represents the edges that connect basic blocks in graph view.
+
+ :cvar type: The :py:meth:`enums.BranchType` of the edge; Whether the edge is a true branch, false branch, unconditional, etc.
+ :cvar source: The basic block that the edge originates from.
+ :cvar target: The basic block that the edge is going to.
+ :cvar backedge: Whether this edge targets to a node whose control flow can eventually flow back through the source node of this edge.
+ :Example:
+
+ >>> current_basic_block.outgoing_edges
+ [<TrueBranch: x86_64@0x6>, <FalseBranch: x86_64@0x1f>]
+ """
type: BranchType
source: 'BasicBlock'
target: 'BasicBlock'
@@ -50,7 +62,18 @@ class BasicBlockEdge:
class BasicBlock:
"""
- The ``BasicBlock`` object is returned during analysis and should not be directly instantiated.
+ The ``class BasicBlock`` object is returned during analysis and should not be directly instantiated.
+
+ Basic blocks contain a sequence of instructions that must execute in-order with no branches.
+ We include calls in basic blocks, which technically violates that assumption, but you can mark
+ functions as `func.can_return = False` if a given function should terminate basic blocks.
+ :Example:
+
+ >>> for func in bv.functions:
+ >>> for bb in func:
+ >>> # Any block-based analysis could start here
+ >>> for inst in bb:
+ >>> pass # Optionally do something here with instructions
"""
def __init__(self, handle: core.BNBasicBlockHandle, view: Optional['binaryview.BinaryView'] = None):
self._view = view