From f71450d26da63b63c90ed0b9eb7c4386a9498b64 Mon Sep 17 00:00:00 2001 From: Rajarshi Das Date: Tue, 14 Nov 2023 17:17:04 +0530 Subject: [PATCH] python,util: Fix magic number check in decode_inst_dep_trace.py (#560) The decode_inst_dep_trace.py opens the trace file in read mode, and subsequently reads the magic number from the trace file. Once the number is read, it is compared against the string 'gem5' without decoding it first. This causes the comparison to fail. The fix addresses this by calling the decode() routine on the output of the read() call. Please find the details in the associated issue #543 --- util/decode_inst_dep_trace.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/util/decode_inst_dep_trace.py b/util/decode_inst_dep_trace.py index dcb5a7077b..9cd50a6819 100755 --- a/util/decode_inst_dep_trace.py +++ b/util/decode_inst_dep_trace.py @@ -130,7 +130,7 @@ def main(): exit(-1) # Read the magic number in 4-byte Little Endian - magic_number = proto_in.read(4) + magic_number = proto_in.read(4).decode() if magic_number != "gem5": print("Unrecognized file")