From 905382cc267cc1d0ee5e3c6e122819b869f46701 Mon Sep 17 00:00:00 2001 From: Brian Potchik Date: Sat, 24 Oct 2020 22:18:28 -0400 Subject: PossibleValueSet dialog pulls existing values and miscellaneous cleanup. --- python/binaryview.py | 2 ++ python/function.py | 22 +++++++++++----------- 2 files changed, 13 insertions(+), 11 deletions(-) (limited to 'python') diff --git a/python/binaryview.py b/python/binaryview.py index e7c39641..a53cbf35 100644 --- a/python/binaryview.py +++ b/python/binaryview.py @@ -4738,6 +4738,8 @@ class BinaryView(object): """ result = core.BNPossibleValueSet() errors = ctypes.c_char_p() + if value == None: + value = '' if not core.BNParsePossibleValueSet(self.handle, value, state, result, here, errors): if errors: error_str = errors.value.decode("utf-8") diff --git a/python/function.py b/python/function.py index b3695949..35cad9b9 100644 --- a/python/function.py +++ b/python/function.py @@ -267,7 +267,7 @@ class ValueRange(object): if not isinstance(other, self.__class__): return NotImplemented return self.start == other.start and self.end == other.end and self.step == other.step - + @property def start(self): """ """ @@ -458,7 +458,7 @@ class PossibleValueSet(object): result.valueSet = ctypes.cast(values, ctypes.POINTER(ctypes.c_longlong)) result.count = self.count return result - + @property def type(self): """ """ @@ -560,7 +560,7 @@ class PossibleValueSet(object): @classmethod def constant(self, value): - """ + """ Create a constant valued PossibleValueSet object. :param int value: Integer value of the constant @@ -573,7 +573,7 @@ class PossibleValueSet(object): @classmethod def constant_ptr(self, value): - """ + """ Create constant pointer valued PossibleValueSet object. :param int value: Integer value of the constant pointer @@ -586,7 +586,7 @@ class PossibleValueSet(object): @classmethod def stack_frame_offset(self, offset): - """ + """ Create a PossibleValueSet object for a stack frame offset. :param int value: Integer value of the offset @@ -605,7 +605,7 @@ class PossibleValueSet(object): :param list(ValueRange) ranges: List of ValueRanges :rtype: PossibleValueSet :Example: - + >>> v_1 = ValueRange(-5, -1, 1) >>> v_2 = ValueRange(7, 10, 1) >>> val = PossibleValueSet.signed_range_value([v_1, v_2]) @@ -653,7 +653,7 @@ class PossibleValueSet(object): result.count = len(values) return result - @classmethod + @classmethod def not_in_set_of_values(self, values): """ Create a PossibleValueSet object for a value NOT in a set of values. @@ -670,7 +670,7 @@ class PossibleValueSet(object): @classmethod def lookup_table_value(self, lookup_table, mapping): """ - Create a PossibleValueSet object for a value which is a member of a + Create a PossibleValueSet object for a value which is a member of a lookuptable. :param list(LookupTableEntry) lookup_table: List of table entries @@ -2669,7 +2669,7 @@ class Function(object): def set_user_var_value(self, var, def_addr, value): """ `set_user_var_value` allows the user to specify a PossibleValueSet value for an MLIL variable at its - definition site. + definition site. .. warning:: Setting the variable value, triggers a reanalysis of the function and allows the dataflow to compute and propagate values which depend on the current variable. This implies that branch conditions @@ -2732,7 +2732,7 @@ class Function(object): var_data = core.BNVariable() var_data.type = var.source_type - var_data.index = var.index + var_data.index = var.index var_data.storage = var.storage core.BNClearUserVariableValue(self.handle, var_data, def_site) @@ -3249,7 +3249,7 @@ class InstructionTextToken(object): ``class InstructionTextToken`` is used to tell the core about the various components in the disassembly views. The below table is provided for ducmentation purposes but the complete list of TokenTypes is available at: :class:`!enums.InstructionTextTokenType`. Note that types marked as `Not emitted by architectures` are not intended to be used by Architectures during lifting. Rather, they are added by the core during analysis or display. UI plugins, however, may make use of them as appropriate. - + Uses of tokens include plugins that parse the output of an architecture (though parsing IL is recommended), or additionally, applying color schemes appropriately. ========================== ============================================ -- cgit v1.3.1