2 This file is part of drd, a thread error detector.
4 Copyright (C) 2006-2017 Bart Van Assche <bvanassche@acm.org>.
6 This program is free software; you can redistribute it and/or
7 modify it under the terms of the GNU General Public License as
8 published by the Free Software Foundation; either version 2 of the
9 License, or (at your option) any later version.
11 This program is distributed in the hope that it will be useful, but
12 WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
21 The GNU General Public License is contained in the file COPYING.
29 #include "pub_drd_bitmap.h" // BmAccessTypeT
30 #include "drd_thread.h" // DrdThreadId
31 #include "pub_tool_basics.h" // SizeT
32 #include "pub_tool_debuginfo.h" // SegInfo
33 #include "pub_tool_errormgr.h" // ExeContext
36 /* DRD error types. */
39 #define STR_DataRaceErr "ConflictingAccess"
41 #define STR_MutexErr "MutexErr"
43 #define STR_CondErr "CondErr"
45 #define STR_CondDestrErr "CondDestrErr"
47 #define STR_CondRaceErr "CondRaceErr"
49 #define STR_CondWaitErr "CondWaitErr"
51 #define STR_SemaphoreErr "SemaphoreErr"
53 #define STR_BarrierErr "BarrierErr"
55 #define STR_RwlockErr "RwlockErr"
57 #define STR_HoldtimeErr "HoldtimeErr"
59 #define STR_GenericErr "GenericErr"
61 #define STR_InvalidThreadId "InvalidThreadId"
63 #define STR_UnimpHgClReq "UnimpHgClReq"
65 #define STR_UnimpDrdClReq "UnimpDrdClReq"
69 /* The classification of a faulting address. */
72 //Undescribed, // as-yet unclassified
74 eUnknown
, // classification yielded nothing useful
77 eSegment
, // in a segment (as defined in pub_tool_debuginfo.h)
78 //UserG, // in a user-defined block
79 //Mempool, // in a mempool
80 //Register, // in a register; for Param errors only
84 /* Records info about a faulting address. */
87 AddrKind akind
; // ALL
89 PtrdiffT rwoffset
; // ALL
90 ExeContext
* lastchange
; // Mallocd
91 DrdThreadId stack_tid
; // Stack
92 DebugInfo
* debuginfo
; // Segment
93 HChar name
[256]; // Segment
94 HChar descr
[256]; // Segment
98 * NOTE: the first member of each error info structure MUST be the thread ID
99 * in which the error has been observed.
102 DrdThreadId tid
; // Thread ID of the running thread.
103 Addr addr
; // Conflicting address in current thread.
104 SizeT size
; // Size in bytes of conflicting operation.
105 BmAccessTypeT access_type
; // Access type: load or store.
148 DrdThreadId other_tid
;
149 ExeContext
* other_context
;
159 Addr synchronization_object
;
160 ExeContext
* acquired_at
;
173 } InvalidThreadIdInfo
;
180 void DRD_(set_show_conflicting_segments
)(const Bool scs
);
181 void DRD_(register_error_handlers
)(void);
182 void DRD_(trace_msg
)(const HChar
* format
, ...) PRINTF_CHECK(1, 2);
183 void DRD_(trace_msg_w_bt
)(const HChar
* format
, ...) PRINTF_CHECK(1, 2);
186 #endif /* __DRD_ERROR_H */