diff options
-rw-r--r-- | src/arch/alpha/remote_gdb.cc | 4 | ||||
-rw-r--r-- | src/base/remote_gdb.cc | 10 | ||||
-rw-r--r-- | src/base/remote_gdb.hh | 1 |
3 files changed, 8 insertions, 7 deletions
diff --git a/src/arch/alpha/remote_gdb.cc b/src/arch/alpha/remote_gdb.cc index 829e41ca8..f23fc3205 100644 --- a/src/arch/alpha/remote_gdb.cc +++ b/src/arch/alpha/remote_gdb.cc @@ -141,7 +141,7 @@ using namespace TheISA; RemoteGDB::RemoteGDB(System *_system, ThreadContext *c) : BaseRemoteGDB(_system, c, KGDB_NUMREGS) { - memset(gdbregs.regs, 0, gdbregs.size); + memset(gdbregs.regs, 0, gdbregs.bytes()); } /////////////////////////////////////////////////////////// @@ -201,7 +201,7 @@ RemoteGDB::acc(Addr va, size_t len) void RemoteGDB::getregs() { - memset(gdbregs.regs, 0, gdbregs.size); + memset(gdbregs.regs, 0, gdbregs.bytes()); gdbregs.regs[KGDB_REG_PC] = context->readPC(); diff --git a/src/base/remote_gdb.cc b/src/base/remote_gdb.cc index fae814904..55fb97ce9 100644 --- a/src/base/remote_gdb.cc +++ b/src/base/remote_gdb.cc @@ -247,7 +247,7 @@ BaseRemoteGDB::BaseRemoteGDB(System *_system, ThreadContext *c, size_t cacheSize system(_system), pmem(_system->physmem), context(c), gdbregs(cacheSize) { - memset(gdbregs.regs, 0, gdbregs.size); + memset(gdbregs.regs, 0, gdbregs.bytes()); } BaseRemoteGDB::~BaseRemoteGDB() @@ -610,7 +610,7 @@ BaseRemoteGDB::trap(int type) uint64_t val; size_t datalen, len; char data[GDBPacketBufLen + 1]; - char buffer[gdbregs.size * 2 + 256]; + char buffer[gdbregs.bytes() * 2 + 256]; const char *p; char command, subcmd; string var; @@ -662,15 +662,15 @@ BaseRemoteGDB::trap(int type) continue; case GDBRegR: - if (2 * gdbregs.size > sizeof(buffer)) + if (2 * gdbregs.bytes() > sizeof(buffer)) panic("buffer too small"); - mem2hex(buffer, gdbregs.regs, gdbregs.size); + mem2hex(buffer, gdbregs.regs, gdbregs.bytes()); send(buffer); continue; case GDBRegW: - p = hex2mem(gdbregs.regs, p, gdbregs.size); + p = hex2mem(gdbregs.regs, p, gdbregs.bytes()); if (p == NULL || *p != '\0') send("E01"); else { diff --git a/src/base/remote_gdb.hh b/src/base/remote_gdb.hh index 4a1754afd..9a3201c95 100644 --- a/src/base/remote_gdb.hh +++ b/src/base/remote_gdb.hh @@ -145,6 +145,7 @@ class BaseRemoteGDB uint64_t * regs; size_t size; + size_t bytes() { return size * sizeof(uint64_t); } }; GdbRegCache gdbregs; |