Valgrind和ThreadSanitizer

There are still some problems with the detection tool of the paper. I looked for the tool to compare with it on github, and then ran it
Valgrind: A Framework for Heavyweight Dynamic Binary
Instrumentation 2007
Nethercote N, Seward J. Valgrind: a framework for heavyweight dynamic binary instrumentation[C]// Proceedings of the ACM SIGPLAN 2007 Conference on Programming Language Design and Implementation, San Diego, California, USA, June 10-13, 2007. ACM, 2007.
Dynamic binary instrumentation framework
Valgrind tool DRD ( Thread error detector)
detect data competition5
Insert picture description here

Issues that need attention in multithreaded programming:
data competition; lock competition; improper use of POSIX thread API; deadlock; intercepted part of the test results

("Thread 3") tells you the thread ID of the thread that detected data contention in the context.
The next line tells you which operation (load or store) was performed and which thread was performed. On the same line, the starting address and the number of bytes involved in the conflicting access will also be 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 contain the file name and line number.
Next, the allocation context of the conflicting address is displayed. For dynamically allocated data, the allocation call stack will be displayed.
Insert picture description here

ThreadSanitizer dynamic detection technology datarace detection
Serebryany, Konstantin, Iskhodzhanov, T. ThreadSanitizer: data race detection in practice[C]// Workshop on Binary Instrumentation & Applications. ACM, 2009.
ThreadSanitizer is a tool for detecting data races. It consists of a compiler detection module and a runtime library. Thread Sanitizer records the information of each memory access and detects whether the access participates in competition.
It does not scan and analyze the source code, but takes a series of discrete event points generated during the operation of the program as input, analyzes it, and finds competition. The most important events are memory access and synchronization.
If a competition is detected, the program will print an error message to stderr.
Insert picture description here
Insert picture description here

Guess you like

Origin blog.csdn.net/shanlijia/article/details/107966921