From 998200d507063b66e786ed04ad4efa402abf8bf5 Mon Sep 17 00:00:00 2001 From: Rodrigo Arias Date: Wed, 22 Nov 2023 10:37:15 +0100 Subject: [PATCH] Always check thread metadata The thread metadata file is mandatory for trace version 2, so the emulator should fail if the file is not there or has the wrong version. Old traces with version 1 are not supported. --- src/emu/system.c | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/src/emu/system.c b/src/emu/system.c index 05c480c..82e436b 100644 --- a/src/emu/system.c +++ b/src/emu/system.c @@ -50,20 +50,17 @@ create_thread(struct proc *proc, const char *tracedir, const char *relpath) return NULL; } - /* Old version 1 doesn't have thread metadata */ - if (proc->metadata_version > 1) { - /* Build metadata path */ - char mpath[PATH_MAX]; - if (snprintf(mpath, PATH_MAX, "%s/%s/thread.%d.json", - tracedir, proc->id, tid) >= PATH_MAX) { - err("path too long"); - return NULL; - } + /* Build metadata path */ + char mpath[PATH_MAX]; + if (snprintf(mpath, PATH_MAX, "%s/%s/thread.%d.json", + tracedir, proc->id, tid) >= PATH_MAX) { + err("path too long"); + return NULL; + } - if (metadata_load_thread(mpath, thread) != 0) { - err("cannot load metadata from %s", mpath); - return NULL; - } + if (metadata_load_thread(mpath, thread) != 0) { + err("cannot load metadata from %s", mpath); + return NULL; } if (proc_add_thread(proc, thread) != 0) {