From c0129d23a51728592c68770a448fb25fcbc069ea Mon Sep 17 00:00:00 2001 From: Hoa Nguyen Date: Mon, 29 Jun 2020 19:31:15 -0700 Subject: [PATCH] base: Improve error message occurs when base couldn't open a file Change-Id: Icaa571216f0eed4527a6aaddcf0c6814ad282c56 Signed-off-by: Hoa Nguyen Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/30794 Reviewed-by: Giacomo Travaglini Reviewed-by: Jason Lowe-Power Maintainer: Jason Lowe-Power Tested-by: kokoro --- src/base/output.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/base/output.cc b/src/base/output.cc index 47b8aa7f4..5703a379c 100644 --- a/src/base/output.cc +++ b/src/base/output.cc @@ -84,9 +84,11 @@ OutputFile::OutputFile(const OutputDirectory &dir, _mode(mode), _recreateable(recreateable), _fstream(static_cast(_stream)) { - _fstream->open(dir.resolve(_name).c_str(), _mode); + std::string resolved_path = dir.resolve(_name); - assert(_fstream->is_open()); + _fstream->open(resolved_path.c_str(), _mode); + + panic_if(!_fstream->is_open(), "Failed to open \"%s\"\n", resolved_path); } template -- 2.30.2