gdb/common/btrace-common.h - gdb

Global variables defined

Data types defined

Macros defined

Source code

  1. /* Branch trace support for GDB, the GNU debugger.

  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 BTRACE_COMMON_H
  16. #define BTRACE_COMMON_H

  17. /* Branch tracing (btrace) is a per-thread control-flow execution trace of the
  18.    inferior.  For presentation purposes, the branch trace is represented as a
  19.    list of sequential control-flow blocks, one such list per thread.  */

  20. #include "vec.h"

  21. /* A branch trace block.

  22.    This represents a block of sequential control-flow.  Adjacent blocks will be
  23.    connected via calls, returns, or jumps.  The latter can be direct or
  24.    indirect, conditional or unconditional.  Branches can further be
  25.    asynchronous, e.g. interrupts.  */
  26. struct btrace_block
  27. {
  28.   /* The address of the first byte of the first instruction in the block.
  29.      The address may be zero if we do not know the beginning of this block,
  30.      such as for the first block in a delta trace.  */
  31.   CORE_ADDR begin;

  32.   /* The address of the first byte of the last instruction in the block.  */
  33.   CORE_ADDR end;
  34. };

  35. /* Branch trace is represented as a vector of branch trace blocks starting with
  36.    the most recent block.  */
  37. typedef struct btrace_block btrace_block_s;

  38. /* Define functions operating on a vector of branch trace blocks.  */
  39. DEF_VEC_O (btrace_block_s);

  40. /* Target specific branch trace information.  */
  41. struct btrace_target_info;

  42. /* Enumeration of btrace read types.  */

  43. enum btrace_read_type
  44. {
  45.   /* Send all available trace.  */
  46.   BTRACE_READ_ALL,

  47.   /* Send all available trace, if it changed.  */
  48.   BTRACE_READ_NEW,

  49.   /* Send the trace since the last request.  This will fail if the trace
  50.      buffer overflowed.  */
  51.   BTRACE_READ_DELTA
  52. };

  53. /* Enumeration of btrace errors.  */

  54. enum btrace_error
  55. {
  56.   /* No error.  Everything is OK.  */
  57.   BTRACE_ERR_NONE,

  58.   /* An unknown error.  */
  59.   BTRACE_ERR_UNKNOWN,

  60.   /* Branch tracing is not supported on this system.  */
  61.   BTRACE_ERR_NOT_SUPPORTED,

  62.   /* The branch trace buffer overflowed; no delta read possible.  */
  63.   BTRACE_ERR_OVERFLOW
  64. };

  65. #endif /* BTRACE_COMMON_H */