From 20c20d87e6fdc88a913ae0c223e832fa41537af1 Mon Sep 17 00:00:00 2001 From: Juraj Oravec Date: Wed, 29 May 2024 00:35:19 +0200 Subject: [PATCH] Use DIE.tag if the DW_AT_name does not exist Signed-off-by: Juraj Oravec --- main.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/main.py b/main.py index 46c7dfb..70b9469 100644 --- a/main.py +++ b/main.py @@ -58,7 +58,16 @@ def load_children(parent_die): def safe_DIE_name(die, default=''): - return die.attributes['DW_AT_name'].value.decode('utf-8', errors='ignore') if 'DW_AT_name' in die.attributes else default + name = '' + + if 'DW_AT_name' in die.attributes: + name = die.attributes['DW_AT_name'].value.decode('utf-8', errors='ignore') + elif configuration['print_debug_info']: + name = die.tag + else: + name = default + + return name class Bear():