diff --git a/clients/drcachesim/common/trace_entry.h b/clients/drcachesim/common/trace_entry.h index 41c0e9db65d..291c3911817 100644 --- a/clients/drcachesim/common/trace_entry.h +++ b/clients/drcachesim/common/trace_entry.h @@ -53,7 +53,7 @@ typedef uintptr_t addr_t; /**< The type of a memory address. */ -#define TRACE_ENTRY_VERSION 1 /**< The version of the trace format. */ +#define TRACE_ENTRY_VERSION 2 /**< The version of the trace format. */ /** The type of a trace entry in a #memref_t structure. */ // The type identifier for trace entries in the raw trace_entry_t passed to diff --git a/clients/drcachesim/reader/file_reader.h b/clients/drcachesim/reader/file_reader.h index a013d2a62e6..6089b1cbc44 100644 --- a/clients/drcachesim/reader/file_reader.h +++ b/clients/drcachesim/reader/file_reader.h @@ -163,10 +163,19 @@ template class file_reader_t : public reader_t { trace_entry_t header, next, pid = {}; for (index_ = 0; index_ < input_files_.size(); ++index_) { if (!read_next_thread_entry(index_, &header, &thread_eof_[index_]) || - header.type != TRACE_TYPE_HEADER || header.addr != TRACE_ENTRY_VERSION) { + header.type != TRACE_TYPE_HEADER) { ERRMSG("Invalid header for input file #%zu\n", index_); return false; } + // We can handle the older version 1 as well which simply omits the + // early marker with the arch tag. + if (header.addr > TRACE_ENTRY_VERSION) { + ERRMSG( + "Cannot handle version #%zu (expect version <= #%u) for input file " + "#%zu\n", + header.addr, TRACE_ENTRY_VERSION, index_); + return false; + } // Read the meta entries until we hit the pid. while (read_next_thread_entry(index_, &next, &thread_eof_[index_])) { if (next.type == TRACE_TYPE_PID) {