summaryrefslogtreecommitdiff
path: root/src/sim/serialize.hh
diff options
context:
space:
mode:
authorDaniel R. Carvalho <odanrc@yahoo.com.br>2019-02-20 11:05:29 +0100
committerDaniel Carvalho <odanrc@yahoo.com.br>2019-03-12 14:20:50 +0000
commit4ec5b85a31ded2afdf784555a7c736e61c8b594a (patch)
tree4fcfb0de4ad484c306692c74e31ee071400c0d14 /src/sim/serialize.hh
parent509aa2179a1c7d403d69c6d766f0e93b14f7d37d (diff)
downloadgem5-4ec5b85a31ded2afdf784555a7c736e61c8b594a.tar.xz
sim: Add size to array unserialization error message
Add both acquired and expected size information to array unserialization error message. Change-Id: Ic0a493c5a7860066eb992e9e91e7a4746b197579 Signed-off-by: Daniel R. Carvalho <odanrc@yahoo.com.br> Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/16542 Reviewed-by: Jason Lowe-Power <jason@lowepower.com> Maintainer: Jason Lowe-Power <jason@lowepower.com>
Diffstat (limited to 'src/sim/serialize.hh')
-rw-r--r--src/sim/serialize.hh16
1 files changed, 12 insertions, 4 deletions
diff --git a/src/sim/serialize.hh b/src/sim/serialize.hh
index a45d1bbcd..3d9f93e2f 100644
--- a/src/sim/serialize.hh
+++ b/src/sim/serialize.hh
@@ -474,7 +474,15 @@ arrayParamOut(CheckpointOut &os, const std::string &name,
os << "\n";
}
-
+/**
+ * Extract values stored in the checkpoint, and assign them to the provided
+ * array container.
+ *
+ * @param cp The checkpoint to be parsed.
+ * @param name Name of the container.
+ * @param param The array container.
+ * @param size The expected number of entries to be extracted.
+ */
template <class T>
void
arrayParamIn(CheckpointIn &cp, const std::string &name,
@@ -496,9 +504,9 @@ arrayParamIn(CheckpointIn &cp, const std::string &name,
// Need this if we were doing a vector
// value.resize(tokens.size());
- if (tokens.size() != size) {
- fatal("Array size mismatch on %s:%s'\n", section, name);
- }
+ fatal_if(tokens.size() != size,
+ "Array size mismatch on %s:%s (Got %u, expected %u)'\n",
+ section, name, tokens.size(), size);
for (std::vector<std::string>::size_type i = 0; i < tokens.size(); i++) {
// need to parse into local variable to handle vector<bool>,