Skip to content

Commit 7de630a

Browse files
committed
Add debug print to hals when running --debug
Signed-off-by: Nathaniel Mitchell <nathaniel.p.mitchell@intel.com>
1 parent 599da38 commit 7de630a

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

chipsec/hal/hals.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@
3434
from chipsec.library.file import get_main_dir
3535
from chipsec.library.strings import make_hex_key_str
3636
from chipsec.library.exceptions import HALNotFoundError, HALInitializationError
37+
if logger().DEBUG:
38+
import traceback
3739
# Search subfolders for hals
3840

3941
class Hals:
@@ -69,6 +71,7 @@ def __getattr__(self, name):
6971
hal_class = getattr(best_hal['mod'], name)
7072
setattr(self, name, hal_class(self.cs))
7173
except Exception as err:
74+
logger().log_debug(traceback.format_exc())
7275
raise HALInitializationError(f'HAL with name {name} was not able to be initialized: {str(err)}')
7376
return super(Hals, self).__getattribute__(name)
7477

@@ -115,6 +118,7 @@ def update_available_hals(self) -> Dict[str, Any]:
115118
except ImportError as err:
116119
# Display the import error and continue to import commands
117120
logger().log_error(f"Exception occurred during import of {hal}: '{str(err)}'")
121+
logger().log_debug(traceback.format_exc())
118122
continue
119123
except AttributeError as err:
120124
logger().log_error(f"HAL {hal} has not been updated with 'haldata' attribute: '{str(err)}'")

0 commit comments

Comments
 (0)