Skip to content

Commit

Permalink
src: only ouput unique funtions from debug info (#1385)
Browse files Browse the repository at this point in the history
Signed-off-by: David Korczynski <david@adalogics.com>
  • Loading branch information
DavidKorczynski authored Jan 24, 2024
1 parent e2d56b8 commit 0286c8f
Showing 1 changed file with 29 additions and 4 deletions.
33 changes: 29 additions & 4 deletions src/fuzz_introspector/analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ def load_data_files(self, parallelise=True, correlation_file=None):
def dump_debug_files(self):
all_files_in_debug_info = dict()
current_function = None
all_functions_in_debug = list()
all_functions_in_debug = dict()
all_global_variables = dict()
all_types = dict()

Expand Down Expand Up @@ -164,7 +164,20 @@ def dump_debug_files(self):
current_args = current_args[1:]
current_function['args'] = current_args
current_function['return_type'] = return_type
all_functions_in_debug.append(current_function)

try:
hashkey = current_function['source'][
'source_file'] + current_function[
'source']['source_line']
except KeyError:
hashkey = None

if hashkey is not None:
all_functions_in_debug[
hashkey] = current_function
else:
# Something went wrong, abandon.
current_function = None
read_functions = False

if types_identifier in line:
Expand Down Expand Up @@ -270,7 +283,19 @@ def dump_debug_files(self):
current_function['args'] = current_args
current_function[
'return_type'] = return_type
all_functions_in_debug.append(current_function)
try:
hashkey = current_function['source'][
'source_file'] + current_function[
'source']['source_line']
except KeyError:
hashkey = None

if hashkey is not None:
all_functions_in_debug[
hashkey] = current_function
else:
# Something went wrong, abandon.
current_function = None
current_function = dict()
function_name = line.split(" ")[-1]
current_function['name'] = function_name
Expand Down Expand Up @@ -318,7 +343,7 @@ def dump_debug_files(self):

report_dict = {
'all_files_in_project': list(all_files_in_debug_info.values()),
'all_functions_in_project': all_functions_in_debug,
'all_functions_in_project': list(all_functions_in_debug.values()),
'all_global_variables': list(all_global_variables.values()),
'all_types': list(all_types.values())
}
Expand Down

0 comments on commit 0286c8f

Please sign in to comment.