]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blob - sim/common/sim-arange.h
GDB copyright headers update after running GDB's copyright.py script.
[thirdparty/binutils-gdb.git] / sim / common / sim-arange.h
1 /* Address ranges.
2 Copyright (C) 1998-2016 Free Software Foundation, Inc.
3 Contributed by Cygnus Solutions.
4
5 This file is part of the GNU Simulators.
6
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 3 of the License, or
10 (at your option) any later version.
11
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with this program. If not, see <http://www.gnu.org/licenses/>. */
19
20 /* This file is meant to be included by sim-basics.h. */
21
22 #ifndef SIM_ARANGE_H
23 #define SIM_ARANGE_H
24
25 /* A list of address ranges. */
26
27 typedef struct _addr_subrange {
28 struct _addr_subrange *next;
29
30 /* Range of addresses to be traced is [start,end]. */
31 address_word start,end;
32 } ADDR_SUBRANGE;
33
34 /* For speed, searching is done on a tree. */
35
36 typedef struct _addr_range_tree {
37 struct _addr_range_tree *lower;
38 struct _addr_range_tree *higher;
39
40 /* Range of addresses to be traced is [start,end]. */
41 address_word start,end;
42 } ADDR_RANGE_TREE;
43
44 /* The top level struct. */
45
46 typedef struct _addr_range {
47 ADDR_SUBRANGE *ranges;
48 #define ADDR_RANGE_RANGES(ar) ((ar)->ranges)
49 ADDR_RANGE_TREE *range_tree;
50 #define ADDR_RANGE_TREE(ar) ((ar)->range_tree)
51 } ADDR_RANGE;
52
53 /* Add address range START,END to AR. */
54 extern void sim_addr_range_add (ADDR_RANGE * /*ar*/,
55 address_word /*start*/,
56 address_word /*end*/);
57
58 /* Delete address range START,END from AR. */
59 extern void sim_addr_range_delete (ADDR_RANGE * /*ar*/,
60 address_word /*start*/,
61 address_word /*end*/);
62
63 /* TODO: This should get moved into sim-inline.h. */
64 #ifdef HAVE_INLINE
65 #ifdef SIM_ARANGE_C
66 #define SIM_ARANGE_INLINE INLINE
67 #else
68 #define SIM_ARANGE_INLINE EXTERN_INLINE
69 #endif
70 #else
71 #define SIM_ARANGE_INLINE EXTERN
72 #endif
73
74 /* Return non-zero if ADDR is in range AR, traversing the entire tree.
75 If no range is specified, that is defined to mean "everything". */
76 SIM_ARANGE_INLINE int
77 sim_addr_range_hit_p (ADDR_RANGE * /*ar*/, address_word /*addr*/);
78 #define ADDR_RANGE_HIT_P(ar, addr) \
79 ((ar)->range_tree == NULL || sim_addr_range_hit_p ((ar), (addr)))
80
81 #ifdef HAVE_INLINE
82 #include "sim-arange.c"
83 #endif
84 #define SIM_ARANGE_C_INCLUDED
85
86 #endif /* SIM_ARANGE_H */