From 5ee2b21b91035ba37b345d6045ec93c33225e93c Mon Sep 17 00:00:00 2001 From: Peter LaFosse Date: Thu, 9 Feb 2017 12:02:47 -0500 Subject: Fix highlight API's to work with HighlightStandardColor properly --- python/basicblock.py | 4 ++++ python/function.py | 6 +++++- 2 files changed, 9 insertions(+), 1 deletion(-) (limited to 'python') diff --git a/python/basicblock.py b/python/basicblock.py index ae9889fc..02e6a2c5 100644 --- a/python/basicblock.py +++ b/python/basicblock.py @@ -215,6 +215,8 @@ class BasicBlock(object): """ if not isinstance(color, HighlightStandardColor) and not isinstance(color, highlight.HighlightColor): raise ValueError("Specified color is not one of HighlightStandardColor, highlight.HighlightColor") + if isinstance(color, HighlightStandardColor): + color = highlight.HighlightColor(color) core.BNSetAutoBasicBlockHighlight(self.handle, color._get_core_struct()) def set_user_highlight(self, color): @@ -229,4 +231,6 @@ class BasicBlock(object): """ if not isinstance(color, HighlightStandardColor) and not isinstance(color, highlight.HighlightColor): raise ValueError("Specified color is not one of HighlightStandardColor, highlight.HighlightColor") + if isinstance(color, HighlightStandardColor): + color = highlight.HighlightColor(color) core.BNSetUserBasicBlockHighlight(self.handle, color._get_core_struct()) diff --git a/python/function.py b/python/function.py index 7d03585c..9b00eec2 100644 --- a/python/function.py +++ b/python/function.py @@ -764,7 +764,9 @@ class Function(object): """ if arch is None: arch = self.arch - if not isinstance(color, highlight.HighlightColor): + if not isinstance(color, HighlightStandardColor) and not isinstance(color, highlight.HighlightColor): + raise ValueError("Specified color is not one of HighlightStandardColor, highlight.HighlightColor") + if isinstance(color, HighlightStandardColor): color = highlight.HighlightColor(color = color) core.BNSetAutoInstructionHighlight(self.handle, arch.handle, addr, color._get_core_struct()) @@ -784,6 +786,8 @@ class Function(object): arch = self.arch if not isinstance(color, HighlightStandardColor) and not isinstance(color, highlight.HighlightColor): raise ValueError("Specified color is not one of HighlightStandardColor, highlight.HighlightColor") + if isinstance(color, HighlightStandardColor): + color = highlight.HighlightColor(color) core.BNSetUserInstructionHighlight(self.handle, arch.handle, addr, color._get_core_struct()) -- cgit v1.3.1