xref: /dflybsd-src/contrib/gdb-7/gdb/common/btrace-common.h (revision de8e141f24382815c10a4012d209bbbf7abf1112)
1*ef5ccd6cSJohn Marino /* Branch trace support for GDB, the GNU debugger.
2*ef5ccd6cSJohn Marino 
3*ef5ccd6cSJohn Marino    Copyright (C) 2013 Free Software Foundation, Inc.
4*ef5ccd6cSJohn Marino 
5*ef5ccd6cSJohn Marino    Contributed by Intel Corp. <markus.t.metzger@intel.com>.
6*ef5ccd6cSJohn Marino 
7*ef5ccd6cSJohn Marino    This file is part of GDB.
8*ef5ccd6cSJohn Marino 
9*ef5ccd6cSJohn Marino    This program is free software; you can redistribute it and/or modify
10*ef5ccd6cSJohn Marino    it under the terms of the GNU General Public License as published by
11*ef5ccd6cSJohn Marino    the Free Software Foundation; either version 3 of the License, or
12*ef5ccd6cSJohn Marino    (at your option) any later version.
13*ef5ccd6cSJohn Marino 
14*ef5ccd6cSJohn Marino    This program is distributed in the hope that it will be useful,
15*ef5ccd6cSJohn Marino    but WITHOUT ANY WARRANTY; without even the implied warranty of
16*ef5ccd6cSJohn Marino    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17*ef5ccd6cSJohn Marino    GNU General Public License for more details.
18*ef5ccd6cSJohn Marino 
19*ef5ccd6cSJohn Marino    You should have received a copy of the GNU General Public License
20*ef5ccd6cSJohn Marino    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
21*ef5ccd6cSJohn Marino 
22*ef5ccd6cSJohn Marino #ifndef BTRACE_COMMON_H
23*ef5ccd6cSJohn Marino #define BTRACE_COMMON_H
24*ef5ccd6cSJohn Marino 
25*ef5ccd6cSJohn Marino /* Branch tracing (btrace) is a per-thread control-flow execution trace of the
26*ef5ccd6cSJohn Marino    inferior.  For presentation purposes, the branch trace is represented as a
27*ef5ccd6cSJohn Marino    list of sequential control-flow blocks, one such list per thread.  */
28*ef5ccd6cSJohn Marino 
29*ef5ccd6cSJohn Marino #ifdef GDBSERVER
30*ef5ccd6cSJohn Marino #  include "server.h"
31*ef5ccd6cSJohn Marino #else
32*ef5ccd6cSJohn Marino #  include "defs.h"
33*ef5ccd6cSJohn Marino #endif
34*ef5ccd6cSJohn Marino 
35*ef5ccd6cSJohn Marino #include "vec.h"
36*ef5ccd6cSJohn Marino 
37*ef5ccd6cSJohn Marino /* A branch trace block.
38*ef5ccd6cSJohn Marino 
39*ef5ccd6cSJohn Marino    This represents a block of sequential control-flow.  Adjacent blocks will be
40*ef5ccd6cSJohn Marino    connected via calls, returns, or jumps.  The latter can be direct or
41*ef5ccd6cSJohn Marino    indirect, conditional or unconditional.  Branches can further be
42*ef5ccd6cSJohn Marino    asynchronous, e.g. interrupts.  */
43*ef5ccd6cSJohn Marino struct btrace_block
44*ef5ccd6cSJohn Marino {
45*ef5ccd6cSJohn Marino   /* The address of the first byte of the first instruction in the block.  */
46*ef5ccd6cSJohn Marino   CORE_ADDR begin;
47*ef5ccd6cSJohn Marino 
48*ef5ccd6cSJohn Marino   /* The address of the first byte of the last instruction in the block.  */
49*ef5ccd6cSJohn Marino   CORE_ADDR end;
50*ef5ccd6cSJohn Marino };
51*ef5ccd6cSJohn Marino 
52*ef5ccd6cSJohn Marino /* Branch trace is represented as a vector of branch trace blocks starting with
53*ef5ccd6cSJohn Marino    the most recent block.  */
54*ef5ccd6cSJohn Marino typedef struct btrace_block btrace_block_s;
55*ef5ccd6cSJohn Marino 
56*ef5ccd6cSJohn Marino /* Define functions operating on a vector of branch trace blocks.  */
57*ef5ccd6cSJohn Marino DEF_VEC_O (btrace_block_s);
58*ef5ccd6cSJohn Marino 
59*ef5ccd6cSJohn Marino /* Target specific branch trace information.  */
60*ef5ccd6cSJohn Marino struct btrace_target_info;
61*ef5ccd6cSJohn Marino 
62*ef5ccd6cSJohn Marino /* Enumeration of btrace read types.  */
63*ef5ccd6cSJohn Marino 
64*ef5ccd6cSJohn Marino enum btrace_read_type
65*ef5ccd6cSJohn Marino {
66*ef5ccd6cSJohn Marino   /* Send all available trace.  */
67*ef5ccd6cSJohn Marino   btrace_read_all,
68*ef5ccd6cSJohn Marino 
69*ef5ccd6cSJohn Marino   /* Send all available trace, if it changed.  */
70*ef5ccd6cSJohn Marino   btrace_read_new
71*ef5ccd6cSJohn Marino };
72*ef5ccd6cSJohn Marino 
73*ef5ccd6cSJohn Marino #endif /* BTRACE_COMMON_H */
74