summaryrefslogtreecommitdiff
path: root/src/base
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 /src/base
parent63bbc8929d778c15f5c7479819226c19a42dc2b9 (diff)
downloadgem5-42c73c6a9215a46ec83e31e03aef9eddc281336f.tar.xz
Make a function to say how big gdbregs is in bytes vs. regs.
--HG-- extra : convert_revision : 10c50c2d45a8e510d71cccde520059363116da8a
Diffstat (limited to 'src/base')
-rw-r--r--src/base/remote_gdb.cc10
-rw-r--r--src/base/remote_gdb.hh1
2 files changed, 6 insertions, 5 deletions
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;