diff options
author | Gabe Black <gabeblack@google.com> | 2017-05-11 14:11:28 -0700 |
---|---|---|
committer | Gabe Black <gabeblack@google.com> | 2017-05-18 16:48:09 +0000 |
commit | 41ab3e6e7e9b5a5f4427949f9a981cdf2186c88a (patch) | |
tree | 1b02f07e240b6207c83a55cc297dc0ab599ac85a /src/arch/arm | |
parent | 9aadcc797263fc268fdd9f921ddffa473f56d78a (diff) | |
download | gem5-41ab3e6e7e9b5a5f4427949f9a981cdf2186c88a.tar.xz |
base: Refactor the GDB code.
The new version modularizes the implementation of the various commands,
gets rid of dynamic allocation of the register cache, fixes some small
style problems, and uses exceptions to simplify error handling internal to
the GDB stub.
Change-Id: Iff3548373ce4adfb99106a810f5713b769df89b2
Reviewed-on: https://gem5-review.googlesource.com/3280
Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com>
Reviewed-by: Boris Shingarov <shingarov@gmail.com>
Maintainer: Andreas Sandberg <andreas.sandberg@arm.com>
Diffstat (limited to 'src/arch/arm')
-rw-r--r-- | src/arch/arm/remote_gdb.cc | 6 | ||||
-rw-r--r-- | src/arch/arm/remote_gdb.hh | 15 |
2 files changed, 16 insertions, 5 deletions
diff --git a/src/arch/arm/remote_gdb.cc b/src/arch/arm/remote_gdb.cc index b0f6d8e5e..eefe62b42 100644 --- a/src/arch/arm/remote_gdb.cc +++ b/src/arch/arm/remote_gdb.cc @@ -165,7 +165,7 @@ using namespace std; using namespace ArmISA; RemoteGDB::RemoteGDB(System *_system, ThreadContext *tc) - : BaseRemoteGDB(_system, tc) + : BaseRemoteGDB(_system, tc), regCache32(this), regCache64(this) { } @@ -297,7 +297,7 @@ RemoteGDB::BaseGdbRegCache* RemoteGDB::gdbRegs() { if (inAArch64(context)) - return new AArch64GdbRegCache(this); + return ®Cache32; else - return new AArch32GdbRegCache(this); + return ®Cache64; } diff --git a/src/arch/arm/remote_gdb.hh b/src/arch/arm/remote_gdb.hh index 13ceac17f..acd6f32d2 100644 --- a/src/arch/arm/remote_gdb.hh +++ b/src/arch/arm/remote_gdb.hh @@ -79,7 +79,11 @@ class RemoteGDB : public BaseRemoteGDB size_t size() const { return sizeof(r); } void getRegs(ThreadContext*); void setRegs(ThreadContext*) const; - const std::string name() const { return gdb->name() + ".AArch32GdbRegCache"; } + const std::string + name() const + { + return gdb->name() + ".AArch32GdbRegCache"; + } }; class AArch64GdbRegCache : public BaseGdbRegCache @@ -98,9 +102,16 @@ class RemoteGDB : public BaseRemoteGDB size_t size() const { return sizeof(r); } void getRegs(ThreadContext*); void setRegs(ThreadContext*) const; - const std::string name() const { return gdb->name() + ".AArch64GdbRegCache"; } + const std::string + name() const + { + return gdb->name() + ".AArch64GdbRegCache"; + } }; + AArch32GdbRegCache regCache32; + AArch64GdbRegCache regCache64; + public: RemoteGDB(System *_system, ThreadContext *tc); BaseGdbRegCache *gdbRegs(); |