]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blob - sim/common/sim-arange.h
This commit was generated by cvs2svn to track changes on a CVS vendor
[thirdparty/binutils-gdb.git] / sim / common / sim-arange.h
1 /* Address ranges.
2 Copyright (C) 1998 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 2, or (at your option)
10 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 along
18 with this program; if not, write to the Free Software Foundation, Inc.,
19 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
20
21 /* This file is meant to be included by sim-basics.h. */
22
23 #ifndef SIM_ARANGE_H
24 #define SIM_ARANGE_H
25
26 /* A list of address ranges. */
27
28 typedef struct _addr_subrange {
29 struct _addr_subrange *next;
30
31 /* Range of addresses to be traced is [start,end]. */
32 address_word start,end;
33 } ADDR_SUBRANGE;
34
35 /* For speed, searching is done on a tree. */
36
37 typedef struct _addr_range_tree {
38 struct _addr_range_tree *lower;
39 struct _addr_range_tree *higher;
40
41 /* Range of addresses to be traced is [start,end]. */
42 address_word start,end;
43 } ADDR_RANGE_TREE;
44
45 /* The top level struct. */
46
47 typedef struct _addr_range {
48 ADDR_SUBRANGE *ranges;
49 #define ADDR_RANGE_RANGES(ar) ((ar)->ranges)
50 ADDR_RANGE_TREE *range_tree;
51 #define ADDR_RANGE_TREE(ar) ((ar)->range_tree)
52 } ADDR_RANGE;
53
54 /* Add address range START,END to AR. */
55 extern void sim_addr_range_add (ADDR_RANGE * /*ar*/,
56 address_word /*start*/,
57 address_word /*end*/);
58
59 /* Delete address range START,END from AR. */
60 extern void sim_addr_range_delete (ADDR_RANGE * /*ar*/,
61 address_word /*start*/,
62 address_word /*end*/);
63
64 /* Return non-zero if ADDR is in range AR, traversing the entire tree.
65 If no range is specified, that is defined to mean "everything". */
66 extern INLINE int
67 sim_addr_range_hit_p (ADDR_RANGE * /*ar*/, address_word /*addr*/);
68 #define ADDR_RANGE_HIT_P(ar, addr) \
69 ((ar)->range_tree == NULL || sim_addr_range_hit_p ((ar), (addr)))
70
71 #ifdef HAVE_INLINE
72 #ifdef SIM_ARANGE_C
73 #define SIM_ARANGE_INLINE INLINE
74 #else
75 #define SIM_ARANGE_INLINE EXTERN_INLINE
76 #endif
77 #include "sim-arange.c"
78 #else
79 #define SIM_ARANGE_INLINE
80 #endif
81 #define SIM_ARANGE_C_INCLUDED
82
83 #endif /* SIM_ARANGE_H */