Skip to content

Commit

Permalink
i#4318 xarch memtrace: Bump version and add message for arch tags (#4342
Browse files Browse the repository at this point in the history
)

PR #4331 commit 5d49675 added a new marker with the architecture
early in a trace, enough to break the file_reader_t assumptions.  The
file reader was updated, but it's best to also bump the version for
old binary code.  Additionally, we provide a separate distinct message
about a version mismatch (otherwise the error message from the old
reader is the same as without the version bump).

Issue: #4318
  • Loading branch information
derekbruening committed Jun 30, 2020
1 parent 047a25f commit 5fa9fae
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
2 changes: 1 addition & 1 deletion clients/drcachesim/common/trace_entry.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
11 changes: 10 additions & 1 deletion clients/drcachesim/reader/file_reader.h
Original file line number Diff line number Diff line change
Expand Up @@ -163,10 +163,19 @@ template <typename T> 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) {
Expand Down

0 comments on commit 5fa9fae

Please sign in to comment.