summaryrefslogtreecommitdiff
path: root/src/base
diff options
context:
space:
mode:
authorGabe Black <gabeblack@google.com>2014-12-03 03:27:19 -0800
committerGabe Black <gabeblack@google.com>2014-12-03 03:27:19 -0800
commit2d9dae01fbfe04a12a8deff85ffb617d9d0b6638 (patch)
tree7998a866f2c591b0a41263a3d97bbea0e11d85c1 /src/base
parentb7dc4ba5161c8b18e5e5181bad724d571ab194c1 (diff)
downloadgem5-2d9dae01fbfe04a12a8deff85ffb617d9d0b6638.tar.xz
sim: Make it possible to override the breakpoint length check.
The check which makes sure the length of the breakpoint being written is the same as a MachInst is only correct on fixed instruction width ISAs. Instead of incorrectly applying that check to all ISAs, this change makes that the default check and lets ISA specific GDB classes override it.
Diffstat (limited to 'src/base')
-rw-r--r--src/base/remote_gdb.cc14
-rw-r--r--src/base/remote_gdb.hh2
2 files changed, 12 insertions, 4 deletions
diff --git a/src/base/remote_gdb.cc b/src/base/remote_gdb.cc
index ead8db9ae..42b94b5f9 100644
--- a/src/base/remote_gdb.cc
+++ b/src/base/remote_gdb.cc
@@ -520,6 +520,12 @@ PCEventQueue *BaseRemoteGDB::getPcEventQueue()
return &system->pcEventQueue;
}
+bool
+BaseRemoteGDB::checkBpLen(size_t len)
+{
+ return len == sizeof(MachInst);
+}
+
BaseRemoteGDB::HardBreakpoint::HardBreakpoint(BaseRemoteGDB *_gdb, Addr pc)
: PCEvent(_gdb->getPcEventQueue(), "HardBreakpoint Event", pc),
gdb(_gdb), refcount(0)
@@ -539,7 +545,7 @@ BaseRemoteGDB::HardBreakpoint::process(ThreadContext *tc)
bool
BaseRemoteGDB::insertSoftBreak(Addr addr, size_t len)
{
- if (len != sizeof(TheISA::MachInst))
+ if (!checkBpLen(len))
panic("invalid length\n");
return insertHardBreak(addr, len);
@@ -548,7 +554,7 @@ BaseRemoteGDB::insertSoftBreak(Addr addr, size_t len)
bool
BaseRemoteGDB::removeSoftBreak(Addr addr, size_t len)
{
- if (len != sizeof(MachInst))
+ if (!checkBpLen(len))
panic("invalid length\n");
return removeHardBreak(addr, len);
@@ -557,7 +563,7 @@ BaseRemoteGDB::removeSoftBreak(Addr addr, size_t len)
bool
BaseRemoteGDB::insertHardBreak(Addr addr, size_t len)
{
- if (len != sizeof(MachInst))
+ if (!checkBpLen(len))
panic("invalid length\n");
DPRINTF(GDBMisc, "inserting hardware breakpoint at %#x\n", addr);
@@ -574,7 +580,7 @@ BaseRemoteGDB::insertHardBreak(Addr addr, size_t len)
bool
BaseRemoteGDB::removeHardBreak(Addr addr, size_t len)
{
- if (len != sizeof(MachInst))
+ if (!checkBpLen(len))
panic("invalid length\n");
DPRINTF(GDBMisc, "removing hardware breakpoint at %#x\n", addr);
diff --git a/src/base/remote_gdb.hh b/src/base/remote_gdb.hh
index babf61049..8fab556f3 100644
--- a/src/base/remote_gdb.hh
+++ b/src/base/remote_gdb.hh
@@ -192,6 +192,8 @@ class BaseRemoteGDB
PCEventQueue *getPcEventQueue();
protected:
+ virtual bool checkBpLen(size_t len);
+
class HardBreakpoint : public PCEvent
{
private: