constantrenderer module¶
Class |
Description |
|---|---|
|
|
|
ConstantRenderer¶
- class ConstantRenderer[source]¶
Bases:
objectclass ConstantRendererallows custom rendering of constants in high level representations.The
render_constantmethod will be called when rendering constants that aren’t pointers, while therender_constant_pointermethod will be called when rendering constant pointers. Theis_valid_for_typemethod can be optionally overridden to call the rendering methods only when the expression type matches a custom filter.- is_valid_for_type(func: HighLevelILFunction, type: Type) bool[source]¶
Determines if the rendering methods should be called for the given expression type. It is optional to override this method. If the method isn’t overridden, all expression types are passed to the rendering methods.
- Parameters:
func (HighLevelILFunction) – HighLevelILFunction representing the high level function to be rendered
type (Type) – Type of the expression
- Returns:
True if the constant should be passed to the rendering methods, False otherwise
- Return type:
- render_constant(instr: HighLevelILInstruction, type: Type, val: int, tokens: HighLevelILTokenEmitter, settings: DisassemblySettings | None, precedence: OperatorPrecedence) bool[source]¶
Can be overridden to render a constant that is not a pointer. The expression type and value of the expression are given. If the expression is not handled by this constant renderer, this method should return False.
To render a constant, emit the tokens to the tokens object and return True.
- Parameters:
instr (HighLevelILInstruction) – High level expression
type (Type) – Type of the expression
val (int) – Value of the expression
tokens (HighLevelILTokenEmitter) – Token emitter for adding the rendered tokens
settings (DisassemblySettings | None) – Settings for rendering
precedence (OperatorPrecedence) – Operator precedence of the expression
- Returns:
True if the constant was rendered, False otherwise
- Return type:
- render_constant_pointer(instr: HighLevelILInstruction, type: Type, val: int, tokens: HighLevelILTokenEmitter, settings: DisassemblySettings | None, symbol_display: SymbolDisplayType, precedence: OperatorPrecedence) bool[source]¶
Can be overridden to render a constant pointer. The expression type and value of the expression are given. If the expression is not handled by this constant renderer, this method should return False.
To render a constant pointer, emit the tokens to the tokens object and return True.
- Parameters:
instr (HighLevelILInstruction) – High level expression
type (Type) – Type of the expression
val (int) – Value of the expression
tokens (HighLevelILTokenEmitter) – Token emitter for adding the rendered tokens
settings (DisassemblySettings | None) – Settings for rendering
symbol_display (SymbolDisplayType) – Type of symbol to display
precedence (OperatorPrecedence) – Operator precedence of the expression
- Returns:
True if the constant was rendered, False otherwise
- Return type:
- renderer_name = None¶
CoreConstantRenderer¶
- class CoreConstantRenderer[source]¶
Bases:
ConstantRenderer- is_valid_for_type(func: HighLevelILFunction, type: Type) bool[source]¶
Determines if the rendering methods should be called for the given expression type. It is optional to override this method. If the method isn’t overridden, all expression types are passed to the rendering methods.
- Parameters:
func (HighLevelILFunction) – HighLevelILFunction representing the high level function to be rendered
type (Type) – Type of the expression
- Returns:
True if the constant should be passed to the rendering methods, False otherwise
- Return type:
- render_constant(instr: HighLevelILInstruction, type: Type, val: int, tokens: HighLevelILTokenEmitter, settings: DisassemblySettings | None, precedence: OperatorPrecedence) bool[source]¶
Can be overridden to render a constant that is not a pointer. The expression type and value of the expression are given. If the expression is not handled by this constant renderer, this method should return False.
To render a constant, emit the tokens to the tokens object and return True.
- Parameters:
instr (HighLevelILInstruction) – High level expression
type (Type) – Type of the expression
val (int) – Value of the expression
tokens (HighLevelILTokenEmitter) – Token emitter for adding the rendered tokens
settings (DisassemblySettings | None) – Settings for rendering
precedence (OperatorPrecedence) – Operator precedence of the expression
- Returns:
True if the constant was rendered, False otherwise
- Return type:
- render_constant_pointer(instr: HighLevelILInstruction, type: Type, val: int, tokens: HighLevelILTokenEmitter, settings: DisassemblySettings | None, symbol_display: SymbolDisplayType, precedence: OperatorPrecedence) bool[source]¶
Can be overridden to render a constant pointer. The expression type and value of the expression are given. If the expression is not handled by this constant renderer, this method should return False.
To render a constant pointer, emit the tokens to the tokens object and return True.
- Parameters:
instr (HighLevelILInstruction) – High level expression
type (Type) – Type of the expression
val (int) – Value of the expression
tokens (HighLevelILTokenEmitter) – Token emitter for adding the rendered tokens
settings (DisassemblySettings | None) – Settings for rendering
symbol_display (SymbolDisplayType) – Type of symbol to display
precedence (OperatorPrecedence) – Operator precedence of the expression
- Returns:
True if the constant was rendered, False otherwise
- Return type: