From: Hoa Nguyen Date: Tue, 30 Jun 2020 02:31:15 +0000 (-0700) Subject: base: Improve error message occurs when base couldn't open a file X-Git-Tag: v20.1.0.0~519 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=c0129d23a51728592c68770a448fb25fcbc069ea;p=gem5.git 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 --- 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