MCPcopy Create free account
hub / github.com/Vector35/binaryninja-api / add_function

Method add_function

python/debuginfo.py:495–533  ·  view source on GitHub ↗

Adds a function scoped under the current parser's name to the debug info

(self, new_func: DebugFunctionInfo)

Source from the content-addressed store, hash-verified

493 return NotImplemented
494
495 def add_function(self, new_func: DebugFunctionInfo) -> bool:
496 """Adds a function scoped under the current parser's name to the debug info"""
497 if not isinstance(new_func, DebugFunctionInfo):
498 return NotImplemented
499
500 func_info = core.BNDebugFunctionInfo()
501
502 if new_func.function_type is None:
503 func_info.type = None
504 elif isinstance(new_func.function_type, _types.Type):
505 func_info.type = new_func.function_type.handle
506 else:
507 return NotImplemented
508
509 if new_func.platform is None:
510 func_info.platform = None
511 elif isinstance(new_func.platform, _platform.Platform):
512 func_info.platform = new_func.platform.handle
513 else:
514 return NotImplemented
515
516 if new_func.components is None:
517 components = []
518 elif isinstance(new_func.components, list):
519 components = new_func.components
520 else:
521 return NotImplemented
522 component_list = (ctypes.c_char_p * len(components))()
523 for c in range(0, len(components)):
524 component_list[c] = str(components[c]).encode('charmap')
525 func_info.components = component_list
526 func_info.componentN = len(components)
527
528 func_info.shortName = new_func.short_name
529 func_info.fullName = new_func.full_name
530 func_info.rawName = new_func.raw_name
531 func_info.address = new_func.address
532
533 return core.BNAddDebugFunction(self.handle, func_info)
534
535 def add_data_variable(self, address: int, new_type: '_types.Type', name: Optional[str] = None, components: Optional[List[str]] = None) -> bool:
536 """Adds a data variable scoped under the current parser's name to the debug info. Optionally, you can provide a path of component names under which that data variable should appear in the symbols sidebar."""

Callers 6

initMethod · 0.45
cli_lift.pyFile · 0.45
initMethod · 0.45
try_parse_infoMethod · 0.45
commit_functionsMethod · 0.45
parse_id0_section_infoFunction · 0.45

Calls 1

encodeMethod · 0.80

Tested by

no test coverage detected