1 /* Branch trace support for GDB, the GNU debugger.
2 
3    Copyright (C) 2013 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 BTRACE_COMMON_H
23 #define BTRACE_COMMON_H
24 
25 /* Branch tracing (btrace) is a per-thread control-flow execution trace of the
26    inferior.  For presentation purposes, the branch trace is represented as a
27    list of sequential control-flow blocks, one such list per thread.  */
28 
29 #ifdef GDBSERVER
30 #  include "server.h"
31 #else
32 #  include "defs.h"
33 #endif
34 
35 #include "vec.h"
36 
37 /* A branch trace block.
38 
39    This represents a block of sequential control-flow.  Adjacent blocks will be
40    connected via calls, returns, or jumps.  The latter can be direct or
41    indirect, conditional or unconditional.  Branches can further be
42    asynchronous, e.g. interrupts.  */
43 struct btrace_block
44 {
45   /* The address of the first byte of the first instruction in the block.  */
46   CORE_ADDR begin;
47 
48   /* The address of the first byte of the last instruction in the block.  */
49   CORE_ADDR end;
50 };
51 
52 /* Branch trace is represented as a vector of branch trace blocks starting with
53    the most recent block.  */
54 typedef struct btrace_block btrace_block_s;
55 
56 /* Define functions operating on a vector of branch trace blocks.  */
57 DEF_VEC_O (btrace_block_s);
58 
59 /* Target specific branch trace information.  */
60 struct btrace_target_info;
61 
62 /* Enumeration of btrace read types.  */
63 
64 enum btrace_read_type
65 {
66   /* Send all available trace.  */
67   btrace_read_all,
68 
69   /* Send all available trace, if it changed.  */
70   btrace_read_new
71 };
72 
73 #endif /* BTRACE_COMMON_H */
74