From 6d5e5927b93954c579c027a2b7d3cd1885db95a7 Mon Sep 17 00:00:00 2001 From: Peter LaFosse Date: Mon, 11 Oct 2021 17:02:19 -0400 Subject: Allow get_functions_by_name to get functions which start with 'sub_' --- python/binaryview.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'python') diff --git a/python/binaryview.py b/python/binaryview.py index d13f7506..65a005b7 100644 --- a/python/binaryview.py +++ b/python/binaryview.py @@ -3550,8 +3550,8 @@ class BinaryView: :rtype: list(Function) :Example: - >>> bv.get_function_by_name("main") - + >>> bv.get_functions_by_name("main") + [] >>> """ if ordered_filter == []: @@ -3561,8 +3561,11 @@ class BinaryView: if plat == None: plat = self.platform fns = [] - for sym in self.get_symbols_by_name(name, ordered_filter=ordered_filter): - for fn in self.get_functions_at(sym.address): + addresses = [sym.address for sym in self.get_symbols_by_name(name, ordered_filter=ordered_filter)] + if len(addresses) == 0 and name.startswith("sub_"): + addresses = [int(name[4:], 16)] + for address in addresses: + for fn in self.get_functions_at(address): if fn.platform == plat: fns.append(fn) return fns -- cgit v1.3.1