MCPcopy Create free account
hub / github.com/CheckPointSW/Karta / initUtils

Function initUtils

src/config/utils.py:102–128  ·  view source on GitHub ↗

Prepare the utils global variables for a new script execution. Args: logger (logger): logger instance disas (disassembler): disassembler handler instance invoked_before (bool): True iff was invoked before, and is part of a repetitive invocation (False by default)

(logger, disas, invoked_before=False)

Source from the content-addressed store, hash-verified

100##########
101
102def initUtils(logger, disas, invoked_before=False):
103 """Prepare the utils global variables for a new script execution.
104
105 Args:
106 logger (logger): logger instance
107 disas (disassembler): disassembler handler instance
108 invoked_before (bool): True iff was invoked before, and is part of a repetitive invocation (False by default)
109 """
110 global global_logger, disas_layer, src_seen_consts, src_seen_strings, src_functions_list, src_functions_ctx, src_file_mappings
111 # same as the init list on the top of the file
112 src_seen_consts = []
113 src_seen_strings = []
114 src_functions_list = []
115 src_functions_ctx = []
116 src_file_mappings = {}
117 # don't forget the instruction ratio
118 resetRatio()
119 # don't forget the neighbour scoring
120 resetScoring()
121 # don't do this initialization after the first invocation
122 if not invoked_before:
123 # init the logger
124 global_logger = logger
125 # get our disassembler handler
126 disas_layer = disas
127 # register the log handler
128 global_logger.linkHandler(disas_layer.logHandler())
129
130##################
131## Config Files ##

Callers 6

mainFunction · 0.85
startMatchFunction · 0.85
pluginMainFunction · 0.85
pluginMainFunction · 0.85
mainFunction · 0.85

Calls 3

resetRatioFunction · 0.85
resetScoringFunction · 0.85
logHandlerMethod · 0.45

Tested by

no test coverage detected