From 0c4a0974549a59d8e4a0dcb4dc74fa3f8f9ce6e9 Mon Sep 17 00:00:00 2001 From: Frederic Suter Date: Thu, 16 Mar 2017 21:09:33 +0100 Subject: [PATCH 1/1] Revert "further cleanups" This reverts commit 40e6c8a3a8d6a2711fa48453e99df411a8afa874. --- include/xbt/replay.hpp | 1 + src/xbt/xbt_replay.cpp | 14 +++++++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/include/xbt/replay.hpp b/include/xbt/replay.hpp index 04197c29f8..be41b1c99a 100644 --- a/include/xbt/replay.hpp +++ b/include/xbt/replay.hpp @@ -9,6 +9,7 @@ #ifndef XBT_REPLAY_HPP #define XBT_REPLAY_HPP +#include "xbt/dict.h" #ifdef __cplusplus #include #include diff --git a/src/xbt/xbt_replay.cpp b/src/xbt/xbt_replay.cpp index dcb97ce69d..856d50937b 100644 --- a/src/xbt/xbt_replay.cpp +++ b/src/xbt/xbt_replay.cpp @@ -4,11 +4,17 @@ /* This program is free software; you can redistribute it and/or modify it * under the terms of the license (GNU LGPL) which comes with this package. */ +#include "src/internal_config.h" #include "xbt/ex.hpp" #include "xbt/log.h" #include "xbt/replay.hpp" +#include "xbt/str.h" +#include "xbt/sysdep.h" #include +#include +#include +#include XBT_LOG_NEW_DEFAULT_SUBCATEGORY(replay,xbt,"Replay trace reader"); @@ -30,12 +36,17 @@ class ReplayReader { std::string line; public: + char* filename_; + int linenum = 0; + explicit ReplayReader(const char* filename) { + filename_ = xbt_strdup(filename); fs = new std::ifstream(filename, std::ifstream::in); } ~ReplayReader() { + free(filename_); delete fs; } bool get(ReplayAction* action); @@ -44,6 +55,7 @@ public: bool ReplayReader::get(ReplayAction* action) { read_and_trim_line(fs, &line); + linenum++; if (line.length() > 0 && line.find("#") == std::string::npos) { boost::split(*action, line, boost::is_any_of(" \t"), boost::token_compress_on); @@ -162,7 +174,7 @@ int replay_runner(int argc, char* argv[]) if (evt->at(0).compare(argv[0]) == 0) { simgrid::xbt::handle_action(evt); } else { - XBT_WARN("Ignore trace element ... not for me"); + XBT_WARN("%s:%d: Ignore trace element not for me", reader->filename_, reader->linenum); } evt->clear(); } -- 2.20.1