Skip to content

Commit d5d4fd7

Browse files
bpotchikplafosse
authored andcommitted
Update define_auto_symbol_and_var_or_function API to pass confidence type.
1 parent b9c9048 commit d5d4fd7

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

python/binaryview.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6416,7 +6416,7 @@ def define_auto_symbol(self, sym: '_types.CoreSymbol') -> None:
64166416
core.BNDefineAutoSymbol(self.handle, sym.handle)
64176417

64186418
def define_auto_symbol_and_var_or_function(
6419-
self, sym: '_types.CoreSymbol', type: '_types.Type', plat: Optional['_platform.Platform'] = None
6419+
self, sym: '_types.CoreSymbol', type: Optional['_types.Type'] = None, plat: Optional['_platform.Platform'] = None, type_confidence: Optional[int] = 0
64206420
) -> Optional['_types.CoreSymbol']:
64216421
"""
64226422
``define_auto_symbol_and_var_or_function`` Defines an "Auto" symbol, and a Variable/Function alongside it.
@@ -6426,6 +6426,7 @@ def define_auto_symbol_and_var_or_function(
64266426
:param sym: Symbol to define
64276427
:param type: Type for the function/variable being defined (can be None)
64286428
:param plat: Platform (optional)
6429+
:param type_confidence: Optional confidence value for the type
64296430
:rtype: Optional[CoreSymbol]
64306431
"""
64316432
if plat is None:
@@ -6435,12 +6436,16 @@ def define_auto_symbol_and_var_or_function(
64356436
elif not isinstance(plat, _platform.Platform):
64366437
raise ValueError("Provided platform is not of type `Platform`")
64376438

6439+
tc = core.BNTypeWithConfidence()
6440+
tc.type = None
6441+
tc.confidence = 0
64386442
if isinstance(type, _types.Type):
6439-
type = type.handle
6443+
tc.type = type.handle
6444+
tc.confidence = type_confidence
64406445
elif type is not None:
64416446
raise ValueError("Provided type is not of type `binaryninja.Type`")
64426447

6443-
_sym = core.BNDefineAutoSymbolAndVariableOrFunction(self.handle, plat.handle, sym.handle, type)
6448+
_sym = core.BNDefineAutoSymbolAndVariableOrFunction(self.handle, plat.handle, sym.handle, tc)
64446449
if _sym is None:
64456450
return None
64466451
return _types.CoreSymbol(_sym)

0 commit comments

Comments
 (0)