Kaustav Goswami has uploaded this change for review. (
https://gem5-review.googlesource.com/c/public/gem5/+/59109 )
Change subject: cpu: nullptr in a DPRINTF statement
......................................................................
cpu: nullptr in a DPRINTF statement
This change fixes the crashing of gem5 when `Branch` debug flag
is enabled. A DPRINTF statement had a nullptr. This change
prints `INVALID_TARGET` if the nullptr is encountered.
Signed-off-by: Kaustav Goswami <kggosw...@ucdavis.edu>
Change-Id: I40bd42c07de25a493a3dd1094a2fd8cc0ce0a79b
---
M src/cpu/pred/bpred_unit.cc
1 file changed, 25 insertions(+), 4 deletions(-)
diff --git a/src/cpu/pred/bpred_unit.cc b/src/cpu/pred/bpred_unit.cc
index 0940ae1..0277580 100644
--- a/src/cpu/pred/bpred_unit.cc
+++ b/src/cpu/pred/bpred_unit.cc
@@ -335,10 +335,17 @@
while (!pred_hist.empty() &&
pred_hist.front().seqNum > squashed_sn) {
if (pred_hist.front().usedRAS) {
- DPRINTF(Branch, "[tid:%i] [squash sn:%llu]"
- " Restoring top of RAS to: %i,"
- " target: %s\n", tid, squashed_sn,
- pred_hist.front().RASIndex,
*pred_hist.front().RASTarget);
+ if (pred_hist.front().RASTarget != nullptr)
+ DPRINTF(Branch, "[tid:%i] [squash sn:%llu]"
+ " Restoring top of RAS to: %i,"
+ " target: %s\n", tid, squashed_sn,
+ pred_hist.front().RASIndex,
+ *pred_hist.front().RASTarget);
+ else
+ DPRINTF(Branch, "[tid:%i] [squash sn:%llu]"
+ " Restoring top of RAS to: %i,"
+ " target: INVALID_TARGET\n", tid, squashed_sn,
+ pred_hist.front().RASIndex);
RAS[tid].restore(pred_hist.front().RASIndex,
pred_hist.front().RASTarget.get());
--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/59109
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: I40bd42c07de25a493a3dd1094a2fd8cc0ce0a79b
Gerrit-Change-Number: 59109
Gerrit-PatchSet: 1
Gerrit-Owner: Kaustav Goswami <kggosw...@ucdavis.edu>
Gerrit-MessageType: newchange
_______________________________________________
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