summaryrefslogtreecommitdiff
path: root/src/arch/mips/remote_gdb.hh
diff options
context:
space:
mode:
authorDeyuan Guo <guodeyuan@tsinghua.org.cn>2011-09-10 03:45:25 -0700
committerDeyuan Guo <guodeyuan@tsinghua.org.cn>2011-09-10 03:45:25 -0700
commitbb921b1459ef3ec55f9cea4ac8d203cd3c801cfd (patch)
tree8978bf2fc84bb36393c243d67751738ada856d70 /src/arch/mips/remote_gdb.hh
parent6a2b223112d60e4efe14fcf9863a14cde93df82e (diff)
downloadgem5-bb921b1459ef3ec55f9cea4ac8d203cd3c801cfd.tar.xz
MIPS: Implement gem5/src/arch/mips/remote_gdb.cc.
So a mips-cross-gdb can connect with gem5(MIPS_SE), and do some remote debugging. Testing: Build gem5 for MIPS_SE and make gem5 wait at beginning: modify "rgdb_wait = -1" to "rgdb_wait = 0" in src/sim/system.cc; scons build/MIPS_SE/gem5.opt CPU_MODELS=O3CPU ---- Build GDB-7.3 mips-cross: ./configure --target=mips-linux-gnu --prefix=xxx/gdb-7.3-install/ make make install ---- Run: ./build/MIPS_SE/gem5.opt configs/example/se.py --detailed --caches ./mips-linux-gnu-gdb xxx/gem5/tests/test-progs/hello/bin/mips/linux/hello (gdb) target remote :7000 (gdb) info registers (gdb) disassemble (gdb) si (gdb) break main (gdb) c (gdb) quit Testing done.
Diffstat (limited to 'src/arch/mips/remote_gdb.hh')
-rw-r--r--src/arch/mips/remote_gdb.hh63
1 files changed, 46 insertions, 17 deletions
diff --git a/src/arch/mips/remote_gdb.hh b/src/arch/mips/remote_gdb.hh
index 03486a596..18215ff8f 100644
--- a/src/arch/mips/remote_gdb.hh
+++ b/src/arch/mips/remote_gdb.hh
@@ -31,34 +31,63 @@
#ifndef __ARCH_MIPS_REMOTE_GDB_HH__
#define __ARCH_MIPS_REMOTE_GDB_HH__
+#include "arch/mips/registers.hh"
+#include "base/bitfield.hh"
#include "base/remote_gdb.hh"
+class System;
+class ThreadContext;
+class PhysicalMemory;
+
namespace MipsISA
{
+
+ // The number of special regs depends on gdb.
+ // Two 32-bit regs are packed into one 64-bit reg.
+ const int GdbIntArchRegs = NumIntArchRegs / 2;
+ const int GdbIntSpecialRegs = 6 / 2;
+ const int GdbFloatArchRegs = NumFloatArchRegs / 2;
+ const int GdbFloatSpecialRegs = 2 / 2;
+
+ const int GdbIntRegs = GdbIntArchRegs + GdbIntSpecialRegs;
+ const int GdbFloatRegs = GdbFloatArchRegs + GdbFloatSpecialRegs;
+ const int GdbNumRegs = GdbIntRegs + GdbFloatRegs;
+
class RemoteGDB : public BaseRemoteGDB
{
- public:
- //These needs to be written to suit MIPS
-
- RemoteGDB(System *system, ThreadContext *context)
- : BaseRemoteGDB(system, context, 1)
- {}
+ protected:
+ Addr notTakenBkpt;
+ Addr takenBkpt;
- bool acc(Addr, size_t)
- { panic("acc not implemented for MIPS!"); }
+ public:
+ RemoteGDB(System *_system, ThreadContext *tc);
- void getregs()
- { panic("getregs not implemented for MIPS!"); }
+ protected:
+ bool acc(Addr addr, size_t len);
- void setregs()
- { panic("setregs not implemented for MIPS!"); }
+ void getregs();
+ void setregs();
- void clearSingleStep()
- { panic("clearSingleStep not implemented for MIPS!"); }
+ void clearSingleStep();
+ void setSingleStep();
- void setSingleStep()
- { panic("setSingleStep not implemented for MIPS!"); }
+ private:
+ uint64_t
+ pack(uint32_t lo, uint32_t hi)
+ {
+ return static_cast<uint64_t>(hi) << 32 | lo;
+ }
+ uint32_t
+ unpackLo(uint64_t val)
+ {
+ return bits(val, 31, 0);
+ }
+ uint32_t
+ unpackHi(uint64_t val)
+ {
+ return bits(val, 63, 32);
+ }
};
}
-#endif /* __ARCH_ALPHA_REMOTE_GDB_H__ */
+#endif /* __ARCH_MIPS_REMOTE_GDB_H__ */