blob: 42597513ee3dfbed34ab047aa6e0e42af01e1c90 [file] [log] [blame]
sewardjaf44c822007-11-25 14:01:38 +00001/*
bart86562bd2009-02-16 19:43:56 +00002 This file is part of drd, a thread error detector.
sewardjaf44c822007-11-25 14:01:38 +00003
bart86562bd2009-02-16 19:43:56 +00004 Copyright (C) 2006-2009 Bart Van Assche <bart.vanassche@gmail.com>.
sewardjaf44c822007-11-25 14:01:38 +00005
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.
10
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.
15
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
19 02111-1307, USA.
20
21 The GNU General Public License is contained in the file COPYING.
22*/
23
24
bart886b87c2008-06-28 13:40:41 +000025#include "drd_clientobj.h" /* struct mutex_info */
sewardjaf44c822007-11-25 14:01:38 +000026#include "drd_error.h"
27#include "drd_malloc_wrappers.h"
bart886b87c2008-06-28 13:40:41 +000028#include "drd_mutex.h"
29#include "drd_suppression.h" /* drd_start_suppression() */
30#include "pub_drd_bitmap.h" /* LHS_W, ... */
sewardjaf44c822007-11-25 14:01:38 +000031#include "pub_tool_vki.h"
32#include "pub_tool_basics.h"
bart886b87c2008-06-28 13:40:41 +000033#include "pub_tool_libcassert.h" /* tl_assert() */
34#include "pub_tool_libcbase.h" /* strlen() */
35#include "pub_tool_libcfile.h" /* VG_(get_startup_wd)() */
36#include "pub_tool_libcprint.h" /* VG_(printf)() */
sewardjaf44c822007-11-25 14:01:38 +000037#include "pub_tool_machine.h"
bart886b87c2008-06-28 13:40:41 +000038#include "pub_tool_mallocfree.h" /* VG_(malloc), VG_(free) */
39#include "pub_tool_threadstate.h" /* VG_(get_pthread_id)() */
40#include "pub_tool_tooliface.h" /* VG_(needs_tool_errors)() */
sewardjaf44c822007-11-25 14:01:38 +000041
42
bart16d76e52008-03-18 17:08:08 +000043/* Local variables. */
44
bartd2c5eae2009-02-21 15:27:04 +000045static Bool s_show_conflicting_segments = True;
bart16d76e52008-03-18 17:08:08 +000046
47
bart246fbf22009-02-15 14:46:17 +000048void DRD_(set_show_conflicting_segments)(const Bool scs)
bart16d76e52008-03-18 17:08:08 +000049{
bartd2c5eae2009-02-21 15:27:04 +000050 s_show_conflicting_segments = scs;
bart16d76e52008-03-18 17:08:08 +000051}
52
bart246fbf22009-02-15 14:46:17 +000053/**
54 * Describe a data address range [a,a+len[ as good as possible, for error
55 * messages, putting the result in ai.
bart886b87c2008-06-28 13:40:41 +000056 */
bartff1252a2008-03-16 17:27:25 +000057static
bartd2c5eae2009-02-21 15:27:04 +000058void describe_malloced_addr(Addr const a, SizeT const len, AddrInfo* const ai)
sewardjaf44c822007-11-25 14:01:38 +000059{
bartff1252a2008-03-16 17:27:25 +000060 Addr data;
sewardjaf44c822007-11-25 14:01:38 +000061
bart246fbf22009-02-15 14:46:17 +000062 if (DRD_(heap_addrinfo)(a, &data, &ai->size, &ai->lastchange))
bart3772a982008-03-15 08:11:03 +000063 {
bartff1252a2008-03-16 17:27:25 +000064 ai->akind = eMallocd;
65 ai->rwoffset = a - data;
bart3772a982008-03-15 08:11:03 +000066 }
bartff1252a2008-03-16 17:27:25 +000067 else
bart3772a982008-03-15 08:11:03 +000068 {
bartff1252a2008-03-16 17:27:25 +000069 ai->akind = eUnknown;
bart3772a982008-03-15 08:11:03 +000070 }
sewardjaf44c822007-11-25 14:01:38 +000071}
72
bart246fbf22009-02-15 14:46:17 +000073/**
74 * Report where an object has been observed for the first time. The printed
75 * call stack will either refer to a pthread_*_init() or a pthread_*lock()
76 * call.
bart886b87c2008-06-28 13:40:41 +000077 */
bartd2c5eae2009-02-21 15:27:04 +000078static void first_observed(const Addr obj)
bart886b87c2008-06-28 13:40:41 +000079{
bart391d9dc2008-07-03 10:57:30 +000080 DrdClientobj* cl;
bart886b87c2008-06-28 13:40:41 +000081
bart195e41f2009-02-15 11:34:57 +000082 cl = DRD_(clientobj_get_any)(obj);
bart391d9dc2008-07-03 10:57:30 +000083 if (cl)
bart886b87c2008-06-28 13:40:41 +000084 {
bart391d9dc2008-07-03 10:57:30 +000085 tl_assert(cl->any.first_observed_at);
bart886b87c2008-06-28 13:40:41 +000086 VG_(message)(Vg_UserMsg,
bart391d9dc2008-07-03 10:57:30 +000087 "%s 0x%lx was first observed at:",
bart195e41f2009-02-15 11:34:57 +000088 DRD_(clientobj_type_name)(cl->any.type),
bart391d9dc2008-07-03 10:57:30 +000089 obj);
90 VG_(pp_ExeContext)(cl->any.first_observed_at);
bart886b87c2008-06-28 13:40:41 +000091 }
92}
93
sewardjaf44c822007-11-25 14:01:38 +000094static
bartd2c5eae2009-02-21 15:27:04 +000095void drd_report_data_race(Error* const err, const DataRaceErrInfo* const dri)
sewardjaf44c822007-11-25 14:01:38 +000096{
bart3772a982008-03-15 08:11:03 +000097 AddrInfo ai;
bartf993b872008-04-01 18:19:50 +000098 const unsigned descr_size = 256;
sewardj9c606bd2008-09-18 18:12:50 +000099 Char* descr1 = VG_(malloc)("drd.error.drdr2.1", descr_size);
100 Char* descr2 = VG_(malloc)("drd.error.drdr2.2", descr_size);
sewardjaf44c822007-11-25 14:01:38 +0000101
bart3772a982008-03-15 08:11:03 +0000102 tl_assert(dri);
103 tl_assert(dri->addr);
104 tl_assert(dri->size > 0);
bartfdd8d4e2008-04-01 18:38:29 +0000105 tl_assert(descr1);
106 tl_assert(descr2);
bartb515eb12008-03-07 18:52:38 +0000107
bart3772a982008-03-15 08:11:03 +0000108 descr1[0] = 0;
109 descr2[0] = 0;
bartf993b872008-04-01 18:19:50 +0000110 VG_(get_data_description)(descr1, descr2, descr_size, dri->addr);
bart3772a982008-03-15 08:11:03 +0000111 if (descr1[0] == 0)
112 {
bartd2c5eae2009-02-21 15:27:04 +0000113 describe_malloced_addr(dri->addr, dri->size, &ai);
bart3772a982008-03-15 08:11:03 +0000114 }
115 VG_(message)(Vg_UserMsg,
bartaa97a542008-03-16 17:57:01 +0000116 "Conflicting %s by thread %d/%d at 0x%08lx size %ld",
bart3772a982008-03-15 08:11:03 +0000117 dri->access_type == eStore ? "store" : "load",
bart62a784c2009-02-15 13:11:14 +0000118 DRD_(DrdThreadIdToVgThreadId)(dri->tid),
bartaa97a542008-03-16 17:57:01 +0000119 dri->tid,
bart3772a982008-03-15 08:11:03 +0000120 dri->addr,
121 dri->size);
122 VG_(pp_ExeContext)(VG_(get_error_where)(err));
123 if (descr1[0])
124 {
125 VG_(message)(Vg_UserMsg, "%s", descr1);
126 VG_(message)(Vg_UserMsg, "%s", descr2);
127 }
128 else if (ai.akind == eMallocd && ai.lastchange)
129 {
130 VG_(message)(Vg_UserMsg,
131 "Address 0x%lx is at offset %ld from 0x%lx."
132 " Allocation context:",
133 dri->addr, ai.rwoffset, dri->addr - ai.rwoffset);
134 VG_(pp_ExeContext)(ai.lastchange);
135 }
136 else
137 {
bartfca00e52008-07-09 12:43:35 +0000138 char sect_name[64];
139 VgSectKind sect_kind;
140
141 sect_kind = VG_(seginfo_sect_kind)(sect_name, sizeof(sect_name), dri->addr);
142 if (sect_kind != Vg_SectUnknown)
143 {
144 VG_(message)(Vg_UserMsg,
145 "Allocation context: %s section of %s",
146 VG_(pp_SectKind)(sect_kind),
147 sect_name);
148 }
149 else
150 {
151 VG_(message)(Vg_UserMsg, "Allocation context: unknown.");
152 }
bart3772a982008-03-15 08:11:03 +0000153 }
bartd2c5eae2009-02-21 15:27:04 +0000154 if (s_show_conflicting_segments)
bart16d76e52008-03-18 17:08:08 +0000155 {
bart62a784c2009-02-15 13:11:14 +0000156 DRD_(thread_report_conflicting_segments)(dri->tid,
157 dri->addr, dri->size,
158 dri->access_type);
bart16d76e52008-03-18 17:08:08 +0000159 }
bartf993b872008-04-01 18:19:50 +0000160
161 VG_(free)(descr2);
162 VG_(free)(descr1);
sewardjaf44c822007-11-25 14:01:38 +0000163}
164
bartd2c5eae2009-02-21 15:27:04 +0000165static Bool drd_tool_error_eq(VgRes res, Error* e1, Error* e2)
sewardjaf44c822007-11-25 14:01:38 +0000166{
bart3772a982008-03-15 08:11:03 +0000167 return False;
sewardjaf44c822007-11-25 14:01:38 +0000168}
169
bartd2c5eae2009-02-21 15:27:04 +0000170static void drd_tool_error_pp(Error* const e)
sewardjaf44c822007-11-25 14:01:38 +0000171{
bart3772a982008-03-15 08:11:03 +0000172 switch (VG_(get_error_kind)(e))
173 {
174 case DataRaceErr: {
bartd2c5eae2009-02-21 15:27:04 +0000175 drd_report_data_race(e, VG_(get_error_extra)(e));
bart3772a982008-03-15 08:11:03 +0000176 break;
177 }
178 case MutexErr: {
179 MutexErrInfo* p = (MutexErrInfo*)(VG_(get_error_extra)(e));
180 tl_assert(p);
bart6b717612008-03-24 09:29:38 +0000181 if (p->recursion_count >= 0)
182 {
183 VG_(message)(Vg_UserMsg,
184 "%s: mutex 0x%lx, recursion count %d, owner %d.",
185 VG_(get_error_string)(e),
186 p->mutex,
187 p->recursion_count,
188 p->owner);
189 }
190 else
191 {
192 VG_(message)(Vg_UserMsg,
bart52e82912008-03-24 19:31:33 +0000193 "The object at address 0x%lx is not a mutex.",
bart6b717612008-03-24 09:29:38 +0000194 p->mutex);
195 }
bart3772a982008-03-15 08:11:03 +0000196 VG_(pp_ExeContext)(VG_(get_error_where)(e));
bartd2c5eae2009-02-21 15:27:04 +0000197 first_observed(p->mutex);
bart3772a982008-03-15 08:11:03 +0000198 break;
199 }
200 case CondErr: {
201 CondErrInfo* cdei =(CondErrInfo*)(VG_(get_error_extra)(e));
202 VG_(message)(Vg_UserMsg,
203 "%s: cond 0x%lx",
bartbe8a12c2008-03-17 18:36:55 +0000204 VG_(get_error_string)(e),
205 cdei->cond);
bart3772a982008-03-15 08:11:03 +0000206 VG_(pp_ExeContext)(VG_(get_error_where)(e));
bartd2c5eae2009-02-21 15:27:04 +0000207 first_observed(cdei->cond);
bart3772a982008-03-15 08:11:03 +0000208 break;
209 }
bart3bb1cec2008-06-28 16:01:43 +0000210 case CondDestrErr: {
211 CondDestrErrInfo* cdi = (CondDestrErrInfo*)(VG_(get_error_extra)(e));
212 VG_(message)(Vg_UserMsg,
213 "%s: cond 0x%lx, mutex 0x%lx locked by thread %d/%d",
214 VG_(get_error_string)(e),
215 cdi->cond, cdi->mutex,
bart62a784c2009-02-15 13:11:14 +0000216 DRD_(DrdThreadIdToVgThreadId)(cdi->tid), cdi->tid);
bart3bb1cec2008-06-28 16:01:43 +0000217 VG_(pp_ExeContext)(VG_(get_error_where)(e));
bartd2c5eae2009-02-21 15:27:04 +0000218 first_observed(cdi->mutex);
bart3bb1cec2008-06-28 16:01:43 +0000219 break;
220 }
bart3772a982008-03-15 08:11:03 +0000221 case CondRaceErr: {
222 CondRaceErrInfo* cei = (CondRaceErrInfo*)(VG_(get_error_extra)(e));
223 VG_(message)(Vg_UserMsg,
bart46b5fce2008-06-28 13:01:30 +0000224 "Probably a race condition: condition variable 0x%lx has been"
bart886b87c2008-06-28 13:40:41 +0000225 " signaled but the associated mutex 0x%lx is not locked"
226 " by the signalling thread.",
bart3772a982008-03-15 08:11:03 +0000227 cei->cond, cei->mutex);
228 VG_(pp_ExeContext)(VG_(get_error_where)(e));
bartd2c5eae2009-02-21 15:27:04 +0000229 first_observed(cei->cond);
230 first_observed(cei->mutex);
bart3772a982008-03-15 08:11:03 +0000231 break;
232 }
bart3bb1cec2008-06-28 16:01:43 +0000233 case CondWaitErr: {
234 CondWaitErrInfo* cwei = (CondWaitErrInfo*)(VG_(get_error_extra)(e));
bart3772a982008-03-15 08:11:03 +0000235 VG_(message)(Vg_UserMsg,
bart3bb1cec2008-06-28 16:01:43 +0000236 "%s: condition variable 0x%lx, mutexes 0x%lx and 0x%lx",
bartbe8a12c2008-03-17 18:36:55 +0000237 VG_(get_error_string)(e),
bart3bb1cec2008-06-28 16:01:43 +0000238 cwei->cond,
239 cwei->mutex1,
240 cwei->mutex2);
bart3772a982008-03-15 08:11:03 +0000241 VG_(pp_ExeContext)(VG_(get_error_where)(e));
bartd2c5eae2009-02-21 15:27:04 +0000242 first_observed(cwei->cond);
243 first_observed(cwei->mutex1);
244 first_observed(cwei->mutex2);
bart3772a982008-03-15 08:11:03 +0000245 break;
246 }
247 case SemaphoreErr: {
bart886b87c2008-06-28 13:40:41 +0000248 SemaphoreErrInfo* sei = (SemaphoreErrInfo*)(VG_(get_error_extra)(e));
bart3772a982008-03-15 08:11:03 +0000249 tl_assert(sei);
250 VG_(message)(Vg_UserMsg,
251 "%s: semaphore 0x%lx",
252 VG_(get_error_string)(e),
253 sei->semaphore);
254 VG_(pp_ExeContext)(VG_(get_error_where)(e));
bartd2c5eae2009-02-21 15:27:04 +0000255 first_observed(sei->semaphore);
bart3772a982008-03-15 08:11:03 +0000256 break;
257 }
258 case BarrierErr: {
bartd2c5eae2009-02-21 15:27:04 +0000259 BarrierErrInfo* bei = (BarrierErrInfo*)(VG_(get_error_extra)(e));
bart391d9dc2008-07-03 10:57:30 +0000260 tl_assert(bei);
bart3772a982008-03-15 08:11:03 +0000261 VG_(message)(Vg_UserMsg,
262 "%s: barrier 0x%lx",
263 VG_(get_error_string)(e),
bart391d9dc2008-07-03 10:57:30 +0000264 bei->barrier);
bart3772a982008-03-15 08:11:03 +0000265 VG_(pp_ExeContext)(VG_(get_error_where)(e));
bartd2c5eae2009-02-21 15:27:04 +0000266 if (bei->other_context)
267 {
268 VG_(message)(Vg_UserMsg,
269 "Conflicting wait call by thread %d/%d:",
270 DRD_(DrdThreadIdToVgThreadId)(bei->other_tid),
271 bei->other_tid);
272 VG_(pp_ExeContext)(bei->other_context);
273 }
274 first_observed(bei->barrier);
bart3772a982008-03-15 08:11:03 +0000275 break;
276 }
277 case RwlockErr: {
278 RwlockErrInfo* p = (RwlockErrInfo*)(VG_(get_error_extra)(e));
279 tl_assert(p);
280 VG_(message)(Vg_UserMsg,
281 "%s: rwlock 0x%lx.",
282 VG_(get_error_string)(e),
283 p->rwlock);
284 VG_(pp_ExeContext)(VG_(get_error_where)(e));
bartd2c5eae2009-02-21 15:27:04 +0000285 first_observed(p->rwlock);
bart3772a982008-03-15 08:11:03 +0000286 break;
287 }
bart9d5b7962008-05-14 12:25:00 +0000288 case HoldtimeErr: {
289 HoldtimeErrInfo* p =(HoldtimeErrInfo*)(VG_(get_error_extra)(e));
290 tl_assert(p);
291 tl_assert(p->acquired_at);
292 VG_(message)(Vg_UserMsg, "Acquired at:");
293 VG_(pp_ExeContext)(p->acquired_at);
294 VG_(message)(Vg_UserMsg,
295 "Lock on %s 0x%lx was held during %d ms (threshold: %d ms).",
296 VG_(get_error_string)(e),
297 p->synchronization_object,
298 p->hold_time_ms,
299 p->threshold_ms);
300 VG_(pp_ExeContext)(VG_(get_error_where)(e));
bartd2c5eae2009-02-21 15:27:04 +0000301 first_observed(p->synchronization_object);
bart9d5b7962008-05-14 12:25:00 +0000302 break;
303 }
bart3772a982008-03-15 08:11:03 +0000304 case GenericErr: {
305 //GenericErrInfo* gei =(GenericErrInfo*)(VG_(get_error_extra)(e));
306 VG_(message)(Vg_UserMsg, "%s", VG_(get_error_string)(e));
307 VG_(pp_ExeContext)(VG_(get_error_where)(e));
308 break;
309 }
310 default:
311 VG_(message)(Vg_UserMsg,
312 "%s",
313 VG_(get_error_string)(e));
314 VG_(pp_ExeContext)(VG_(get_error_where)(e));
315 break;
316 }
sewardjaf44c822007-11-25 14:01:38 +0000317}
318
bartd2c5eae2009-02-21 15:27:04 +0000319static UInt drd_tool_error_update_extra(Error* e)
sewardjaf44c822007-11-25 14:01:38 +0000320{
bart3772a982008-03-15 08:11:03 +0000321 switch (VG_(get_error_kind)(e))
322 {
323 case DataRaceErr:
324 return sizeof(DataRaceErrInfo);
325 case MutexErr:
326 return sizeof(MutexErrInfo);
327 case CondErr:
328 return sizeof(CondErrInfo);
bart3772a982008-03-15 08:11:03 +0000329 case CondDestrErr:
330 return sizeof(CondDestrErrInfo);
bart3bb1cec2008-06-28 16:01:43 +0000331 case CondRaceErr:
332 return sizeof(CondRaceErrInfo);
333 case CondWaitErr:
334 return sizeof(CondWaitErrInfo);
bart3772a982008-03-15 08:11:03 +0000335 case SemaphoreErr:
336 return sizeof(SemaphoreErrInfo);
337 case BarrierErr:
338 return sizeof(BarrierErrInfo);
339 case RwlockErr:
340 return sizeof(RwlockErrInfo);
bart9d5b7962008-05-14 12:25:00 +0000341 case HoldtimeErr:
342 return sizeof(HoldtimeErrInfo);
bart3772a982008-03-15 08:11:03 +0000343 case GenericErr:
344 return sizeof(GenericErrInfo);
345 default:
346 tl_assert(False);
347 break;
348 }
sewardjaf44c822007-11-25 14:01:38 +0000349}
350
bartd2c5eae2009-02-21 15:27:04 +0000351static Bool drd_tool_error_recog(Char* const name, Supp* const supp)
sewardjaf44c822007-11-25 14:01:38 +0000352{
bart5fc70e62008-03-23 07:54:02 +0000353 SuppKind skind = 0;
sewardjaf44c822007-11-25 14:01:38 +0000354
bart5fc70e62008-03-23 07:54:02 +0000355 if (VG_(strcmp)(name, STR_DataRaceErr) == 0)
356 ;
357 else if (VG_(strcmp)(name, STR_MutexErr) == 0)
358 ;
359 else if (VG_(strcmp)(name, STR_CondErr) == 0)
360 ;
bart3bb1cec2008-06-28 16:01:43 +0000361 else if (VG_(strcmp)(name, STR_CondDestrErr) == 0)
362 ;
bart5fc70e62008-03-23 07:54:02 +0000363 else if (VG_(strcmp)(name, STR_CondRaceErr) == 0)
364 ;
bart3bb1cec2008-06-28 16:01:43 +0000365 else if (VG_(strcmp)(name, STR_CondWaitErr) == 0)
bart5fc70e62008-03-23 07:54:02 +0000366 ;
367 else if (VG_(strcmp)(name, STR_SemaphoreErr) == 0)
368 ;
369 else if (VG_(strcmp)(name, STR_BarrierErr) == 0)
370 ;
371 else if (VG_(strcmp)(name, STR_RwlockErr) == 0)
372 ;
bart9d5b7962008-05-14 12:25:00 +0000373 else if (VG_(strcmp)(name, STR_HoldtimeErr) == 0)
374 ;
bart5fc70e62008-03-23 07:54:02 +0000375 else if (VG_(strcmp)(name, STR_GenericErr) == 0)
376 ;
bart3772a982008-03-15 08:11:03 +0000377 else
378 return False;
sewardjaf44c822007-11-25 14:01:38 +0000379
bart3772a982008-03-15 08:11:03 +0000380 VG_(set_supp_kind)(supp, skind);
381 return True;
sewardjaf44c822007-11-25 14:01:38 +0000382}
383
bart246fbf22009-02-15 14:46:17 +0000384static
bartd2c5eae2009-02-21 15:27:04 +0000385Bool drd_tool_error_read_extra(Int fd, Char* buf, Int nBuf, Supp* supp)
sewardjaf44c822007-11-25 14:01:38 +0000386{
bart3772a982008-03-15 08:11:03 +0000387 return True;
sewardjaf44c822007-11-25 14:01:38 +0000388}
389
bartd2c5eae2009-02-21 15:27:04 +0000390static Bool drd_tool_error_matches(Error* const e, Supp* const supp)
sewardjaf44c822007-11-25 14:01:38 +0000391{
bart3772a982008-03-15 08:11:03 +0000392 switch (VG_(get_supp_kind)(supp))
393 {
394 }
395 return True;
sewardjaf44c822007-11-25 14:01:38 +0000396}
397
bartd2c5eae2009-02-21 15:27:04 +0000398static Char* drd_tool_error_name(Error* e)
sewardjaf44c822007-11-25 14:01:38 +0000399{
bart3772a982008-03-15 08:11:03 +0000400 switch (VG_(get_error_kind)(e))
401 {
bart5fc70e62008-03-23 07:54:02 +0000402 case DataRaceErr: return VGAPPEND(STR_, DataRaceErr);
403 case MutexErr: return VGAPPEND(STR_, MutexErr);
404 case CondErr: return VGAPPEND(STR_, CondErr);
bart5fc70e62008-03-23 07:54:02 +0000405 case CondDestrErr: return VGAPPEND(STR_, CondDestrErr);
bart3bb1cec2008-06-28 16:01:43 +0000406 case CondRaceErr: return VGAPPEND(STR_, CondRaceErr);
407 case CondWaitErr: return VGAPPEND(STR_, CondWaitErr);
bart5fc70e62008-03-23 07:54:02 +0000408 case SemaphoreErr: return VGAPPEND(STR_, SemaphoreErr);
409 case BarrierErr: return VGAPPEND(STR_, BarrierErr);
410 case RwlockErr: return VGAPPEND(STR_, RwlockErr);
bart9d5b7962008-05-14 12:25:00 +0000411 case HoldtimeErr: return VGAPPEND(STR_, HoldtimeErr);
bart5fc70e62008-03-23 07:54:02 +0000412 case GenericErr: return VGAPPEND(STR_, GenericErr);
bart3772a982008-03-15 08:11:03 +0000413 default:
414 tl_assert(0);
415 }
416 return 0;
sewardjaf44c822007-11-25 14:01:38 +0000417}
418
bartd2c5eae2009-02-21 15:27:04 +0000419static void drd_tool_error_print_extra(Error* e)
bart246fbf22009-02-15 14:46:17 +0000420{ }
sewardjaf44c822007-11-25 14:01:38 +0000421
bart1335ecc2009-02-14 16:10:53 +0000422void DRD_(register_error_handlers)(void)
sewardjaf44c822007-11-25 14:01:38 +0000423{
bart3772a982008-03-15 08:11:03 +0000424 // Tool error reporting.
bartd2c5eae2009-02-21 15:27:04 +0000425 VG_(needs_tool_errors)(drd_tool_error_eq,
426 drd_tool_error_pp,
bart3772a982008-03-15 08:11:03 +0000427 True,
bartd2c5eae2009-02-21 15:27:04 +0000428 drd_tool_error_update_extra,
429 drd_tool_error_recog,
430 drd_tool_error_read_extra,
431 drd_tool_error_matches,
432 drd_tool_error_name,
433 drd_tool_error_print_extra);
sewardjaf44c822007-11-25 14:01:38 +0000434}