summaryrefslogtreecommitdiff
path: root/src/base
diff options
context:
space:
mode:
authorSean Wilson <spwilson2@wisc.edu>2017-06-27 13:07:51 -0500
committerSean Wilson <spwilson2@wisc.edu>2017-07-12 20:07:05 +0000
commit55f70760de9cf9d16905372d885b7925722721a8 (patch)
tree1c80dc85a693aa06172602866c5bd641caee6407 /src/base
parent1b7bf4ed75b55fdfc55d901775c837377268b661 (diff)
downloadgem5-55f70760de9cf9d16905372d885b7925722721a8.tar.xz
sim, gdb: Refactor some Event subclasses into lambdas
Change-Id: If3e4329204f27eda96b50ec6ac279ebc6ef23d99 Signed-off-by: Sean Wilson <spwilson2@wisc.edu> Reviewed-on: https://gem5-review.googlesource.com/3921 Reviewed-by: Jason Lowe-Power <jason@lowepower.com> Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com> Maintainer: Andreas Sandberg <andreas.sandberg@arm.com>
Diffstat (limited to 'src/base')
-rw-r--r--src/base/remote_gdb.cc16
-rw-r--r--src/base/remote_gdb.hh16
2 files changed, 10 insertions, 22 deletions
diff --git a/src/base/remote_gdb.cc b/src/base/remote_gdb.cc
index 3b436cced..6ed5957d7 100644
--- a/src/base/remote_gdb.cc
+++ b/src/base/remote_gdb.cc
@@ -289,17 +289,18 @@ BaseRemoteGDB::TrapEvent::process()
}
void
-BaseRemoteGDB::SingleStepEvent::process()
+BaseRemoteGDB::processSingleStepEvent()
{
- if (!gdb->singleStepEvent.scheduled())
- gdb->scheduleInstCommitEvent(&gdb->singleStepEvent, 1);
- gdb->trap(SIGTRAP);
+ if (!singleStepEvent.scheduled())
+ scheduleInstCommitEvent(&singleStepEvent, 1);
+ trap(SIGTRAP);
}
BaseRemoteGDB::BaseRemoteGDB(System *_system, ThreadContext *c) :
- inputEvent(NULL), trapEvent(this), listener(NULL),
- number(-1), fd(-1), active(false), attached(false), system(_system),
- context(c), singleStepEvent(this)
+ inputEvent(NULL), trapEvent(this), listener(NULL), number(-1),
+ fd(-1), active(false), attached(false), system(_system),
+ context(c),
+ singleStepEvent([this]{ processSingleStepEvent(); }, name())
{
}
@@ -1123,4 +1124,3 @@ BaseRemoteGDB::hex2i(const char **srcp)
*srcp = src;
return r;
}
-
diff --git a/src/base/remote_gdb.hh b/src/base/remote_gdb.hh
index b7de0ae54..121faaf2e 100644
--- a/src/base/remote_gdb.hh
+++ b/src/base/remote_gdb.hh
@@ -260,20 +260,8 @@ class BaseRemoteGDB
return trap(SIGTRAP);
}
- protected:
- class SingleStepEvent : public Event
- {
- protected:
- BaseRemoteGDB *gdb;
-
- public:
- SingleStepEvent(BaseRemoteGDB *g) : gdb(g)
- {}
-
- void process();
- };
-
- SingleStepEvent singleStepEvent;
+ void processSingleStepEvent();
+ EventFunctionWrapper singleStepEvent;
void clearSingleStep();
void setSingleStep();