Hoa Nguyen has submitted this change. ( https://gem5-review.googlesource.com/c/public/gem5/+/30794 )

Change subject: base: Improve error message occurs when base couldn't open a file
......................................................................

base: Improve error message occurs when base couldn't open a file

Change-Id: Icaa571216f0eed4527a6aaddcf0c6814ad282c56
Signed-off-by: Hoa Nguyen <hoangu...@ucdavis.edu>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/30794
Reviewed-by: Giacomo Travaglini <giacomo.travagl...@arm.com>
Reviewed-by: Jason Lowe-Power <power...@gmail.com>
Maintainer: Jason Lowe-Power <power...@gmail.com>
Tested-by: kokoro <noreply+kok...@google.com>
---
M src/base/output.cc
1 file changed, 4 insertions(+), 2 deletions(-)

Approvals:
  Jason Lowe-Power: Looks good to me, approved; Looks good to me, approved
  Giacomo Travaglini: Looks good to me, approved
  kokoro: Regressions pass



diff --git a/src/base/output.cc b/src/base/output.cc
index 47b8aa7..5703a37 100644
--- a/src/base/output.cc
+++ b/src/base/output.cc
@@ -84,9 +84,11 @@
     _mode(mode), _recreateable(recreateable),
     _fstream(static_cast<stream_type_t *>(_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<class StreamType>

--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/30794
To unsubscribe, or for help writing mail filters, visit https://gem5-review.googlesource.com/settings

Gerrit-Project: public/gem5
Gerrit-Branch: develop
Gerrit-Change-Id: Icaa571216f0eed4527a6aaddcf0c6814ad282c56
Gerrit-Change-Number: 30794
Gerrit-PatchSet: 2
Gerrit-Owner: Hoa Nguyen <hoangu...@ucdavis.edu>
Gerrit-Reviewer: Bobby R. Bruce <bbr...@ucdavis.edu>
Gerrit-Reviewer: Giacomo Travaglini <giacomo.travagl...@arm.com>
Gerrit-Reviewer: Hoa Nguyen <hoangu...@ucdavis.edu>
Gerrit-Reviewer: Jason Lowe-Power <power...@gmail.com>
Gerrit-Reviewer: Trivikram Reddy <tvre...@ucdavis.edu>
Gerrit-Reviewer: kokoro <noreply+kok...@google.com>
Gerrit-MessageType: merged
_______________________________________________
gem5-dev mailing list -- gem5-dev@gem5.org
To unsubscribe send an email to gem5-dev-le...@gem5.org
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s

Reply via email to