summaryrefslogtreecommitdiff
path: root/gdb/nat/linux-btrace.c
diff options
context:
space:
mode:
authorGary Benson <gbenson@redhat.com>2014-09-12 10:11:42 +0100
committerGary Benson <gbenson@redhat.com>2014-09-12 10:11:42 +0100
commit361c8ade9c3c88cf7f0111fdab3ceb03028842bc (patch)
tree832206e22924d38311ff4b818ad119a2bd39dfd9 /gdb/nat/linux-btrace.c
parentac4eb736520174305bf6e691827f7473b858cff1 (diff)
downloadbinutils-gdb-361c8ade9c3c88cf7f0111fdab3ceb03028842bc.tar.gz
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/nat/linux-btrace.c')
-rw-r--r--gdb/nat/linux-btrace.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/gdb/nat/linux-btrace.c b/gdb/nat/linux-btrace.c
index e0106fa647c..385ca4e0334 100644
--- a/gdb/nat/linux-btrace.c
+++ b/gdb/nat/linux-btrace.c
@@ -26,7 +26,7 @@
#endif
#include "linux-btrace.h"
-#include "regcache.h"
+#include "common-regcache.h"
#include "gdbthread.h"
#include "gdb_wait.h"
#include "x86-cpuid.h"
@@ -180,11 +180,7 @@ perf_event_read_bts (struct btrace_target_info* tinfo, const uint8_t *begin,
gdb_assert (start <= end);
/* The first block ends at the current pc. */
-#ifdef GDBSERVER
- regcache = get_thread_regcache (find_thread_ptid (tinfo->ptid), 1);
-#else
- regcache = get_thread_regcache (tinfo->ptid);
-#endif
+ regcache = get_thread_regcache_for_ptid (tinfo->ptid);
block.end = regcache_read_pc (regcache);
/* The buffer may contain a partial record as its last entry (i.e. when the