~bkerensa/ubuntu/raring/valgrind/merge-from-deb

« back to all changes in this revision

Viewing changes to exp-drd/pub_drd_bitmap.h

  • Committer: Bazaar Package Importer
  • Author(s): Andrés Roldán
  • Date: 2008-06-13 02:31:40 UTC
  • mto: (1.4.1 upstream) (2.2.1 squeeze)
  • mto: This revision was merged to the branch mainline in revision 24.
  • Revision ID: james.westby@ubuntu.com-20080613023140-iwk33rz9rhvfkr96
Import upstream version 3.3.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
  This file is part of drd, a data race detector.
 
3
 
 
4
  Copyright (C) 2006-2007 Bart Van Assche
 
5
  bart.vanassche@gmail.com
 
6
 
 
7
  This program is free software; you can redistribute it and/or
 
8
  modify it under the terms of the GNU General Public License as
 
9
  published by the Free Software Foundation; either version 2 of the
 
10
  License, or (at your option) any later version.
 
11
 
 
12
  This program is distributed in the hope that it will be useful, but
 
13
  WITHOUT ANY WARRANTY; without even the implied warranty of
 
14
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
15
  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, write to the Free Software
 
19
  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
 
20
  02111-1307, USA.
 
21
 
 
22
  The GNU General Public License is contained in the file COPYING.
 
23
*/
 
24
 
 
25
 
 
26
// A bitmap is a data structure that contains information about which
 
27
// addresses have been accessed for reading or writing within a given
 
28
// segment.
 
29
 
 
30
 
 
31
#ifndef __DRD_BITMAP_H
 
32
#define __DRD_BITMAP_H
 
33
 
 
34
 
 
35
#include "pub_tool_basics.h" /* Addr, SizeT */
 
36
 
 
37
 
 
38
// Constant definitions.
 
39
 
 
40
#define LHS_R (1<<0)
 
41
#define LHS_W (1<<1)
 
42
#define RHS_R (1<<2)
 
43
#define RHS_W (1<<3)
 
44
#define HAS_RACE(a) ((((a) & RHS_W) && ((a) & (LHS_R | LHS_W))) \
 
45
                  || (((a) & LHS_W) && ((a) & (RHS_R | RHS_W))))
 
46
 
 
47
 
 
48
// Forward declarations.
 
49
struct bitmap;
 
50
 
 
51
 
 
52
// Datatype definitions.
 
53
typedef enum { eLoad, eStore } BmAccessTypeT;
 
54
 
 
55
 
 
56
// Function declarations.
 
57
struct bitmap* bm_new(void);
 
58
void bm_delete(struct bitmap* const bm);
 
59
void bm_access_range(struct bitmap* const bm,
 
60
                     const Addr address,
 
61
                     const SizeT size,
 
62
                     const BmAccessTypeT access_type);
 
63
void bm_access_4(struct bitmap* const bm,
 
64
                 const Addr address,
 
65
                 const BmAccessTypeT access_type);
 
66
Bool bm_has(const struct bitmap* const bm,
 
67
            const Addr a1,
 
68
            const Addr a2,
 
69
            const BmAccessTypeT access_type);
 
70
Bool bm_has_any(const struct bitmap* const bm,
 
71
                const Addr a1,
 
72
                const Addr a2,
 
73
                const BmAccessTypeT access_type);
 
74
UWord bm_has_any_access(const struct bitmap* const bm,
 
75
                        const Addr a1,
 
76
                        const Addr a2);
 
77
UWord bm_has_1(const struct bitmap* const bm,
 
78
               const Addr address,
 
79
               const BmAccessTypeT access_type);
 
80
void bm_clear_all(const struct bitmap* const bm);
 
81
void bm_clear(const struct bitmap* const bm,
 
82
              const Addr a1,
 
83
              const Addr a2);
 
84
Bool bm_has_conflict_with(const struct bitmap* const bm,
 
85
                          const Addr a1,
 
86
                          const Addr a2,
 
87
                          const BmAccessTypeT access_type);
 
88
void bm_swap(struct bitmap* const bm1, struct bitmap* const bm2);
 
89
void bm_merge2(struct bitmap* const lhs,
 
90
               const struct bitmap* const rhs);
 
91
int bm_has_races(const struct bitmap* const bm1,
 
92
                 const struct bitmap* const bm2);
 
93
void bm_report_races(ThreadId const tid1, ThreadId const tid2,
 
94
                     const struct bitmap* const bm1,
 
95
                     const struct bitmap* const bm2);
 
96
void bm_print(const struct bitmap* bm);
 
97
ULong bm_get_bitmap_creation_count(void);
 
98
ULong bm_get_bitmap2_creation_count(void);
 
99
void bm_test(void);
 
100
 
 
101
 
 
102
 
 
103
#endif /* __DRD_BITMAP_H */