summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSteve Reinhardt <steve.reinhardt@amd.com>2012-08-06 16:57:11 -0700
committerSteve Reinhardt <steve.reinhardt@amd.com>2012-08-06 16:57:11 -0700
commitf4b424cd539eed26de18e81fd9d433cd6ae6295b (patch)
treea5aaa579d251e83613e13f3a53acd58aced6ab17 /src
parent73ef8bd168795855cd23e56dd6739dfa23a77eb8 (diff)
downloadgem5-f4b424cd539eed26de18e81fd9d433cd6ae6295b.tar.xz
SETranslatingPortProxy: fix bug in tryReadString()
Off-by-one loop termination meant that we were stuffing the terminating '\0' into the std::string value, which makes for difficult-to-debug string comparison failures.
Diffstat (limited to 'src')
-rw-r--r--src/mem/se_translating_port_proxy.cc7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/mem/se_translating_port_proxy.cc b/src/mem/se_translating_port_proxy.cc
index 72466655c..7857217f6 100644
--- a/src/mem/se_translating_port_proxy.cc
+++ b/src/mem/se_translating_port_proxy.cc
@@ -190,15 +190,18 @@ SETranslatingPortProxy::tryReadString(std::string &str, Addr addr) const
Addr vaddr = addr;
- do {
+ while (true) {
Addr paddr;
if (!pTable->translate(vaddr++, paddr))
return false;
PortProxy::readBlob(paddr, &c, 1);
+ if (c == '\0')
+ break;
+
str += c;
- } while (c);
+ }
return true;
}