Gabe Black has submitted this change. ( https://gem5-review.googlesource.com/c/public/gem5/+/53363 )

Change subject: arch-sparc: Fix a bug in SparcNativeTrace::check.
......................................................................

arch-sparc: Fix a bug in SparcNativeTrace::check.

This method is responsible for comparing gem5's state against the state
of the real process. When checking the value of NPC, it accessed the
value of nnpc() by calling pc.nnpc(), but did not actually update regVal
with it, so the comparison was between the value from the real process
and npc().

It's mildly confusing that nnpc is compared against npc, and npc against
pc, but that's because of what the state looks like in the real process
when single stepping through it with ptrace.

You can actually see where this bug was introduced if you look at the
change which created the PCState types originally. There, you can see
how regVal was set using a method of the ThreadContext, but after that
change the value is only accessed and not actually used.

Change-Id: I0f0101db5f807640b8d25fef6448081d9cfa0213
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/53363
Reviewed-by: Daniel Carvalho <oda...@yahoo.com.br>
Reviewed-by: Boris Shingarov <shinga...@labware.com>
Maintainer: Gabe Black <gabe.bl...@gmail.com>
Tested-by: kokoro <noreply+kok...@google.com>
---
M src/arch/sparc/nativetrace.cc
1 file changed, 30 insertions(+), 1 deletion(-)

Approvals:
  Boris Shingarov: Looks good to me, approved
  Daniel Carvalho: Looks good to me, but someone else must approve
  Gabe Black: Looks good to me, approved
  kokoro: Regressions pass




diff --git a/src/arch/sparc/nativetrace.cc b/src/arch/sparc/nativetrace.cc
index ff2b8f1..f10d0ad 100644
--- a/src/arch/sparc/nativetrace.cc
+++ b/src/arch/sparc/nativetrace.cc
@@ -79,7 +79,7 @@
     // NPC
     read(&realRegVal, sizeof(realRegVal));
     realRegVal = betoh(realRegVal);
-    pc.nnpc();
+    regVal = pc.nnpc();
     checkReg("npc", regVal, realRegVal);

     // CCR

--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/53363
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: I0f0101db5f807640b8d25fef6448081d9cfa0213
Gerrit-Change-Number: 53363
Gerrit-PatchSet: 2
Gerrit-Owner: Gabe Black <gabe.bl...@gmail.com>
Gerrit-Reviewer: Boris Shingarov <shinga...@labware.com>
Gerrit-Reviewer: Daniel Carvalho <oda...@yahoo.com.br>
Gerrit-Reviewer: Gabe Black <gabe.bl...@gmail.com>
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