@@ -52,13 +52,9 @@ def __getitem__(self, value):
5252
5353class BaseRenderLayer (metaclass = _RenderLayerMetaclass ):
5454 """
55- RenderLayer is a plugin class that allows you to customize the presentation of
56- Linear and Graph view output, adding, changing, or removing lines before they are
57- presented in the UI.
58-
59- BaseRenderLayer provides a lower-level interface for manipulating the graphs
60- and lines directly, whereas RenderLayer provides an interface where you can
61- choose to target a specific IL level or a couple different Linear View specific
55+ BaseRenderLayer provides a lower-level interface for manipulating graphs
56+ and lines directly, whereas :py:class:`RenderLayer` provides an interface where you
57+ can choose to target a specific IL level or a couple different Linear View specific
6258 line constructs.
6359 """
6460
@@ -92,7 +88,7 @@ def register(cls):
9288 cls ._registered_layers .append (layer )
9389
9490 def __eq__ (self , other ):
95- if not isinstance (other , RenderLayer ):
91+ if not isinstance (other , BaseRenderLayer ):
9692 return False
9793 return self .name == other .name
9894
@@ -250,7 +246,7 @@ def apply_to_low_level_il_block(
250246 Subclasses should modify the input `lines` list to make modifications to
251247 the presentation of the block.
252248
253- .. note:: This function will only handle Lifted IL/LLIL/LLIL(SSA) lines.
249+ .. note:: This function will only handle Lifted IL/LLIL/LLIL(SSA) lines. \
254250 You can use the block's `function_graph_type` property to determine which is being handled.
255251
256252 :param block: Basic Block containing those lines
@@ -268,7 +264,7 @@ def apply_to_medium_level_il_block(
268264 Subclasses should modify the input `lines` list to make modifications to
269265 the presentation of the block.
270266
271- .. note:: This function will only handle MLIL/MLIL(SSA)/Mapped MLIL/Mapped MLIL(SSA) lines.
267+ .. note:: This function will only handle MLIL/MLIL(SSA)/Mapped MLIL/Mapped MLIL(SSA) lines. \
272268 You can use the block's `function_graph_type` property to determine which is being handled.
273269
274270 :param block: Basic Block containing those lines
@@ -286,11 +282,11 @@ def apply_to_high_level_il_block(
286282 Subclasses should modify the input `lines` list to make modifications to
287283 the presentation of the block.
288284
289- .. note:: This function will only handle HLIL/HLIL(SSA)/Language Representation lines.
285+ .. note:: This function will only handle HLIL/HLIL(SSA)/Language Representation lines. \
290286 You can use the block's `function_graph_type` property to determine which is being handled.
291287
292- .. warning:: This function will NOT apply to High Level IL bodies as displayed
293- in Linear View! Those are handled by `apply_to_hlil_body` instead as they
288+ .. warning:: This function will NOT apply to High Level IL bodies as displayed \
289+ in Linear View! Those are handled by `apply_to_hlil_body` instead as they \
294290 do not have a Basic Block associated with them.
295291
296292 :param block: Basic Block containing those lines
@@ -308,8 +304,8 @@ def apply_to_hlil_body(
308304 Subclasses should modify the input `lines` list to make modifications to
309305 the presentation of the function.
310306
311- .. warning:: This function only applies to Linear View, and not to Graph View!
312- If you want to handle Graph View too, you will need to use `apply_to_high_level_il_block`
307+ .. warning:: This function only applies to Linear View, and not to Graph View! \
308+ If you want to handle Graph View too, you will need to use `apply_to_high_level_il_block` \
313309 and handle the lines one block at a time.
314310
315311 :param function: Function containing those lines
@@ -342,7 +338,11 @@ def apply_to_block(
342338 lines : List ['binaryninja.DisassemblyTextLine' ],
343339 ):
344340 """
341+ Apply to lines generated by a Basic Block, of any type. If not overriden, this
342+ function will call the appropriate apply_to_X_level_il_block function.
345343
344+ :param block: Basic Block containing those lines
345+ :param lines: Lines of text for the block, to be modified by this function
346346 """
347347 if not block .is_il :
348348 self .apply_to_disassembly_block (block , lines )
@@ -357,6 +357,13 @@ def apply_to_block(
357357 pass
358358
359359 def apply_to_flow_graph (self , graph : 'binaryninja.FlowGraph' ) -> None :
360+ """
361+ Overridden from BaseRenderLayer to provide more specific callbacks. Check
362+ :py:func:`BaseRenderLayer.apply_to_flow_graph` in case you want to
363+ override this directly.
364+
365+ :param graph: Graph to modify
366+ """
360367 for i , node in enumerate (graph .nodes ):
361368 lines = node .lines
362369 if node .basic_block is not None and isinstance (node .basic_block , binaryninja .BasicBlock ):
@@ -370,6 +377,17 @@ def apply_to_linear_view_object(
370377 next : Optional ['binaryninja.LinearViewObject' ],
371378 lines : List ['binaryninja.LinearDisassemblyLine' ]
372379 ) -> List ['binaryninja.LinearDisassemblyLine' ]:
380+ """
381+ Overridden from BaseRenderLayer to provide more specific callbacks. Check
382+ :py:func:`BaseRenderLayer.apply_to_linear_view_object` in case you want to
383+ override this directly.
384+
385+ :param obj: Linear View Object being rendered
386+ :param prev: Linear View Object located directly above this one
387+ :param next: Linear View Object located directly below this one
388+ :param lines: Lines originally rendered by the Linear View Object
389+ :return: Updated set of lines to display in Linear View
390+ """
373391 # Hack: HLIL bodies don't have basic blocks
374392 if obj .identifier .name == "Body" :
375393 self .apply_to_hlil_body (lines [0 ].function , lines )
0 commit comments