``get_functions_by_name`` returns a list of :py:class:`~binaryninja.function.Function` objects function with a :py:class:`~binaryninja.types.Symbol` of ``name``. :param str name: name of the functions :param Platform plat: (optional) platform :param list(SymbolType) ordered_filter: (optiona
( self, name: str, plat: Optional['_platform.Platform'] = None, ordered_filter: Optional[List[SymbolType]] = None )
| 5098 | core.BNFreeFunctionList(funcs, count.value) |
| 5099 | |
| 5100 | def get_functions_by_name( |
| 5101 | self, name: str, plat: Optional['_platform.Platform'] = None, ordered_filter: Optional[List[SymbolType]] = None |
| 5102 | ) -> List['_function.Function']: |
| 5103 | """``get_functions_by_name`` returns a list of :py:class:`~binaryninja.function.Function` objects |
| 5104 | function with a :py:class:`~binaryninja.types.Symbol` of ``name``. |
| 5105 | |
| 5106 | :param str name: name of the functions |
| 5107 | :param Platform plat: (optional) platform |
| 5108 | :param list(SymbolType) ordered_filter: (optional) an ordered filter based on SymbolType |
| 5109 | :return: returns a list of :py:class:`~binaryninja.function.Function` objects or an empty list |
| 5110 | :rtype: list(Function) |
| 5111 | :Example: |
| 5112 | |
| 5113 | >>> bv.get_functions_by_name("main") |
| 5114 | [<func: x86_64@0x1587>] |
| 5115 | >>> |
| 5116 | """ |
| 5117 | if ordered_filter is None: |
| 5118 | ordered_filter = [ |
| 5119 | SymbolType.FunctionSymbol, SymbolType.ImportedFunctionSymbol, SymbolType.LibraryFunctionSymbol |
| 5120 | ] |
| 5121 | |
| 5122 | fns = [] |
| 5123 | addresses = list(dict.fromkeys(sym.address for sym in self.get_symbols_by_name(name, ordered_filter=ordered_filter))) |
| 5124 | if len(addresses) == 0 and name.startswith("sub_"): |
| 5125 | try: |
| 5126 | addresses = [int(name[4:], 16)] |
| 5127 | except: |
| 5128 | addresses = [] |
| 5129 | for address in addresses: |
| 5130 | for fn in self.get_functions_at(address): |
| 5131 | if fn.start == address: |
| 5132 | if plat is not None and fn.platform != plat: |
| 5133 | continue |
| 5134 | fns.append(fn) |
| 5135 | return fns |
| 5136 | |
| 5137 | def get_function_at(self, addr: int, plat: Optional['_platform.Platform'] = None) -> Optional['_function.Function']: |
| 5138 | """ |
nothing calls this directly
no test coverage detected