Make a function to say how big gdbregs is in bytes vs. regs.
authorGabe Black <gblack@eecs.umich.edu>
Wed, 8 Nov 2006 20:31:52 +0000 (15:31 -0500)
committerGabe Black <gblack@eecs.umich.edu>
Wed, 8 Nov 2006 20:31:52 +0000 (15:31 -0500)
--HG--
extra : convert_revision : 10c50c2d45a8e510d71cccde520059363116da8a

src/arch/alpha/remote_gdb.cc
src/base/remote_gdb.cc
src/base/remote_gdb.hh

index 829e41ca8f14ce258e4025edcc2a5e0963270f26..f23fc32054915b54f89b099b68b848321db04886 100644 (file)
@@ -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();
 
index fae814904322a68f577d2442b57228d6eab202ae..55fb97ce92974c8a62b5075b08f9f668b6e9b7c3 100644 (file)
@@ -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 {
index 4a1754afd0f9030d6ba3d762ef4b64d44cccc35b..9a3201c955472192d340cfdd6f2f87bcddd0e912 100644 (file)
@@ -145,6 +145,7 @@ class BaseRemoteGDB
 
         uint64_t * regs;
         size_t size;
+        size_t bytes() { return size * sizeof(uint64_t); }
     };
 
     GdbRegCache gdbregs;