aboutsummaryrefslogtreecommitdiff
path: root/gdb/nat/linux-btrace.h
diff options
context:
space:
mode:
authorMarkus Metzger <markus.t.metzger@intel.com>2014-01-17 14:40:02 +0100
committerMarkus Metzger <markus.t.metzger@intel.com>2015-02-09 09:33:59 +0100
commitaadf7753fd4cc3d9eb1cd0c089fd7a483b58f59e (patch)
treec2ecfeb8490e4595b14c2a3ae89c6a094b51f3ab /gdb/nat/linux-btrace.h
parent043c35779713a14e0916a1b3e31e006cd1270ee4 (diff)
downloadgdb-aadf7753fd4cc3d9eb1cd0c089fd7a483b58f59e.zip
gdb-aadf7753fd4cc3d9eb1cd0c089fd7a483b58f59e.tar.gz
gdb-aadf7753fd4cc3d9eb1cd0c089fd7a483b58f59e.tar.bz2
btrace, linux: add perf event buffer abstraction
Collect perf event buffer related fields from btrace_target_info into a new struct perf_event_buffer. Update functions that operated on the buffer to take a struct perf_event_buffer pointer rather than a btrace_target_info pointer. 2015-02-09 Markus Metzger <markus.t.metzger@intel.com> * nat/linux-btrace.h (perf_event_buffer): New. (btrace_target_info) <buffer, size, data_head>: Replace with ... <bts>: ... this. * nat/linux-btrace.c (perf_event_header, perf_event_mmap_size) (perf_event_buffer_size, perf_event_buffer_begin) (perf_event_buffer_end, linux_btrace_has_changed): Removed. Updated users. (perf_event_new_data): New.
Diffstat (limited to 'gdb/nat/linux-btrace.h')
-rw-r--r--gdb/nat/linux-btrace.h34
1 files changed, 25 insertions, 9 deletions
diff --git a/gdb/nat/linux-btrace.h b/gdb/nat/linux-btrace.h
index 24e06e8..602a571 100644
--- a/gdb/nat/linux-btrace.h
+++ b/gdb/nat/linux-btrace.h
@@ -32,6 +32,24 @@
struct target_ops;
+#if HAVE_LINUX_PERF_EVENT_H
+/* A Linux perf event buffer. */
+struct perf_event_buffer
+{
+ /* The mapped memory. */
+ const uint8_t *mem;
+
+ /* The size of the mapped memory in bytes. */
+ unsigned long long size;
+
+ /* A pointer to the data_head field for this buffer. */
+ volatile unsigned long long *data_head;
+
+ /* The data_head value from the last read. */
+ unsigned long long last_head;
+};
+#endif /* HAVE_LINUX_PERF_EVENT_H */
+
/* Branch trace target information per thread. */
struct btrace_target_info
{
@@ -42,16 +60,14 @@ struct btrace_target_info
/* The ptid of this thread. */
ptid_t ptid;
- /* The mmap configuration mapping the branch trace perf_event buffer.
-
- file .. the file descriptor
- buffer .. the mmapped memory buffer
- size .. the buffer's size in pages without the configuration page
- data_head .. the data head from the last read */
+ /* The perf event file. */
int file;
- void *buffer;
- size_t size;
- unsigned long data_head;
+
+ /* The perf event configuration page. */
+ volatile struct perf_event_mmap_page *header;
+
+ /* The BTS perf event buffer. */
+ struct perf_event_buffer bts;
#endif /* HAVE_LINUX_PERF_EVENT_H */
/* The size of a pointer in bits for this thread.