~ubuntu-branches/debian/sid/valgrind/sid

« back to all changes in this revision

Viewing changes to exp-drd/drd_error.h

  • Committer: Bazaar Package Importer
  • Author(s): Andrés Roldán
  • Date: 2008-06-13 02:31:40 UTC
  • mfrom: (1.2.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20080613023140-rezbg9gtvybimy2q
Tags: 1:3.3.1-2
* debian/rules:
  - Forgot to copy debian-libc6-dbg.supp to /usr/lib/valgrind. 
    (Closes: #486021)

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
#ifndef __DRD_ERROR_H
 
27
#define __DRD_ERROR_H
 
28
 
 
29
 
 
30
#include "pub_drd_bitmap.h"         // BmAccessTypeT
 
31
#include "drd_thread.h"         // DrdThreadId
 
32
#include "pub_tool_basics.h"    // SizeT
 
33
#include "pub_tool_debuginfo.h" // SegInfo
 
34
#include "pub_tool_errormgr.h"  // ExeContext
 
35
 
 
36
 
 
37
/* DRD error types. */
 
38
 
 
39
typedef enum {
 
40
   DataRaceErr    = 1,
 
41
   MutexErr       = 2,
 
42
   CondRaceErr    = 3,
 
43
   CondErr = 4,
 
44
} DrdErrorKind;
 
45
 
 
46
/* The classification of a faulting address. */
 
47
typedef 
 
48
enum { 
 
49
   //Undescribed,   // as-yet unclassified
 
50
   eStack, 
 
51
   eUnknown,       // classification yielded nothing useful
 
52
   //Freed,
 
53
   eMallocd, 
 
54
   eSegment,       // in a segment (as defined in pub_tool_debuginfo.h)
 
55
   //UserG,         // in a user-defined block
 
56
   //Mempool,       // in a mempool
 
57
   //Register,      // in a register;  for Param errors only
 
58
}
 
59
   AddrKind;
 
60
 
 
61
/* Records info about a faulting address. */
 
62
typedef
 
63
struct {                      // Used by:
 
64
   AddrKind    akind;         //   ALL
 
65
   SizeT       size;          //   ALL
 
66
   OffT        rwoffset;      //   ALL
 
67
   ExeContext* lastchange;    //   Mallocd
 
68
   DrdThreadId stack_tid;     //   Stack
 
69
   SegInfo*    seginfo;       //   Segment
 
70
   Char        name[256];     //   Segment
 
71
   Char        descr[256];    //   Segment
 
72
}
 
73
   AddrInfo;
 
74
 
 
75
#ifdef OLD_RACE_DETECTION_ALGORITHM
 
76
/* Records info about a data race. */
 
77
typedef struct {
 
78
   ThreadId tid1;      // Thread ID of first thread involved in the data race.
 
79
   ThreadId tid2;      // Thread ID of second thread involved in the data race.
 
80
   Addr     range_begin;  // Start address of range involved.
 
81
   Addr     range_end;    // Last address (exclusive) of range involved.
 
82
   UInt     range_access; // How the range was accessed (LHS_[RW] | RHS_[RW]).
 
83
} DataRaceInfo;
 
84
#endif
 
85
 
 
86
typedef struct {
 
87
   ThreadId      tid;         // Thread ID of the running thread.
 
88
   Addr          addr;        // Conflicting address in current thread.
 
89
   SizeT         size;        // Size in bytes of conflicting operation.
 
90
   BmAccessTypeT access_type; // Access type: load or store.
 
91
} DataRaceErrInfo;
 
92
 
 
93
typedef struct {
 
94
   Addr mutex;
 
95
   Int recursion_count;
 
96
   DrdThreadId owner;
 
97
} MutexErrInfo;
 
98
 
 
99
typedef struct {
 
100
   Addr cond;
 
101
   Addr mutex;
 
102
} CondRaceErrInfo;
 
103
 
 
104
typedef struct {
 
105
   Addr cond;
 
106
} CondErrInfo;
 
107
 
 
108
void describe_addr(Addr const a, SizeT const len, AddrInfo* const ai);
 
109
Char* describe_addr_text(Addr const a, SizeT const len, AddrInfo* const ai,
 
110
                         Char* const buf, UInt const n_buf);
 
111
#ifdef OLD_RACE_DETECTION_ALGORITHM
 
112
void drd_report_data_race(const DataRaceInfo* const dri);
 
113
#endif
 
114
//void drd_report_data_race2(const DataRaceErrInfo* const dri);
 
115
void drd_register_error_handlers(void);
 
116
 
 
117
 
 
118
#endif /* __DRD_ERROR_H */
 
119
 
 
120
 
 
121
/*
 
122
 * Local variables:
 
123
 * c-basic-offset: 3
 
124
 * End:
 
125
 */