From 95fd45832864d6121b53da5e6aea165b1bb9ebd2 Mon Sep 17 00:00:00 2001 From: Nathaniel Mitchell Date: Mon, 10 Feb 2025 15:51:14 -0800 Subject: [PATCH] Add debug print to hals when running --debug Signed-off-by: Nathaniel Mitchell --- chipsec/hal/hals.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/chipsec/hal/hals.py b/chipsec/hal/hals.py index 98be4a0e..9f337795 100644 --- a/chipsec/hal/hals.py +++ b/chipsec/hal/hals.py @@ -34,6 +34,8 @@ from chipsec.library.logger import logger from chipsec.library.file import get_main_dir from chipsec.library.strings import make_hex_key_str from chipsec.library.exceptions import HALNotFoundError, HALInitializationError +if logger().DEBUG: + import traceback # Search subfolders for hals class Hals: @@ -69,6 +71,7 @@ class Hals: hal_class = getattr(best_hal['mod'], name) setattr(self, name, hal_class(self.cs)) except Exception as err: + logger().log_debug(traceback.format_exc()) raise HALInitializationError(f'HAL with name {name} was not able to be initialized: {str(err)}') return super(Hals, self).__getattribute__(name) @@ -115,6 +118,7 @@ class Hals: except ImportError as err: # Display the import error and continue to import commands logger().log_error(f"Exception occurred during import of {hal}: '{str(err)}'") + logger().log_debug(traceback.format_exc()) continue except AttributeError as err: logger().log_error(f"HAL {hal} has not been updated with 'haldata' attribute: '{str(err)}'")