DRD: a thread error detector
Below you can find an example of a message printed by DRD when it detects a data race:
$ valgrind --tool=drd --read-var-info=yes drd/tests/rwlock_race
...
==9466== Thread 3:
==9466== Conflicting load by thread 3 at 0x006020b8 size 4
==9466==
at 0x400B6C: thread_func (rwlock_race.c:29)
==9466==
by 0x4C291DF: vg_thread_wrapper (drd_pthread_intercepts.c:186)
==9466==
by 0x4E3403F: start_thread (in /lib64/libpthread-2.8.so)
==9466==
by 0x53250CC: clone (in /lib64/libc-2.8.so)
==9466== Location 0x6020b8 is 0 bytes inside local var "s_racy"
==9466== declared at rwlock_race.c:18, in frame #0 of thread 3
==9466== Other segment start (thread 2)
==9466==
at 0x4C2847D: pthread_rwlock_rdlock* (drd_pthread_intercepts.c:813)
==9466==
by 0x400B6B: thread_func (rwlock_race.c:28)
==9466==
by 0x4C291DF: vg_thread_wrapper (drd_pthread_intercepts.c:186)
==9466==
by 0x4E3403F: start_thread (in /lib64/libpthread-2.8.so)
==9466==
by 0x53250CC: clone (in /lib64/libc-2.8.so)
==9466== Other segment end (thread 2)
==9466==
at 0x4C28B54: pthread_rwlock_unlock* (drd_pthread_intercepts.c:912)
==9466==
by 0x400B84: thread_func (rwlock_race.c:30)
==9466==
by 0x4C291DF: vg_thread_wrapper (drd_pthread_intercepts.c:186)
==9466==
by 0x4E3403F: start_thread (in /lib64/libpthread-2.8.so)
==9466==
by 0x53250CC: clone (in /lib64/libc-2.8.so)
...
The above report has the following meaning:
• The number in the column on the left is the process ID of the process being analyzed by DRD.
• The first line ("Thread 3") tells you the thread ID for the thread in which context the data race has been detected.
• The next line tells which kind of operation was performed (load or store) and by which thread. On the same line the
start address and the number of bytes involved in the conflicting access are also displayed.
• Next, the call stack of the conflicting access is displayed. If your program has been compiled with debug information
(
-g
), this call stack will include file names and line numbers. The two bottommost frames in this call stack (
clone
and
start_thread
) show how the NPTL starts a thread. The third frame (
vg_thread_wrapper
) is added by
DRD. The fourth frame (
thread_func
) is the first interesting line because it shows the thread entry point, that is
the function that has been passed as the third argument to
pthread_create
.
• Next, the allocation context for the conflicting address is displayed. For dynamically allocated data the allocation
call stack is shown.
For static variables and stack variables the allocation context is only shown when the
option
--read-var-info=yes
has been specified. Otherwise DRD will print
Allocation context:
unknown
.
• A conflicting access involves at least two memory accesses. For one of these accesses an exact call stack is displayed,
and for the other accesses an approximate call stack is displayed, namely the start and the end of the segments of
the other accesses. This information can be interpreted as follows:
126
Содержание Software
Страница 176: ...Valgrind FAQ Release 3 8 0 10 August 2012 Copyright 2000 2012 Valgrind Developers Email valgrind valgrind org ...
Страница 177: ...Valgrind FAQ Table of Contents Valgrind Frequently Asked Questions 1 ii ...
Страница 302: ...README mips based on newer GCC versions if possible 95 ...
Страница 303: ...GNU Licenses ...
Страница 304: ...GNU Licenses Table of Contents 1 The GNU General Public License 1 2 The GNU Free Documentation License 8 ii ...