]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - sim/common/sim-arange.h
Copyright updates for 2007.
[thirdparty/binutils-gdb.git] / sim / common / sim-arange.h
CommitLineData
c906108c 1/* Address ranges.
6aba47ca 2 Copyright (C) 1998, 2007 Free Software Foundation, Inc.
c906108c
SS
3 Contributed by Cygnus Solutions.
4
5This file is part of the GNU Simulators.
6
7This program is free software; you can redistribute it and/or modify
8it under the terms of the GNU General Public License as published by
9the Free Software Foundation; either version 2, or (at your option)
10any later version.
11
12This program is distributed in the hope that it will be useful,
13but WITHOUT ANY WARRANTY; without even the implied warranty of
14MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15GNU General Public License for more details.
16
17You should have received a copy of the GNU General Public License along
18with this program; if not, write to the Free Software Foundation, Inc.,
1959 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
28typedef 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
37typedef 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
47typedef 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. */
55extern 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. */
60extern 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". */
66extern INLINE int
67sim_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 */