diff --git a/controller.py b/controller.py index 5ab3dd9..41b980f 100755 --- a/controller.py +++ b/controller.py @@ -357,6 +357,7 @@ def read_backup(hdf5_file): "tb_info": bool(hdf5_flags["tb_info"][0]), "mem_info": bool(hdf5_flags["mem_info"][0]), "max_instruction_count": int(hdf5_flags["max_instruction_count"][0]), + "fault_count": int(hdf5_flags["fault_count"][0]), "start": { "address": int(hdf5_start_address["address"][0]), "counter": int(hdf5_start_address["counter"][0]), @@ -436,7 +437,7 @@ def read_backup(hdf5_file): rows = f_in.root.Goldenrun.armregisters.iterrows() else: raise tables.NoSuchNodeError( - "No supported register architecture could be found in the HDF5 file" + "No supported register architecture could be found in the HDF5 file, run with the overwrite flag to overwrite" ) backup_goldenrun[register_backup_name] = [] @@ -455,6 +456,14 @@ def read_backup(hdf5_file): backup_goldenrun[register_backup_name].append(registers) # Process expanded faults + if ( + f_in.root.Backup.expanded_faults._v_nchildren + != backup_config["fault_count"] + ): + raise tables.NoSuchNodeError( + f"Out of {backup_config['fault_count']} faults, only {f_in.root.Backup.expanded_faults._v_nchildren} are available in the backup. Run with the overwrite flag to overwrite" + ) + backup_expanded_faults = [] exp_n = 0 @@ -597,10 +606,8 @@ def controller( "Backup could not be found in the HDF5 file, run with the overwrite flag to overwrite!" ) return config_qemu - except tables.NoSuchNodeError: - clogger.warning( - "Invalid/unsupported backup file, run with the overwrite flag to overwrite!" - ) + except tables.NoSuchNodeError as e: + clogger.warning(e) return config_qemu clogger.info("Checking the backup") diff --git a/hdf5logger.py b/hdf5logger.py index 3f9fd34..8b57428 100644 --- a/hdf5logger.py +++ b/hdf5logger.py @@ -141,6 +141,7 @@ class config_table(tables.IsDescription): mem_info = tables.BoolCol() max_instruction_count = tables.UInt64Col() memory_dump = tables.BoolCol() + fault_count = tables.UInt64Col() class hash_table(tables.IsDescription): @@ -396,6 +397,7 @@ def process_config(f, configgroup, exp, myfilter): config_row["tb_info"] = exp["tb_info"] config_row["mem_info"] = exp["mem_info"] config_row["max_instruction_count"] = exp["max_instruction_count"] + config_row["fault_count"] = exp["fault_count"] config_row.append() @@ -441,6 +443,8 @@ def process_config(f, configgroup, exp, myfilter): def process_backup(f, configgroup, exp, myfilter, stop_signal): + exp["config"]["fault_count"] = len(exp["expanded_faultlist"]) + process_config(f, configgroup, exp["config"], myfilter) fault_expanded_group = f.create_group(