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.
This commit is contained in:
Steve Reinhardt 2012-08-06 16:57:11 -07:00
parent 73ef8bd168
commit f4b424cd53

View file

@ -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;
}