cpu: Fix segment fault when using debug flags Branch (#169)

This commit is contained in:
Jason Lowe-Power
2023-08-10 08:33:48 -07:00
committed by GitHub

View File

@@ -498,15 +498,25 @@ BPredUnit::squash(const InstSeqNum &squashed_sn,
hist_it->pushedRAS = false;
}
if (hist_it->usedRAS) {
std::string RASTarget;
DPRINTF(Branch,
"[tid:%i] [squash sn:%llu] Incorrectly predicted "
"return [sn:%llu] PC: %#x Restoring RAS\n", tid,
squashed_sn,
hist_it->seqNum, hist_it->pc);
if (hist_it->RASTarget) {
std::ostringstream os;
os << *hist_it->RASTarget.get();
RASTarget = os.str();
} else {
RASTarget = "no RAS";
}
DPRINTF(Branch,
"[tid:%i] [squash sn:%llu] Restoring top of RAS "
"to: %i, target: %s\n", tid, squashed_sn,
hist_it->RASIndex, *hist_it->RASTarget);
hist_it->RASIndex, RASTarget.c_str());
RAS[tid].restore(hist_it->RASIndex, hist_it->RASTarget.get());
hist_it->usedRAS = false;
}