gdb/nat/linux-btrace.h - gdb

Global variables defined

Data types defined

Macros defined

Source code

  1. /* Linux-dependent part of branch trace support for GDB, and GDBserver.

  2.    Copyright (C) 2013-2015 Free Software Foundation, Inc.

  3.    Contributed by Intel Corp. <markus.t.metzger@intel.com>

  4.    This file is part of GDB.

  5.    This program is free software; you can redistribute it and/or modify
  6.    it under the terms of the GNU General Public License as published by
  7.    the Free Software Foundation; either version 3 of the License, or
  8.    (at your option) any later version.

  9.    This program is distributed in the hope that it will be useful,
  10.    but WITHOUT ANY WARRANTY; without even the implied warranty of
  11.    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  12.    GNU General Public License for more details.

  13.    You should have received a copy of the GNU General Public License
  14.    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */

  15. #ifndef LINUX_BTRACE_H
  16. #define LINUX_BTRACE_H

  17. #include "btrace-common.h"
  18. #include "vec.h"
  19. #include <stdint.h>

  20. #if HAVE_LINUX_PERF_EVENT_H
  21. #  include <linux/perf_event.h>
  22. #endif

  23. struct target_ops;

  24. /* Branch trace target information per thread.  */
  25. struct btrace_target_info
  26. {
  27. #if HAVE_LINUX_PERF_EVENT_H
  28.   /* The Linux perf_event configuration for collecting the branch trace.  */
  29.   struct perf_event_attr attr;

  30.   /* The ptid of this thread.  */
  31.   ptid_t ptid;

  32.   /* The mmap configuration mapping the branch trace perf_event buffer.

  33.      file      .. the file descriptor
  34.      buffer    .. the mmapped memory buffer
  35.      size      .. the buffer's size in pages without the configuration page
  36.      data_head .. the data head from the last read  */
  37.   int file;
  38.   void *buffer;
  39.   size_t size;
  40.   unsigned long data_head;
  41. #endif /* HAVE_LINUX_PERF_EVENT_H */

  42.   /* The size of a pointer in bits for this thread.
  43.      The information is used to identify kernel addresses in order to skip
  44.      records from/to kernel space.  */
  45.   int ptr_bits;
  46. };

  47. /* See to_supports_btrace in target.h.  */
  48. extern int linux_supports_btrace (struct target_ops *);

  49. /* See to_enable_btrace in target.h.  */
  50. extern struct btrace_target_info *linux_enable_btrace (ptid_t ptid);

  51. /* See to_disable_btrace in target.h.  */
  52. extern enum btrace_error linux_disable_btrace (struct btrace_target_info *ti);

  53. /* See to_read_btrace in target.h.  */
  54. extern enum btrace_error linux_read_btrace (VEC (btrace_block_s) **btrace,
  55.                                             struct btrace_target_info *btinfo,
  56.                                             enum btrace_read_type type);

  57. #endif /* LINUX_BTRACE_H */