Skip to content

Commit 8d0095f

Browse files
nit
Signed-off-by: David Korczynski <[email protected]>
1 parent 4111b3a commit 8d0095f

File tree

1 file changed

+17
-4
lines changed

1 file changed

+17
-4
lines changed

src/fuzz_introspector/frontends/frontend_cpp.py

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -492,7 +492,7 @@ def _process_callsites(self, stmt: Node,
492492
# added = True
493493
callsites.append(
494494
(cls, stmt.byte_range[1], stmt.start_point.row + 1))
495-
#if not added:
495+
# if not added:
496496
# logger.debug('Trying a hacky match.')
497497
# # Hack to make sure we add in case our analysis of contructors was
498498
# # wrong. TODO(David) fix.
@@ -577,8 +577,10 @@ def dump_module_logic(self,
577577
# Process all project functions
578578
func_list = []
579579
for func in self.all_functions.values():
580+
logger.debug('Iterating %s', func.name)
581+
logger.debug('Extracing callsites')
580582
func.extract_callsites(self)
581-
583+
logger.debug('Done extracting callsites')
582584
func_dict: dict[str, Any] = {}
583585
func_dict['functionName'] = func.name
584586
func_dict['functionSourceFile'] = func.parent_source.source_file
@@ -598,7 +600,9 @@ def dump_module_logic(self,
598600
func_dict['returnType'] = func.return_type
599601
func_dict['BranchProfiles'] = []
600602
func_dict['Callsites'] = func.detailed_callsites
603+
logger.debug('Calculating function uses')
601604
func_dict['functionUses'] = self.calculate_function_uses(func.name)
605+
logger.debug('Getting function depth')
602606
func_dict['functionDepth'] = self.calculate_function_depth(func)
603607
func_dict['constantsTouched'] = []
604608
func_dict['BBCount'] = 0
@@ -609,6 +613,7 @@ def dump_module_logic(self,
609613
reached.add(cs_dst)
610614
func_dict['functionsReached'] = list(reached)
611615

616+
logger.debug('Done')
612617
func_list.append(func_dict)
613618

614619
if func_list:
@@ -650,10 +655,17 @@ def extract_calltree(self,
650655

651656
func_node = None
652657
if function:
653-
func_node = get_function_node(function, self.all_functions)
658+
if source_code:
659+
logger.debug('Using source code var to extract node')
660+
func_node = source_code.get_function_node(function)
661+
else:
662+
logger.debug('Extracting node using lookup table.')
663+
func_node = get_function_node(function, self.all_functions)
654664
if func_node:
665+
logger.debug('Found function node')
655666
func_name = func_node.name
656667
else:
668+
logger.debug('Found no function node')
657669
func_name = function
658670
else:
659671
return ''
@@ -673,13 +685,14 @@ def extract_calltree(self,
673685

674686
visited_functions.add(function)
675687
for cs, line in func_node.base_callsites:
688+
logger.debug('Callsites: %s', cs)
676689
line_to_print += self.extract_calltree(
677690
source_file=source_code.source_file,
678691
function=cs,
679692
visited_functions=visited_functions,
680693
depth=depth + 1,
681694
line_number=line)
682-
695+
logger.debug('Done')
683696
return line_to_print
684697

685698
def get_reachable_functions(self,

0 commit comments

Comments
 (0)