diff options
author | Gary Benson <gbenson@redhat.com> | 2014-09-12 10:11:42 +0100 |
---|---|---|
committer | Gary Benson <gbenson@redhat.com> | 2014-09-12 10:11:42 +0100 |
commit | 361c8ade9c3c88cf7f0111fdab3ceb03028842bc (patch) | |
tree | 832206e22924d38311ff4b818ad119a2bd39dfd9 /gdb/gdbserver | |
parent | ac4eb736520174305bf6e691827f7473b858cff1 (diff) | |
download | gdb-361c8ade9c3c88cf7f0111fdab3ceb03028842bc.zip gdb-361c8ade9c3c88cf7f0111fdab3ceb03028842bc.tar.gz gdb-361c8ade9c3c88cf7f0111fdab3ceb03028842bc.tar.bz2 |
Introduce common-regcache.h
This introduces common-regcache.h. This contains two functions that
allow nat/linux-btrace.c to be simplified. A better long term
solution would be unify the regcache code, but this is sufficient for
now.
gdb/ChangeLog:
* common/common-regcache.h: New file.
* Makefile.in (HFILES_NO_SRCDIR): Add common/common-regcache.h.
* regcache.h: Include common-regcache.h.
(regcache_read_pc): Don't declare.
* regcache.c (get_thread_regcache_for_ptid): New function.
* nat/linux-btrace.c: Don't include regcache.h.
Include common-regcache.h.
(perf_event_read_bts): Use get_thread_regcache_for_ptid.
gdb/gdbserver/ChangeLog:
* regcache.h: Include common-regcache.h.
(regcache_read_pc): Don't declare.
* regcache.c (get_thread_regcache_for_ptid): New function.
Diffstat (limited to 'gdb/gdbserver')
-rw-r--r-- | gdb/gdbserver/ChangeLog | 7 | ||||
-rw-r--r-- | gdb/gdbserver/regcache.c | 8 | ||||
-rw-r--r-- | gdb/gdbserver/regcache.h | 4 |
3 files changed, 18 insertions, 1 deletions
diff --git a/gdb/gdbserver/ChangeLog b/gdb/gdbserver/ChangeLog index 0ea5a42..f88eb31 100644 --- a/gdb/gdbserver/ChangeLog +++ b/gdb/gdbserver/ChangeLog @@ -1,3 +1,10 @@ +2014-09-12 Tom Tromey <tromey@redhat.com> + Gary Benson <gbenson@redhat.com> + + * regcache.h: Include common-regcache.h. + (regcache_read_pc): Don't declare. + * regcache.c (get_thread_regcache_for_ptid): New function. + 2014-09-11 Tom Tromey <tromey@redhat.com> Gary Benson <gbenson@redhat.com> diff --git a/gdb/gdbserver/regcache.c b/gdb/gdbserver/regcache.c index fda2069..ad66ff7 100644 --- a/gdb/gdbserver/regcache.c +++ b/gdb/gdbserver/regcache.c @@ -60,6 +60,14 @@ get_thread_regcache (struct thread_info *thread, int fetch) return regcache; } +/* See common/common-regcache.h. */ + +struct regcache * +get_thread_regcache_for_ptid (ptid_t ptid) +{ + return get_thread_regcache (find_thread_ptid (ptid), 1); +} + void regcache_invalidate_thread (struct thread_info *thread) { diff --git a/gdb/gdbserver/regcache.h b/gdb/gdbserver/regcache.h index 891fead..bf2e51f 100644 --- a/gdb/gdbserver/regcache.h +++ b/gdb/gdbserver/regcache.h @@ -19,6 +19,8 @@ #ifndef REGCACHE_H #define REGCACHE_H +#include "common-regcache.h" + struct thread_info; struct target_desc; @@ -91,7 +93,7 @@ void registers_to_string (struct regcache *regcache, char *buf); void registers_from_string (struct regcache *regcache, char *buf); -CORE_ADDR regcache_read_pc (struct regcache *regcache); +/* For regcache_read_pc see common/common-regcache.h. */ void regcache_write_pc (struct regcache *regcache, CORE_ADDR pc); |