summaryrefslogtreecommitdiff
path: root/src/arch/x86
diff options
context:
space:
mode:
authorGabe Black <gabeblack@google.com>2014-12-05 22:37:03 -0800
committerGabe Black <gabeblack@google.com>2014-12-05 22:37:03 -0800
commit4a8a0a07982b7896127d0cb723fde08b3825bb48 (patch)
tree32274c02ae9dca6d6ebad156e559c9afcc44cabb /src/arch/x86
parentfb07d43b1a4a903fb2e51b41685eb5814d9f9e11 (diff)
downloadgem5-4a8a0a07982b7896127d0cb723fde08b3825bb48.tar.xz
misc: Generalize GDB single stepping.
The new single stepping implementation for x86 doesn't rely on any ISA specific properties or functionality. This change pulls out the per ISA implementation of those functions and promotes the X86 implementation to the base class. One drawback of that implementation is that the CPU might stop on an instruction twice if it's affected by both breakpoints and single stepping. While that might be a little surprising, it's harmless and would only happen under somewhat unlikely circumstances.
Diffstat (limited to 'src/arch/x86')
-rw-r--r--src/arch/x86/remote_gdb.cc23
-rw-r--r--src/arch/x86/remote_gdb.hh17
2 files changed, 1 insertions, 39 deletions
diff --git a/src/arch/x86/remote_gdb.cc b/src/arch/x86/remote_gdb.cc
index b30bf5739..dd96037e0 100644
--- a/src/arch/x86/remote_gdb.cc
+++ b/src/arch/x86/remote_gdb.cc
@@ -61,7 +61,7 @@ using namespace std;
using namespace X86ISA;
RemoteGDB::RemoteGDB(System *_system, ThreadContext *c) :
- BaseRemoteGDB(_system, c, GDB_REG_BYTES), singleStepEvent(this)
+ BaseRemoteGDB(_system, c, GDB_REG_BYTES)
{}
bool
@@ -89,14 +89,6 @@ RemoteGDB::acc(Addr va, size_t len)
}
void
-RemoteGDB::SingleStepEvent::process()
-{
- if (!gdb->singleStepEvent.scheduled())
- gdb->scheduleInstCommitEvent(&gdb->singleStepEvent, 1);
- gdb->trap(SIGTRAP);
-}
-
-void
RemoteGDB::getregs()
{
HandyM5Reg m5reg = context->readMiscRegNoEffect(MISCREG_M5_REG);
@@ -231,16 +223,3 @@ RemoteGDB::setregs()
}
}
}
-
-void
-RemoteGDB::clearSingleStep()
-{
- descheduleInstCommitEvent(&singleStepEvent);
-}
-
-void
-RemoteGDB::setSingleStep()
-{
- if (!singleStepEvent.scheduled())
- scheduleInstCommitEvent(&singleStepEvent, 1);
-}
diff --git a/src/arch/x86/remote_gdb.hh b/src/arch/x86/remote_gdb.hh
index b654fc2f8..f09d1e012 100644
--- a/src/arch/x86/remote_gdb.hh
+++ b/src/arch/x86/remote_gdb.hh
@@ -116,26 +116,9 @@ class RemoteGDB : public BaseRemoteGDB
bool acc(Addr addr, size_t len);
protected:
- class SingleStepEvent : public Event
- {
- protected:
- RemoteGDB *gdb;
-
- public:
- SingleStepEvent(RemoteGDB *g) : gdb(g)
- {}
-
- void process();
- };
-
- SingleStepEvent singleStepEvent;
-
void getregs();
void setregs();
- void clearSingleStep();
- void setSingleStep();
-
bool checkBpLen(size_t len) { return len == 1; }
};