From 4a8a0a07982b7896127d0cb723fde08b3825bb48 Mon Sep 17 00:00:00 2001 From: Gabe Black Date: Fri, 5 Dec 2014 22:37:03 -0800 Subject: 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. --- src/arch/x86/remote_gdb.cc | 23 +---------------------- src/arch/x86/remote_gdb.hh | 17 ----------------- 2 files changed, 1 insertion(+), 39 deletions(-) (limited to 'src/arch/x86') 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 @@ -88,14 +88,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() { @@ -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; } }; -- cgit v1.2.3