bart | 922304f | 2011-03-13 12:02:44 +0000 | [diff] [blame] | 1 | /* -*- mode: C; c-basic-offset: 3; indent-tabs-mode: nil; -*- */ |
sewardj | af44c82 | 2007-11-25 14:01:38 +0000 | [diff] [blame] | 2 | /* |
bart | 86562bd | 2009-02-16 19:43:56 +0000 | [diff] [blame] | 3 | This file is part of drd, a thread error detector. |
sewardj | af44c82 | 2007-11-25 14:01:38 +0000 | [diff] [blame] | 4 | |
bart | 922304f | 2011-03-13 12:02:44 +0000 | [diff] [blame] | 5 | Copyright (C) 2006-2011 Bart Van Assche <bvanassche@acm.org>. |
sewardj | af44c82 | 2007-11-25 14:01:38 +0000 | [diff] [blame] | 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 | |
bart | 886b87c | 2008-06-28 13:40:41 +0000 | [diff] [blame] | 26 | #include "drd_clientobj.h" /* struct mutex_info */ |
sewardj | af44c82 | 2007-11-25 14:01:38 +0000 | [diff] [blame] | 27 | #include "drd_error.h" |
| 28 | #include "drd_malloc_wrappers.h" |
bart | 886b87c | 2008-06-28 13:40:41 +0000 | [diff] [blame] | 29 | #include "drd_mutex.h" |
| 30 | #include "drd_suppression.h" /* drd_start_suppression() */ |
| 31 | #include "pub_drd_bitmap.h" /* LHS_W, ... */ |
sewardj | af44c82 | 2007-11-25 14:01:38 +0000 | [diff] [blame] | 32 | #include "pub_tool_vki.h" |
| 33 | #include "pub_tool_basics.h" |
bart | 886b87c | 2008-06-28 13:40:41 +0000 | [diff] [blame] | 34 | #include "pub_tool_libcassert.h" /* tl_assert() */ |
| 35 | #include "pub_tool_libcbase.h" /* strlen() */ |
| 36 | #include "pub_tool_libcfile.h" /* VG_(get_startup_wd)() */ |
| 37 | #include "pub_tool_libcprint.h" /* VG_(printf)() */ |
sewardj | af44c82 | 2007-11-25 14:01:38 +0000 | [diff] [blame] | 38 | #include "pub_tool_machine.h" |
bart | 886b87c | 2008-06-28 13:40:41 +0000 | [diff] [blame] | 39 | #include "pub_tool_mallocfree.h" /* VG_(malloc), VG_(free) */ |
bart | b92ff0f | 2011-10-08 08:29:29 +0000 | [diff] [blame] | 40 | #include "pub_tool_options.h" /* VG_(clo_xml) */ |
bart | 886b87c | 2008-06-28 13:40:41 +0000 | [diff] [blame] | 41 | #include "pub_tool_threadstate.h" /* VG_(get_pthread_id)() */ |
| 42 | #include "pub_tool_tooliface.h" /* VG_(needs_tool_errors)() */ |
sewardj | af44c82 | 2007-11-25 14:01:38 +0000 | [diff] [blame] | 43 | |
| 44 | |
bart | e708600 | 2011-10-11 19:08:39 +0000 | [diff] [blame] | 45 | /* Local function declarations. */ |
| 46 | |
| 47 | static Char* drd_get_error_name(Error* e); |
| 48 | |
| 49 | |
bart | 16d76e5 | 2008-03-18 17:08:08 +0000 | [diff] [blame] | 50 | /* Local variables. */ |
| 51 | |
bart | d2c5eae | 2009-02-21 15:27:04 +0000 | [diff] [blame] | 52 | static Bool s_show_conflicting_segments = True; |
bart | 16d76e5 | 2008-03-18 17:08:08 +0000 | [diff] [blame] | 53 | |
| 54 | |
bart | 246fbf2 | 2009-02-15 14:46:17 +0000 | [diff] [blame] | 55 | void DRD_(set_show_conflicting_segments)(const Bool scs) |
bart | 16d76e5 | 2008-03-18 17:08:08 +0000 | [diff] [blame] | 56 | { |
bart | bedfd23 | 2009-03-26 19:07:15 +0000 | [diff] [blame] | 57 | s_show_conflicting_segments = scs; |
bart | 16d76e5 | 2008-03-18 17:08:08 +0000 | [diff] [blame] | 58 | } |
| 59 | |
bart | b92ff0f | 2011-10-08 08:29:29 +0000 | [diff] [blame] | 60 | void DRD_(trace_msg)(const char* format, ...) |
| 61 | { |
| 62 | va_list vargs; |
| 63 | va_start(vargs, format); |
bart | e708600 | 2011-10-11 19:08:39 +0000 | [diff] [blame] | 64 | if (VG_(clo_xml)) { |
| 65 | VG_(printf_xml)("<traceline>\n "); |
| 66 | VG_(vprintf_xml)(format, vargs); |
| 67 | VG_(printf_xml)("</traceline>\n"); |
| 68 | } else { |
| 69 | VG_(vmessage)(Vg_UserMsg, format, vargs); |
| 70 | } |
| 71 | va_end(vargs); |
| 72 | } |
| 73 | |
| 74 | /** |
| 75 | * Emit error message detail in the format requested by the user. |
| 76 | */ |
| 77 | static void print_err_detail(const char* format, ...) PRINTF_CHECK(1, 2); |
| 78 | static void print_err_detail(const char* format, ...) |
| 79 | { |
| 80 | va_list vargs; |
| 81 | va_start(vargs, format); |
| 82 | if (VG_(clo_xml)) |
| 83 | VG_(vprintf_xml)(format, vargs); |
| 84 | else |
| 85 | VG_(vmessage)(Vg_UserMsg, format, vargs); |
bart | b92ff0f | 2011-10-08 08:29:29 +0000 | [diff] [blame] | 86 | va_end(vargs); |
| 87 | } |
| 88 | |
bart | 246fbf2 | 2009-02-15 14:46:17 +0000 | [diff] [blame] | 89 | /** |
bart | 61d36ff | 2009-07-27 14:17:33 +0000 | [diff] [blame] | 90 | * Describe the client address a as good as possible, putting the result in ai. |
bart | 886b87c | 2008-06-28 13:40:41 +0000 | [diff] [blame] | 91 | */ |
bart | ff1252a | 2008-03-16 17:27:25 +0000 | [diff] [blame] | 92 | static |
bart | 61d36ff | 2009-07-27 14:17:33 +0000 | [diff] [blame] | 93 | void describe_malloced_addr(Addr const a, AddrInfo* const ai) |
sewardj | af44c82 | 2007-11-25 14:01:38 +0000 | [diff] [blame] | 94 | { |
bart | 61d36ff | 2009-07-27 14:17:33 +0000 | [diff] [blame] | 95 | Addr heap_block_start; |
sewardj | af44c82 | 2007-11-25 14:01:38 +0000 | [diff] [blame] | 96 | |
bart | 61d36ff | 2009-07-27 14:17:33 +0000 | [diff] [blame] | 97 | if (DRD_(heap_addrinfo)(a, &heap_block_start, &ai->size, &ai->lastchange)) |
bart | bedfd23 | 2009-03-26 19:07:15 +0000 | [diff] [blame] | 98 | { |
| 99 | ai->akind = eMallocd; |
bart | 61d36ff | 2009-07-27 14:17:33 +0000 | [diff] [blame] | 100 | ai->rwoffset = a - heap_block_start; |
bart | bedfd23 | 2009-03-26 19:07:15 +0000 | [diff] [blame] | 101 | } |
| 102 | else |
| 103 | { |
| 104 | ai->akind = eUnknown; |
| 105 | } |
sewardj | af44c82 | 2007-11-25 14:01:38 +0000 | [diff] [blame] | 106 | } |
| 107 | |
bart | 246fbf2 | 2009-02-15 14:46:17 +0000 | [diff] [blame] | 108 | /** |
bart | 61d36ff | 2009-07-27 14:17:33 +0000 | [diff] [blame] | 109 | * Report where a client synchronization object has been observed for the first |
| 110 | * time. The printed call stack will either refer to a pthread_*_init() or a |
| 111 | * pthread_*lock() call. |
bart | 886b87c | 2008-06-28 13:40:41 +0000 | [diff] [blame] | 112 | */ |
bart | d2c5eae | 2009-02-21 15:27:04 +0000 | [diff] [blame] | 113 | static void first_observed(const Addr obj) |
bart | 886b87c | 2008-06-28 13:40:41 +0000 | [diff] [blame] | 114 | { |
bart | bedfd23 | 2009-03-26 19:07:15 +0000 | [diff] [blame] | 115 | DrdClientobj* cl; |
bart | 886b87c | 2008-06-28 13:40:41 +0000 | [diff] [blame] | 116 | |
bart | bedfd23 | 2009-03-26 19:07:15 +0000 | [diff] [blame] | 117 | cl = DRD_(clientobj_get_any)(obj); |
bart | e708600 | 2011-10-11 19:08:39 +0000 | [diff] [blame] | 118 | if (cl) { |
bart | bedfd23 | 2009-03-26 19:07:15 +0000 | [diff] [blame] | 119 | tl_assert(cl->any.first_observed_at); |
bart | e708600 | 2011-10-11 19:08:39 +0000 | [diff] [blame] | 120 | if (VG_(clo_xml)) { |
| 121 | print_err_detail(" <first_observed_at>\n" |
| 122 | " <what>%pS</what>\n" |
| 123 | " <address>0x%lx</address>\n", |
| 124 | DRD_(clientobj_type_name)(cl->any.type), obj); |
| 125 | VG_(pp_ExeContext)(cl->any.first_observed_at); |
| 126 | print_err_detail(" </first_observed_at>\n"); |
| 127 | } else { |
| 128 | print_err_detail("%s 0x%lx was first observed at:\n", |
| 129 | DRD_(clientobj_type_name)(cl->any.type), obj); |
| 130 | VG_(pp_ExeContext)(cl->any.first_observed_at); |
| 131 | } |
bart | bedfd23 | 2009-03-26 19:07:15 +0000 | [diff] [blame] | 132 | } |
bart | 886b87c | 2008-06-28 13:40:41 +0000 | [diff] [blame] | 133 | } |
| 134 | |
sewardj | af44c82 | 2007-11-25 14:01:38 +0000 | [diff] [blame] | 135 | static |
bart | d2c5eae | 2009-02-21 15:27:04 +0000 | [diff] [blame] | 136 | void drd_report_data_race(Error* const err, const DataRaceErrInfo* const dri) |
sewardj | af44c82 | 2007-11-25 14:01:38 +0000 | [diff] [blame] | 137 | { |
bart | e708600 | 2011-10-11 19:08:39 +0000 | [diff] [blame] | 138 | const Bool xml = VG_(clo_xml); |
| 139 | const char* const what_prefix = xml ? " <what>" : ""; |
| 140 | const char* const what_suffix = xml ? "</what>" : ""; |
bart | ca7285e | 2011-10-13 16:42:49 +0000 | [diff] [blame] | 141 | const char* const auxwhat_prefix = xml ? " <auxwhat>" : ""; |
| 142 | const char* const auxwhat_suffix = xml ? "</auxwhat>" : ""; |
bart | e708600 | 2011-10-11 19:08:39 +0000 | [diff] [blame] | 143 | const char* const indent = xml ? " " : ""; |
bart | bedfd23 | 2009-03-26 19:07:15 +0000 | [diff] [blame] | 144 | AddrInfo ai; |
sewardj | 1e29ebc | 2009-07-15 14:49:17 +0000 | [diff] [blame] | 145 | |
| 146 | XArray* /* of HChar */ descr1 |
| 147 | = VG_(newXA)( VG_(malloc), "drd.error.drdr2.1", |
| 148 | VG_(free), sizeof(HChar) ); |
| 149 | XArray* /* of HChar */ descr2 |
| 150 | = VG_(newXA)( VG_(malloc), "drd.error.drdr2.2", |
| 151 | VG_(free), sizeof(HChar) ); |
sewardj | af44c82 | 2007-11-25 14:01:38 +0000 | [diff] [blame] | 152 | |
bart | bedfd23 | 2009-03-26 19:07:15 +0000 | [diff] [blame] | 153 | tl_assert(dri); |
| 154 | tl_assert(dri->addr); |
| 155 | tl_assert(dri->size > 0); |
| 156 | tl_assert(descr1); |
| 157 | tl_assert(descr2); |
bart | b515eb1 | 2008-03-07 18:52:38 +0000 | [diff] [blame] | 158 | |
sewardj | 1e29ebc | 2009-07-15 14:49:17 +0000 | [diff] [blame] | 159 | (void) VG_(get_data_description)(descr1, descr2, dri->addr); |
| 160 | /* If there's nothing in descr1/2, free them. Why is it safe to to |
| 161 | VG_(indexXA) at zero here? Because VG_(get_data_description) |
| 162 | guarantees to zero terminate descr1/2 regardless of the outcome |
| 163 | of the call. So there's always at least one element in each XA |
| 164 | after the call. |
| 165 | */ |
| 166 | if (0 == VG_(strlen)( VG_(indexXA)( descr1, 0 ))) { |
| 167 | VG_(deleteXA)( descr1 ); |
| 168 | descr1 = NULL; |
| 169 | } |
| 170 | if (0 == VG_(strlen)( VG_(indexXA)( descr2, 0 ))) { |
| 171 | VG_(deleteXA)( descr2 ); |
| 172 | descr2 = NULL; |
| 173 | } |
| 174 | /* Assume (assert) that VG_(get_data_description) fills in descr1 |
| 175 | before it fills in descr2 */ |
| 176 | if (descr1 == NULL) |
| 177 | tl_assert(descr2 == NULL); |
| 178 | /* So anyway. Do we have something useful? */ |
| 179 | if (descr1 == NULL) |
bart | bedfd23 | 2009-03-26 19:07:15 +0000 | [diff] [blame] | 180 | { |
sewardj | 1e29ebc | 2009-07-15 14:49:17 +0000 | [diff] [blame] | 181 | /* No. Do Plan B. */ |
bart | 61d36ff | 2009-07-27 14:17:33 +0000 | [diff] [blame] | 182 | describe_malloced_addr(dri->addr, &ai); |
bart | bedfd23 | 2009-03-26 19:07:15 +0000 | [diff] [blame] | 183 | } |
bart | e708600 | 2011-10-11 19:08:39 +0000 | [diff] [blame] | 184 | |
| 185 | print_err_detail("%sConflicting %s by thread %d at 0x%08lx size %ld%s\n", |
| 186 | what_prefix, dri->access_type == eStore ? "store" : "load", |
| 187 | dri->tid, dri->addr, dri->size, what_suffix); |
| 188 | |
bart | bedfd23 | 2009-03-26 19:07:15 +0000 | [diff] [blame] | 189 | VG_(pp_ExeContext)(VG_(get_error_where)(err)); |
bart | e708600 | 2011-10-11 19:08:39 +0000 | [diff] [blame] | 190 | if (descr1 != NULL) { |
| 191 | print_err_detail("%s%s\n", indent, (HChar*)VG_(indexXA)(descr1, 0)); |
sewardj | 1e29ebc | 2009-07-15 14:49:17 +0000 | [diff] [blame] | 192 | if (descr2 != NULL) |
bart | e708600 | 2011-10-11 19:08:39 +0000 | [diff] [blame] | 193 | print_err_detail("%s%s\n", indent, (HChar*)VG_(indexXA)(descr2, 0)); |
| 194 | } else if (ai.akind == eMallocd && ai.lastchange) { |
bart | ca7285e | 2011-10-13 16:42:49 +0000 | [diff] [blame] | 195 | print_err_detail("%sAddress 0x%lx is at offset %ld from 0x%lx.%s%s", |
| 196 | auxwhat_prefix, dri->addr, ai.rwoffset, |
| 197 | dri->addr - ai.rwoffset, auxwhat_suffix, |
| 198 | xml ? "\n" : ""); |
bart | e708600 | 2011-10-11 19:08:39 +0000 | [diff] [blame] | 199 | if (xml) |
bart | ca7285e | 2011-10-13 16:42:49 +0000 | [diff] [blame] | 200 | print_err_detail(" <allocation_context>\n"); |
bart | e708600 | 2011-10-11 19:08:39 +0000 | [diff] [blame] | 201 | else |
| 202 | print_err_detail(" Allocation context:\n"); |
bart | bedfd23 | 2009-03-26 19:07:15 +0000 | [diff] [blame] | 203 | VG_(pp_ExeContext)(ai.lastchange); |
bart | e708600 | 2011-10-11 19:08:39 +0000 | [diff] [blame] | 204 | if (xml) |
bart | ca7285e | 2011-10-13 16:42:49 +0000 | [diff] [blame] | 205 | print_err_detail(" </allocation_context>\n"); |
bart | e708600 | 2011-10-11 19:08:39 +0000 | [diff] [blame] | 206 | } else { |
bart | bedfd23 | 2009-03-26 19:07:15 +0000 | [diff] [blame] | 207 | char sect_name[64]; |
| 208 | VgSectKind sect_kind; |
bart | f993b87 | 2008-04-01 18:19:50 +0000 | [diff] [blame] | 209 | |
sewardj | e3f1e59 | 2009-07-31 09:41:29 +0000 | [diff] [blame] | 210 | sect_kind = VG_(DebugInfo_sect_kind)(sect_name, sizeof(sect_name), |
| 211 | dri->addr); |
bart | ca7285e | 2011-10-13 16:42:49 +0000 | [diff] [blame] | 212 | if (sect_kind != Vg_SectUnknown) { |
| 213 | print_err_detail("%sAllocation context: %ps section of %ps%s\n", |
| 214 | auxwhat_prefix, VG_(pp_SectKind)(sect_kind), |
| 215 | sect_name, auxwhat_suffix); |
bart | e708600 | 2011-10-11 19:08:39 +0000 | [diff] [blame] | 216 | } else { |
bart | ca7285e | 2011-10-13 16:42:49 +0000 | [diff] [blame] | 217 | print_err_detail("%sAllocation context: unknown.%s\n", |
| 218 | auxwhat_prefix, auxwhat_suffix); |
bart | bedfd23 | 2009-03-26 19:07:15 +0000 | [diff] [blame] | 219 | } |
| 220 | } |
| 221 | if (s_show_conflicting_segments) |
| 222 | { |
| 223 | DRD_(thread_report_conflicting_segments)(dri->tid, |
| 224 | dri->addr, dri->size, |
| 225 | dri->access_type); |
| 226 | } |
| 227 | |
sewardj | 1e29ebc | 2009-07-15 14:49:17 +0000 | [diff] [blame] | 228 | if (descr2) |
| 229 | VG_(deleteXA)(descr2); |
| 230 | if (descr1) |
| 231 | VG_(deleteXA)(descr1); |
sewardj | af44c82 | 2007-11-25 14:01:38 +0000 | [diff] [blame] | 232 | } |
| 233 | |
bart | 61d36ff | 2009-07-27 14:17:33 +0000 | [diff] [blame] | 234 | /** |
| 235 | * Compare two error contexts. The core function VG_(maybe_record_error)() |
| 236 | * calls this function to compare error contexts such that errors that occur |
bart | 31b983d | 2010-02-21 14:52:59 +0000 | [diff] [blame] | 237 | * repeatedly are only printed once. This function is only called by the core |
bart | 61d36ff | 2009-07-27 14:17:33 +0000 | [diff] [blame] | 238 | * if the error kind of e1 and e2 matches and if the ExeContext's of e1 and |
| 239 | * e2 also match. |
| 240 | */ |
| 241 | static Bool drd_compare_error_contexts(VgRes res, Error* e1, Error* e2) |
sewardj | af44c82 | 2007-11-25 14:01:38 +0000 | [diff] [blame] | 242 | { |
bart | b80fa96 | 2009-07-31 08:45:02 +0000 | [diff] [blame] | 243 | tl_assert(VG_(get_error_kind)(e1) == VG_(get_error_kind)(e2)); |
| 244 | |
| 245 | switch (VG_(get_error_kind)(e1)) |
| 246 | { |
| 247 | case DataRaceErr: |
| 248 | { |
| 249 | const DataRaceErrInfo* const dri1 = VG_(get_error_extra)(e1); |
| 250 | const DataRaceErrInfo* const dri2 = VG_(get_error_extra)(e2); |
| 251 | return dri1->access_type == dri2->access_type |
| 252 | && dri1->size == dri2->size; |
| 253 | } |
bart | 94fb8d2 | 2009-07-31 18:45:49 +0000 | [diff] [blame] | 254 | case MutexErr: |
| 255 | { |
| 256 | const MutexErrInfo* const mei1 = VG_(get_error_extra)(e1); |
| 257 | const MutexErrInfo* const mei2 = VG_(get_error_extra)(e2); |
| 258 | return mei1->mutex == mei2->mutex; |
| 259 | } |
bart | b80fa96 | 2009-07-31 08:45:02 +0000 | [diff] [blame] | 260 | default: |
| 261 | return True; |
| 262 | } |
sewardj | af44c82 | 2007-11-25 14:01:38 +0000 | [diff] [blame] | 263 | } |
| 264 | |
bart | 61d36ff | 2009-07-27 14:17:33 +0000 | [diff] [blame] | 265 | /** |
| 266 | * Called by the core just before an error message will be printed. Used by |
| 267 | * DRD to print the thread number as a preamble. |
| 268 | */ |
sewardj | 1e29ebc | 2009-07-15 14:49:17 +0000 | [diff] [blame] | 269 | static void drd_tool_error_before_pp(Error* const e) |
| 270 | { |
bart | d45d995 | 2009-05-31 18:53:54 +0000 | [diff] [blame] | 271 | static DrdThreadId s_last_tid_printed = 1; |
| 272 | DrdThreadId* err_extra; |
| 273 | |
| 274 | err_extra = VG_(get_error_extra)(e); |
| 275 | |
bart | e708600 | 2011-10-11 19:08:39 +0000 | [diff] [blame] | 276 | if (err_extra && *err_extra != s_last_tid_printed && !VG_(clo_xml)) { |
sewardj | 1e29ebc | 2009-07-15 14:49:17 +0000 | [diff] [blame] | 277 | VG_(umsg)("%s:\n", DRD_(thread_get_name)(*err_extra)); |
bart | d45d995 | 2009-05-31 18:53:54 +0000 | [diff] [blame] | 278 | s_last_tid_printed = *err_extra; |
| 279 | } |
bart | 61d36ff | 2009-07-27 14:17:33 +0000 | [diff] [blame] | 280 | } |
bart | d45d995 | 2009-05-31 18:53:54 +0000 | [diff] [blame] | 281 | |
bart | 61d36ff | 2009-07-27 14:17:33 +0000 | [diff] [blame] | 282 | /** Report an error to the user. */ |
| 283 | static void drd_tool_error_pp(Error* const e) |
| 284 | { |
bart | e708600 | 2011-10-11 19:08:39 +0000 | [diff] [blame] | 285 | const Bool xml = VG_(clo_xml); |
| 286 | const char* const what_prefix = xml ? " <what>" : ""; |
| 287 | const char* const what_suffix = xml ? "</what>" : ""; |
| 288 | |
| 289 | if (xml) |
| 290 | VG_(printf_xml)( " <kind>%pS</kind>\n", drd_get_error_name(e)); |
| 291 | |
bart | bedfd23 | 2009-03-26 19:07:15 +0000 | [diff] [blame] | 292 | switch (VG_(get_error_kind)(e)) |
| 293 | { |
| 294 | case DataRaceErr: { |
| 295 | drd_report_data_race(e, VG_(get_error_extra)(e)); |
| 296 | break; |
| 297 | } |
| 298 | case MutexErr: { |
| 299 | MutexErrInfo* p = (MutexErrInfo*)(VG_(get_error_extra)(e)); |
| 300 | tl_assert(p); |
bart | e708600 | 2011-10-11 19:08:39 +0000 | [diff] [blame] | 301 | if (p->recursion_count >= 0) { |
| 302 | print_err_detail("%s%s: mutex 0x%lx, recursion count %d, owner %d." |
| 303 | "%s\n", what_prefix, VG_(get_error_string)(e), |
| 304 | p->mutex, p->recursion_count, p->owner, what_suffix); |
| 305 | } else { |
| 306 | print_err_detail("%sThe object at address 0x%lx is not a mutex.%s\n", |
| 307 | what_prefix, p->mutex, what_suffix); |
bart | bedfd23 | 2009-03-26 19:07:15 +0000 | [diff] [blame] | 308 | } |
| 309 | VG_(pp_ExeContext)(VG_(get_error_where)(e)); |
| 310 | first_observed(p->mutex); |
| 311 | break; |
| 312 | } |
| 313 | case CondErr: { |
| 314 | CondErrInfo* cdei =(CondErrInfo*)(VG_(get_error_extra)(e)); |
bart | e708600 | 2011-10-11 19:08:39 +0000 | [diff] [blame] | 315 | print_err_detail("%s%s: cond 0x%lx%s\n", what_prefix, |
| 316 | VG_(get_error_string)(e), cdei->cond, what_suffix); |
bart | bedfd23 | 2009-03-26 19:07:15 +0000 | [diff] [blame] | 317 | VG_(pp_ExeContext)(VG_(get_error_where)(e)); |
| 318 | first_observed(cdei->cond); |
| 319 | break; |
| 320 | } |
| 321 | case CondDestrErr: { |
| 322 | CondDestrErrInfo* cdi = (CondDestrErrInfo*)(VG_(get_error_extra)(e)); |
bart | e708600 | 2011-10-11 19:08:39 +0000 | [diff] [blame] | 323 | print_err_detail("%s%s: cond 0x%lx, mutex 0x%lx locked by thread %d%s\n", |
| 324 | what_prefix, VG_(get_error_string)(e), cdi->cond, |
| 325 | cdi->mutex, cdi->owner, what_suffix); |
bart | bedfd23 | 2009-03-26 19:07:15 +0000 | [diff] [blame] | 326 | VG_(pp_ExeContext)(VG_(get_error_where)(e)); |
| 327 | first_observed(cdi->mutex); |
| 328 | break; |
| 329 | } |
| 330 | case CondRaceErr: { |
| 331 | CondRaceErrInfo* cei = (CondRaceErrInfo*)(VG_(get_error_extra)(e)); |
bart | e708600 | 2011-10-11 19:08:39 +0000 | [diff] [blame] | 332 | print_err_detail("%sProbably a race condition: condition variable 0x%lx" |
| 333 | " has been signaled but the associated mutex 0x%lx is" |
| 334 | " not locked by the signalling thread.%s\n", |
| 335 | what_prefix, cei->cond, cei->mutex, what_suffix); |
bart | bedfd23 | 2009-03-26 19:07:15 +0000 | [diff] [blame] | 336 | VG_(pp_ExeContext)(VG_(get_error_where)(e)); |
| 337 | first_observed(cei->cond); |
| 338 | first_observed(cei->mutex); |
| 339 | break; |
| 340 | } |
| 341 | case CondWaitErr: { |
| 342 | CondWaitErrInfo* cwei = (CondWaitErrInfo*)(VG_(get_error_extra)(e)); |
bart | e708600 | 2011-10-11 19:08:39 +0000 | [diff] [blame] | 343 | print_err_detail("%s%s: condition variable 0x%lx, mutexes 0x%lx and" |
| 344 | " 0x%lx%s\n", what_prefix, VG_(get_error_string)(e), |
| 345 | cwei->cond, cwei->mutex1, cwei->mutex2, what_suffix); |
bart | bedfd23 | 2009-03-26 19:07:15 +0000 | [diff] [blame] | 346 | VG_(pp_ExeContext)(VG_(get_error_where)(e)); |
| 347 | first_observed(cwei->cond); |
| 348 | first_observed(cwei->mutex1); |
| 349 | first_observed(cwei->mutex2); |
| 350 | break; |
| 351 | } |
| 352 | case SemaphoreErr: { |
| 353 | SemaphoreErrInfo* sei = (SemaphoreErrInfo*)(VG_(get_error_extra)(e)); |
| 354 | tl_assert(sei); |
bart | b6ab69e | 2011-10-13 16:47:53 +0000 | [diff] [blame^] | 355 | print_err_detail("%s%s: semaphore 0x%lx%s\n", what_prefix, |
| 356 | VG_(get_error_string)(e), sei->semaphore, what_suffix); |
bart | bedfd23 | 2009-03-26 19:07:15 +0000 | [diff] [blame] | 357 | VG_(pp_ExeContext)(VG_(get_error_where)(e)); |
| 358 | first_observed(sei->semaphore); |
| 359 | break; |
| 360 | } |
| 361 | case BarrierErr: { |
| 362 | BarrierErrInfo* bei = (BarrierErrInfo*)(VG_(get_error_extra)(e)); |
| 363 | tl_assert(bei); |
bart | e708600 | 2011-10-11 19:08:39 +0000 | [diff] [blame] | 364 | print_err_detail("%s%s: barrier 0x%lx%s\n", what_prefix, |
| 365 | VG_(get_error_string)(e), bei->barrier, what_suffix); |
bart | bedfd23 | 2009-03-26 19:07:15 +0000 | [diff] [blame] | 366 | VG_(pp_ExeContext)(VG_(get_error_where)(e)); |
bart | e708600 | 2011-10-11 19:08:39 +0000 | [diff] [blame] | 367 | if (bei->other_context) { |
| 368 | if (xml) |
| 369 | print_err_detail(" <confl_wait_call>\n"); |
| 370 | print_err_detail("%sConflicting wait call by thread %d:%s\n", |
| 371 | what_prefix, bei->other_tid, what_suffix); |
bart | bedfd23 | 2009-03-26 19:07:15 +0000 | [diff] [blame] | 372 | VG_(pp_ExeContext)(bei->other_context); |
bart | e708600 | 2011-10-11 19:08:39 +0000 | [diff] [blame] | 373 | if (xml) |
| 374 | print_err_detail(" </confl_wait_call>\n"); |
bart | bedfd23 | 2009-03-26 19:07:15 +0000 | [diff] [blame] | 375 | } |
| 376 | first_observed(bei->barrier); |
| 377 | break; |
| 378 | } |
| 379 | case RwlockErr: { |
| 380 | RwlockErrInfo* p = (RwlockErrInfo*)(VG_(get_error_extra)(e)); |
| 381 | tl_assert(p); |
bart | e708600 | 2011-10-11 19:08:39 +0000 | [diff] [blame] | 382 | print_err_detail("%s%s: rwlock 0x%lx.%s\n", what_prefix, |
| 383 | VG_(get_error_string)(e), p->rwlock, what_suffix); |
bart | bedfd23 | 2009-03-26 19:07:15 +0000 | [diff] [blame] | 384 | VG_(pp_ExeContext)(VG_(get_error_where)(e)); |
| 385 | first_observed(p->rwlock); |
| 386 | break; |
| 387 | } |
| 388 | case HoldtimeErr: { |
| 389 | HoldtimeErrInfo* p =(HoldtimeErrInfo*)(VG_(get_error_extra)(e)); |
| 390 | tl_assert(p); |
| 391 | tl_assert(p->acquired_at); |
bart | e708600 | 2011-10-11 19:08:39 +0000 | [diff] [blame] | 392 | if (xml) |
| 393 | print_err_detail(" <acquired_at>\n"); |
| 394 | else |
| 395 | print_err_detail("Acquired at:\n"); |
bart | bedfd23 | 2009-03-26 19:07:15 +0000 | [diff] [blame] | 396 | VG_(pp_ExeContext)(p->acquired_at); |
bart | b6ab69e | 2011-10-13 16:47:53 +0000 | [diff] [blame^] | 397 | if (xml) |
| 398 | print_err_detail(" </acquired_at>\n"); |
bart | e708600 | 2011-10-11 19:08:39 +0000 | [diff] [blame] | 399 | print_err_detail("%sLock on %s 0x%lx was held during %d ms" |
| 400 | " (threshold: %d ms).%s\n", what_prefix, |
| 401 | VG_(get_error_string)(e), p->synchronization_object, |
| 402 | p->hold_time_ms, p->threshold_ms, what_suffix); |
bart | bedfd23 | 2009-03-26 19:07:15 +0000 | [diff] [blame] | 403 | VG_(pp_ExeContext)(VG_(get_error_where)(e)); |
| 404 | first_observed(p->synchronization_object); |
| 405 | break; |
| 406 | } |
| 407 | case GenericErr: { |
bart | 62cc232 | 2010-03-07 10:54:21 +0000 | [diff] [blame] | 408 | GenericErrInfo* gei = (GenericErrInfo*)(VG_(get_error_extra)(e)); |
bart | e708600 | 2011-10-11 19:08:39 +0000 | [diff] [blame] | 409 | print_err_detail("%s%s%s\n", what_prefix, VG_(get_error_string)(e), |
| 410 | what_suffix); |
bart | bedfd23 | 2009-03-26 19:07:15 +0000 | [diff] [blame] | 411 | VG_(pp_ExeContext)(VG_(get_error_where)(e)); |
bart | 62cc232 | 2010-03-07 10:54:21 +0000 | [diff] [blame] | 412 | if (gei->addr) |
| 413 | first_observed(gei->addr); |
bart | bedfd23 | 2009-03-26 19:07:15 +0000 | [diff] [blame] | 414 | break; |
| 415 | } |
bart | b48bde2 | 2009-07-31 08:26:17 +0000 | [diff] [blame] | 416 | case InvalidThreadId: { |
| 417 | InvalidThreadIdInfo* iti =(InvalidThreadIdInfo*)(VG_(get_error_extra)(e)); |
bart | e708600 | 2011-10-11 19:08:39 +0000 | [diff] [blame] | 418 | print_err_detail("%s%s 0x%llx%s\n", what_prefix, VG_(get_error_string)(e), |
| 419 | iti->ptid, what_suffix); |
bart | b48bde2 | 2009-07-31 08:26:17 +0000 | [diff] [blame] | 420 | VG_(pp_ExeContext)(VG_(get_error_where)(e)); |
| 421 | break; |
| 422 | } |
bart | 141a7ed | 2010-03-21 17:28:10 +0000 | [diff] [blame] | 423 | case UnimpHgClReq: { |
bart | 66f196d | 2009-08-15 10:50:35 +0000 | [diff] [blame] | 424 | UnimpClReqInfo* uicr =(UnimpClReqInfo*)(VG_(get_error_extra)(e)); |
bart | e708600 | 2011-10-11 19:08:39 +0000 | [diff] [blame] | 425 | print_err_detail("%sThe annotation macro %s has not yet been implemented" |
| 426 | " in %ps%s\n", what_prefix, uicr->descr, |
| 427 | "<valgrind/helgrind.h>", what_suffix); |
bart | 66f196d | 2009-08-15 10:50:35 +0000 | [diff] [blame] | 428 | VG_(pp_ExeContext)(VG_(get_error_where)(e)); |
| 429 | break; |
| 430 | } |
bart | 141a7ed | 2010-03-21 17:28:10 +0000 | [diff] [blame] | 431 | case UnimpDrdClReq: { |
| 432 | UnimpClReqInfo* uicr =(UnimpClReqInfo*)(VG_(get_error_extra)(e)); |
bart | e708600 | 2011-10-11 19:08:39 +0000 | [diff] [blame] | 433 | print_err_detail("%sThe annotation macro %s has not yet been implemented" |
| 434 | " in %ps%s\n", what_prefix, uicr->descr, |
| 435 | "<valgrind/drd.h>", what_suffix); |
bart | 141a7ed | 2010-03-21 17:28:10 +0000 | [diff] [blame] | 436 | VG_(pp_ExeContext)(VG_(get_error_where)(e)); |
| 437 | break; |
| 438 | } |
bart | bedfd23 | 2009-03-26 19:07:15 +0000 | [diff] [blame] | 439 | default: |
bart | e708600 | 2011-10-11 19:08:39 +0000 | [diff] [blame] | 440 | print_err_detail("%s%s%s\n", what_prefix, VG_(get_error_string)(e), |
| 441 | what_suffix); |
bart | bedfd23 | 2009-03-26 19:07:15 +0000 | [diff] [blame] | 442 | VG_(pp_ExeContext)(VG_(get_error_where)(e)); |
| 443 | break; |
| 444 | } |
sewardj | af44c82 | 2007-11-25 14:01:38 +0000 | [diff] [blame] | 445 | } |
| 446 | |
bart | d2c5eae | 2009-02-21 15:27:04 +0000 | [diff] [blame] | 447 | static UInt drd_tool_error_update_extra(Error* e) |
sewardj | af44c82 | 2007-11-25 14:01:38 +0000 | [diff] [blame] | 448 | { |
bart | bedfd23 | 2009-03-26 19:07:15 +0000 | [diff] [blame] | 449 | switch (VG_(get_error_kind)(e)) |
| 450 | { |
| 451 | case DataRaceErr: |
| 452 | return sizeof(DataRaceErrInfo); |
| 453 | case MutexErr: |
| 454 | return sizeof(MutexErrInfo); |
| 455 | case CondErr: |
| 456 | return sizeof(CondErrInfo); |
| 457 | case CondDestrErr: |
| 458 | return sizeof(CondDestrErrInfo); |
| 459 | case CondRaceErr: |
| 460 | return sizeof(CondRaceErrInfo); |
| 461 | case CondWaitErr: |
| 462 | return sizeof(CondWaitErrInfo); |
| 463 | case SemaphoreErr: |
| 464 | return sizeof(SemaphoreErrInfo); |
| 465 | case BarrierErr: |
| 466 | return sizeof(BarrierErrInfo); |
| 467 | case RwlockErr: |
| 468 | return sizeof(RwlockErrInfo); |
| 469 | case HoldtimeErr: |
| 470 | return sizeof(HoldtimeErrInfo); |
| 471 | case GenericErr: |
| 472 | return sizeof(GenericErrInfo); |
bart | b48bde2 | 2009-07-31 08:26:17 +0000 | [diff] [blame] | 473 | case InvalidThreadId: |
| 474 | return sizeof(InvalidThreadIdInfo); |
bart | 141a7ed | 2010-03-21 17:28:10 +0000 | [diff] [blame] | 475 | case UnimpHgClReq: |
| 476 | return sizeof(UnimpClReqInfo); |
| 477 | case UnimpDrdClReq: |
bart | 66f196d | 2009-08-15 10:50:35 +0000 | [diff] [blame] | 478 | return sizeof(UnimpClReqInfo); |
bart | bedfd23 | 2009-03-26 19:07:15 +0000 | [diff] [blame] | 479 | default: |
| 480 | tl_assert(False); |
| 481 | break; |
| 482 | } |
sewardj | af44c82 | 2007-11-25 14:01:38 +0000 | [diff] [blame] | 483 | } |
| 484 | |
bart | 61d36ff | 2009-07-27 14:17:33 +0000 | [diff] [blame] | 485 | /** |
| 486 | * Parse suppression name. |
| 487 | * |
| 488 | * The suppression types recognized by DRD are the same types as the error |
| 489 | * types supported by DRD. So try to match the suppression name against the |
| 490 | * names of DRD error types. |
| 491 | */ |
| 492 | static Bool drd_is_recognized_suppression(Char* const name, Supp* const supp) |
sewardj | af44c82 | 2007-11-25 14:01:38 +0000 | [diff] [blame] | 493 | { |
bart | 61d36ff | 2009-07-27 14:17:33 +0000 | [diff] [blame] | 494 | DrdErrorKind skind = 0; |
sewardj | af44c82 | 2007-11-25 14:01:38 +0000 | [diff] [blame] | 495 | |
bart | bedfd23 | 2009-03-26 19:07:15 +0000 | [diff] [blame] | 496 | if (VG_(strcmp)(name, STR_DataRaceErr) == 0) |
bart | 61d36ff | 2009-07-27 14:17:33 +0000 | [diff] [blame] | 497 | skind = DataRaceErr; |
bart | bedfd23 | 2009-03-26 19:07:15 +0000 | [diff] [blame] | 498 | else if (VG_(strcmp)(name, STR_MutexErr) == 0) |
bart | 61d36ff | 2009-07-27 14:17:33 +0000 | [diff] [blame] | 499 | skind = MutexErr; |
bart | bedfd23 | 2009-03-26 19:07:15 +0000 | [diff] [blame] | 500 | else if (VG_(strcmp)(name, STR_CondErr) == 0) |
bart | 61d36ff | 2009-07-27 14:17:33 +0000 | [diff] [blame] | 501 | skind = CondErr; |
bart | bedfd23 | 2009-03-26 19:07:15 +0000 | [diff] [blame] | 502 | else if (VG_(strcmp)(name, STR_CondDestrErr) == 0) |
bart | 61d36ff | 2009-07-27 14:17:33 +0000 | [diff] [blame] | 503 | skind = CondDestrErr; |
bart | bedfd23 | 2009-03-26 19:07:15 +0000 | [diff] [blame] | 504 | else if (VG_(strcmp)(name, STR_CondRaceErr) == 0) |
bart | 61d36ff | 2009-07-27 14:17:33 +0000 | [diff] [blame] | 505 | skind = CondRaceErr; |
bart | bedfd23 | 2009-03-26 19:07:15 +0000 | [diff] [blame] | 506 | else if (VG_(strcmp)(name, STR_CondWaitErr) == 0) |
bart | 61d36ff | 2009-07-27 14:17:33 +0000 | [diff] [blame] | 507 | skind = CondWaitErr; |
bart | bedfd23 | 2009-03-26 19:07:15 +0000 | [diff] [blame] | 508 | else if (VG_(strcmp)(name, STR_SemaphoreErr) == 0) |
bart | 61d36ff | 2009-07-27 14:17:33 +0000 | [diff] [blame] | 509 | skind = SemaphoreErr; |
bart | bedfd23 | 2009-03-26 19:07:15 +0000 | [diff] [blame] | 510 | else if (VG_(strcmp)(name, STR_BarrierErr) == 0) |
bart | 61d36ff | 2009-07-27 14:17:33 +0000 | [diff] [blame] | 511 | skind = BarrierErr; |
bart | bedfd23 | 2009-03-26 19:07:15 +0000 | [diff] [blame] | 512 | else if (VG_(strcmp)(name, STR_RwlockErr) == 0) |
bart | 61d36ff | 2009-07-27 14:17:33 +0000 | [diff] [blame] | 513 | skind = RwlockErr; |
bart | bedfd23 | 2009-03-26 19:07:15 +0000 | [diff] [blame] | 514 | else if (VG_(strcmp)(name, STR_HoldtimeErr) == 0) |
bart | 61d36ff | 2009-07-27 14:17:33 +0000 | [diff] [blame] | 515 | skind = HoldtimeErr; |
bart | bedfd23 | 2009-03-26 19:07:15 +0000 | [diff] [blame] | 516 | else if (VG_(strcmp)(name, STR_GenericErr) == 0) |
bart | 61d36ff | 2009-07-27 14:17:33 +0000 | [diff] [blame] | 517 | skind = GenericErr; |
bart | b48bde2 | 2009-07-31 08:26:17 +0000 | [diff] [blame] | 518 | else if (VG_(strcmp)(name, STR_InvalidThreadId) == 0) |
| 519 | skind = InvalidThreadId; |
bart | 141a7ed | 2010-03-21 17:28:10 +0000 | [diff] [blame] | 520 | else if (VG_(strcmp)(name, STR_UnimpHgClReq) == 0) |
| 521 | skind = UnimpHgClReq; |
| 522 | else if (VG_(strcmp)(name, STR_UnimpDrdClReq) == 0) |
| 523 | skind = UnimpDrdClReq; |
bart | bedfd23 | 2009-03-26 19:07:15 +0000 | [diff] [blame] | 524 | else |
| 525 | return False; |
sewardj | af44c82 | 2007-11-25 14:01:38 +0000 | [diff] [blame] | 526 | |
bart | bedfd23 | 2009-03-26 19:07:15 +0000 | [diff] [blame] | 527 | VG_(set_supp_kind)(supp, skind); |
| 528 | return True; |
sewardj | af44c82 | 2007-11-25 14:01:38 +0000 | [diff] [blame] | 529 | } |
| 530 | |
bart | 61d36ff | 2009-07-27 14:17:33 +0000 | [diff] [blame] | 531 | /** |
| 532 | * Read additional suppression information from the suppression file. |
| 533 | * |
| 534 | * None of the suppression patterns recognized by DRD has 'extra' lines |
| 535 | * of information in the suppression file, so just return True to indicate |
| 536 | * that reading the 'extra' lines succeeded. |
| 537 | */ |
bart | 246fbf2 | 2009-02-15 14:46:17 +0000 | [diff] [blame] | 538 | static |
bart | 61d36ff | 2009-07-27 14:17:33 +0000 | [diff] [blame] | 539 | Bool drd_read_extra_suppression_info(Int fd, Char** bufpp, |
| 540 | SizeT* nBufp, Supp* supp) |
sewardj | af44c82 | 2007-11-25 14:01:38 +0000 | [diff] [blame] | 541 | { |
bart | bedfd23 | 2009-03-26 19:07:15 +0000 | [diff] [blame] | 542 | return True; |
sewardj | af44c82 | 2007-11-25 14:01:38 +0000 | [diff] [blame] | 543 | } |
| 544 | |
bart | 61d36ff | 2009-07-27 14:17:33 +0000 | [diff] [blame] | 545 | /** |
| 546 | * Determine whether or not the types of the given error message and the |
| 547 | * given suppression match. |
| 548 | */ |
| 549 | static Bool drd_error_matches_suppression(Error* const e, Supp* const supp) |
sewardj | af44c82 | 2007-11-25 14:01:38 +0000 | [diff] [blame] | 550 | { |
bart | 61d36ff | 2009-07-27 14:17:33 +0000 | [diff] [blame] | 551 | return VG_(get_supp_kind)(supp) == VG_(get_error_kind)(e); |
sewardj | af44c82 | 2007-11-25 14:01:38 +0000 | [diff] [blame] | 552 | } |
| 553 | |
bart | 61d36ff | 2009-07-27 14:17:33 +0000 | [diff] [blame] | 554 | static Char* drd_get_error_name(Error* e) |
sewardj | af44c82 | 2007-11-25 14:01:38 +0000 | [diff] [blame] | 555 | { |
bart | bedfd23 | 2009-03-26 19:07:15 +0000 | [diff] [blame] | 556 | switch (VG_(get_error_kind)(e)) |
| 557 | { |
| 558 | case DataRaceErr: return VGAPPEND(STR_, DataRaceErr); |
| 559 | case MutexErr: return VGAPPEND(STR_, MutexErr); |
| 560 | case CondErr: return VGAPPEND(STR_, CondErr); |
| 561 | case CondDestrErr: return VGAPPEND(STR_, CondDestrErr); |
| 562 | case CondRaceErr: return VGAPPEND(STR_, CondRaceErr); |
| 563 | case CondWaitErr: return VGAPPEND(STR_, CondWaitErr); |
| 564 | case SemaphoreErr: return VGAPPEND(STR_, SemaphoreErr); |
| 565 | case BarrierErr: return VGAPPEND(STR_, BarrierErr); |
| 566 | case RwlockErr: return VGAPPEND(STR_, RwlockErr); |
| 567 | case HoldtimeErr: return VGAPPEND(STR_, HoldtimeErr); |
| 568 | case GenericErr: return VGAPPEND(STR_, GenericErr); |
bart | b48bde2 | 2009-07-31 08:26:17 +0000 | [diff] [blame] | 569 | case InvalidThreadId: return VGAPPEND(STR_, InvalidThreadId); |
bart | 141a7ed | 2010-03-21 17:28:10 +0000 | [diff] [blame] | 570 | case UnimpHgClReq: return VGAPPEND(STR_, UnimpHgClReq); |
| 571 | case UnimpDrdClReq: return VGAPPEND(STR_, UnimpDrdClReq); |
bart | bedfd23 | 2009-03-26 19:07:15 +0000 | [diff] [blame] | 572 | default: |
| 573 | tl_assert(0); |
| 574 | } |
| 575 | return 0; |
sewardj | af44c82 | 2007-11-25 14:01:38 +0000 | [diff] [blame] | 576 | } |
| 577 | |
bart | 61d36ff | 2009-07-27 14:17:33 +0000 | [diff] [blame] | 578 | /** |
sewardj | 588adef | 2009-08-15 22:41:51 +0000 | [diff] [blame] | 579 | * Return extra suppression information. |
bart | 61d36ff | 2009-07-27 14:17:33 +0000 | [diff] [blame] | 580 | * |
| 581 | * Invoked while printing a suppression pattern because the user |
| 582 | * specified --gen-suppressions=yes or all on the command line. DRD does not |
| 583 | * define any 'extra' suppression information. |
| 584 | */ |
sewardj | 588adef | 2009-08-15 22:41:51 +0000 | [diff] [blame] | 585 | static |
| 586 | Bool drd_get_extra_suppression_info(Error* e, |
| 587 | /*OUT*/Char* buf, Int nBuf) |
| 588 | { |
| 589 | return False; |
| 590 | } |
sewardj | af44c82 | 2007-11-25 14:01:38 +0000 | [diff] [blame] | 591 | |
bart | 61d36ff | 2009-07-27 14:17:33 +0000 | [diff] [blame] | 592 | /** Tell the Valgrind core about DRD's error handlers. */ |
bart | 1335ecc | 2009-02-14 16:10:53 +0000 | [diff] [blame] | 593 | void DRD_(register_error_handlers)(void) |
sewardj | af44c82 | 2007-11-25 14:01:38 +0000 | [diff] [blame] | 594 | { |
bart | 61d36ff | 2009-07-27 14:17:33 +0000 | [diff] [blame] | 595 | VG_(needs_tool_errors)(drd_compare_error_contexts, |
sewardj | 1e29ebc | 2009-07-15 14:49:17 +0000 | [diff] [blame] | 596 | drd_tool_error_before_pp, |
bart | bedfd23 | 2009-03-26 19:07:15 +0000 | [diff] [blame] | 597 | drd_tool_error_pp, |
bart | d45d995 | 2009-05-31 18:53:54 +0000 | [diff] [blame] | 598 | False, |
bart | bedfd23 | 2009-03-26 19:07:15 +0000 | [diff] [blame] | 599 | drd_tool_error_update_extra, |
bart | 61d36ff | 2009-07-27 14:17:33 +0000 | [diff] [blame] | 600 | drd_is_recognized_suppression, |
| 601 | drd_read_extra_suppression_info, |
| 602 | drd_error_matches_suppression, |
| 603 | drd_get_error_name, |
sewardj | 588adef | 2009-08-15 22:41:51 +0000 | [diff] [blame] | 604 | drd_get_extra_suppression_info); |
sewardj | af44c82 | 2007-11-25 14:01:38 +0000 | [diff] [blame] | 605 | } |