DRD: a thread error detector
--first-race-only=<yes|no> [default:
no]
Whether to report only the first data race that has been detected on a memory location or all data races that have been
detected on a memory location.
--free-is-write=<yes|no> [default:
no]
Whether to report races between accessing memory and freeing memory. Enabling this option may cause DRD to run
slightly slower. Notes:
• Don’t enable this option when using custom memory allocators that use the
VG_USERREQ__MALLOCLIKE_BLOCK
and
VG_USERREQ__FREELIKE_BLOCK
because that would result in false positives.
• Don’t enable this option when using reference-counted objects because that will result in false pos-
itives,
even when that code has been annotated properly with
ANNOTATE_HAPPENS_BEFORE
and
ANNOTATE_HAPPENS_AFTER
. See e.g.
the output of the following command for an example:
valgrind
--tool=drd --free-is-write=yes drd/tests/annotate_smart_pointer
.
--report-signal-unlocked=<yes|no> [default:
yes]
Whether to report calls to
pthread_cond_signal
and
pthread_cond_broadcast
where the mutex associ-
ated with the signal through
pthread_cond_wait
or
pthread_cond_timed_wait
is not locked at the time
the signal is sent. Sending a signal without holding a lock on the associated mutex is a common programming error
which can cause subtle race conditions and unpredictable behavior. There exist some uncommon synchronization
patterns however where it is safe to send a signal without holding a lock on the associated mutex.
--segment-merging=<yes|no> [default:
yes]
Controls segment merging. Segment merging is an algorithm to limit memory usage of the data race detection
algorithm. Disabling segment merging may improve the accuracy of the so-called ’other segments’ displayed in
race reports but can also trigger an out of memory error.
--segment-merging-interval=<n> [default:
10]
Perform segment merging only after the specified number of new segments have been created. This is an advanced
configuration option that allows to choose whether to minimize DRD’s memory usage by choosing a low value or to
let DRD run faster by choosing a slightly higher value. The optimal value for this parameter depends on the program
being analyzed. The default value works well for most programs.
--shared-threshold=<n> [default:
off]
Print an error message if a reader lock has been held longer than the specified time (in milliseconds). This option
enables the detection of lock contention.
--show-confl-seg=<yes|no> [default:
yes]
Show conflicting segments in race reports. Since this information can help to find the cause of a data race, this option
is enabled by default. Disabling this option makes the output of DRD more compact.
--show-stack-usage=<yes|no> [default:
no]
Print stack usage at thread exit time. When a program creates a large number of threads it becomes important to limit
the amount of virtual memory allocated for thread stacks. This option makes it possible to observe how much stack
memory has been used by each thread of the the client program. Note: the DRD tool itself allocates some temporary
data on the client thread stack. The space necessary for this temporary data must be allocated by the client program
when it allocates stack memory, but is not included in stack usage reported by DRD.
The following options are available for monitoring the behavior of the client program:
--trace-addr=<address> [default:
none]
Trace all load and store activity for the specified address. This option may be specified more than once.
124