summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGabe Black <gblack@eecs.umich.edu>2006-11-08 15:31:52 -0500
committerGabe Black <gblack@eecs.umich.edu>2006-11-08 15:31:52 -0500
commit42c73c6a9215a46ec83e31e03aef9eddc281336f (patch)
treec3dbaa14406c7d16681bbf1838954436581b5d6c
parent63bbc8929d778c15f5c7479819226c19a42dc2b9 (diff)
downloadgem5-42c73c6a9215a46ec83e31e03aef9eddc281336f.tar.xz
Make a function to say how big gdbregs is in bytes vs. regs.
--HG-- extra : convert_revision : 10c50c2d45a8e510d71cccde520059363116da8a
-rw-r--r--src/arch/alpha/remote_gdb.cc4
-rw-r--r--src/base/remote_gdb.cc10
-rw-r--r--src/base/remote_gdb.hh1
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;