File tree Expand file tree Collapse file tree 2 files changed +13
-4
lines changed
Expand file tree Collapse file tree 2 files changed +13
-4
lines changed Original file line number Diff line number Diff line change @@ -1184,8 +1184,9 @@ def parse() -> argparse.Namespace:
11841184 report_patchcandidates .add_argument (
11851185 "--targets" ,
11861186 nargs = "*" ,
1187- default = [],
1188- help = "list of target library functions to include" )
1187+ default = ['all' ],
1188+ help = "list of target library functions to include. If not passed, all "
1189+ "library functions found will be included." )
11891190 report_patchcandidates .add_argument (
11901191 "--verbose" , "-v" ,
11911192 action = "store_true" ,
Original file line number Diff line number Diff line change 6666from chb .util .loggingutil import chklogger
6767
6868if TYPE_CHECKING :
69- from chb .api .CallTarget import StubTarget
69+ from chb .api .CallTarget import (
70+ StubTarget , CallTarget )
7071 from chb .api .FunctionStub import SOFunction
7172 from chb .app .AppAccess import AppAccess
7273 from chb .app .BasicBlock import BasicBlock
@@ -1172,14 +1173,21 @@ def find_spare_instruction(
11721173 n_calls : int = 0
11731174 libcalls = LibraryCallCallsites ()
11741175
1176+ include_all = xtargets == ['all' ]
1177+
1178+ def include_target (target : 'CallTarget' ) -> bool :
1179+ if include_all :
1180+ return True
1181+ return target .name in xtargets
1182+
11751183 for (faddr , blocks ) in app .call_instructions ().items ():
11761184 fn = app .function (faddr )
11771185
11781186 for (baddr , instrs ) in blocks .items ():
11791187 for instr in instrs :
11801188 n_calls += 1
11811189 calltgt = instr .call_target
1182- if calltgt .is_so_target and calltgt . name in xtargets :
1190+ if calltgt .is_so_target and include_target ( calltgt ) :
11831191 libcalls .add_library_callsite (faddr , baddr , instr )
11841192
11851193 print ("Number of calls: " + str (n_calls ))
You can’t perform that action at this time.
0 commit comments