summaryrefslogtreecommitdiff
path: root/python/platform.py
diff options
context:
space:
mode:
authorRusty Wagner <rusty.wagner@gmail.com>2025-08-01 17:02:14 -0400
committerRusty Wagner <rusty.wagner@gmail.com>2025-08-01 20:56:33 -0400
commit15c635b873105eda2861430d062ea3f6bdfe9d9b (patch)
treef5b17f7aa1388660992e233b3711654aad0cfb0c /python/platform.py
parent24fef31b14b89198185e5edc39ab7e6a7ef2e9ba (diff)
Use log_error_for_exception in the Python API to pass tracebacks in the stack trace associated with log messages, instead of creating large mutli-line messages for every exception
Diffstat (limited to 'python/platform.py')
-rw-r--r--python/platform.py12
1 files changed, 6 insertions, 6 deletions
diff --git a/python/platform.py b/python/platform.py
index 29eb81b0..98f3109a 100644
--- a/python/platform.py
+++ b/python/platform.py
@@ -34,7 +34,7 @@ from . import typelibrary
from . import architecture
from . import typecontainer
from . import binaryview
-from .log import log_error
+from .log import log_error_for_exception
class _PlatformMetaClass(type):
@@ -160,7 +160,7 @@ class Platform(metaclass=_PlatformMetaClass):
view_obj = binaryview.BinaryView(handle=core.BNNewViewReference(view))
self.view_init(view)
except:
- log_error(traceback.format_exc())
+ log_error_for_exception("Unhandled Python exception in Platform._view_init")
def _get_global_regs(self, ctxt, count):
try:
@@ -173,7 +173,7 @@ class Platform(metaclass=_PlatformMetaClass):
self._pending_reg_lists[result.value] = (result, reg_buf)
return result.value
except:
- log_error(traceback.format_exc())
+ log_error_for_exception("Unhandled Python exception in Platform._get_global_regs")
count[0] = 0
return None
@@ -184,7 +184,7 @@ class Platform(metaclass=_PlatformMetaClass):
raise ValueError("freeing register list that wasn't allocated")
del self._pending_reg_lists[buf.value]
except:
- log_error(traceback.format_exc())
+ log_error_for_exception("Unhandled Python exception in Platform._free_register_list")
def _get_global_reg_type(self, ctxt, reg):
try:
@@ -195,7 +195,7 @@ class Platform(metaclass=_PlatformMetaClass):
return ctypes.cast(handle, ctypes.c_void_p).value
return None
except:
- log_error(traceback.format_exc())
+ log_error_for_exception("Unhandled Python exception in Platform._get_global_reg_type")
return None
def _get_address_size(self, ctxt):
@@ -289,7 +289,7 @@ class Platform(metaclass=_PlatformMetaClass):
raise ValueError("freeing source_file_values list that wasn't allocated")
del self._pending_parser_input_lists[buf.value]
except:
- log_error(traceback.format_exc())
+ log_error_for_exception("Unhandled Python exception in Platform._free_type_parser_input")
def adjust_type_parser_input(
self,