]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blob - gdb/nat/linux-btrace.h
5faf535d4b456fdf58735e75659183c8fd4602e4
[thirdparty/binutils-gdb.git] / gdb / nat / linux-btrace.h
1 /* Linux-dependent part of branch trace support for GDB, and GDBserver.
2
3 Copyright (C) 2013-2014 Free Software Foundation, Inc.
4
5 Contributed by Intel Corp. <markus.t.metzger@intel.com>
6
7 This file is part of GDB.
8
9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 3 of the License, or
12 (at your option) any later version.
13
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
18
19 You should have received a copy of the GNU General Public License
20 along with this program. If not, see <http://www.gnu.org/licenses/>. */
21
22 #ifndef LINUX_BTRACE_H
23 #define LINUX_BTRACE_H
24
25 #include "btrace-common.h"
26 #include "vec.h"
27 #include "ptid.h"
28 #include <stdint.h>
29
30 #if HAVE_LINUX_PERF_EVENT_H
31 # include <linux/perf_event.h>
32 #endif
33
34 /* Branch trace target information per thread. */
35 struct btrace_target_info
36 {
37 #if HAVE_LINUX_PERF_EVENT_H
38 /* The Linux perf_event configuration for collecting the branch trace. */
39 struct perf_event_attr attr;
40
41 /* The ptid of this thread. */
42 ptid_t ptid;
43
44 /* The mmap configuration mapping the branch trace perf_event buffer.
45
46 file .. the file descriptor
47 buffer .. the mmapped memory buffer
48 size .. the buffer's size in pages without the configuration page
49 data_head .. the data head from the last read */
50 int file;
51 void *buffer;
52 size_t size;
53 unsigned long data_head;
54 #endif /* HAVE_LINUX_PERF_EVENT_H */
55
56 /* The size of a pointer in bits for this thread.
57 The information is used to identify kernel addresses in order to skip
58 records from/to kernel space. */
59 int ptr_bits;
60 };
61
62 /* See to_supports_btrace in target.h. */
63 extern int linux_supports_btrace (struct target_ops *);
64
65 /* See to_enable_btrace in target.h. */
66 extern struct btrace_target_info *linux_enable_btrace (ptid_t ptid);
67
68 /* See to_disable_btrace in target.h. */
69 extern enum btrace_error linux_disable_btrace (struct btrace_target_info *ti);
70
71 /* See to_read_btrace in target.h. */
72 extern enum btrace_error linux_read_btrace (VEC (btrace_block_s) **btrace,
73 struct btrace_target_info *btinfo,
74 enum btrace_read_type type);
75
76 #endif /* LINUX_BTRACE_H */