linD026 / ucsan

The User Concurrency Sanitizer (UCSAN)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ucsan

The User Concurrency Sanitizer (UCSAN) is the watchpoint-based data race detector. It uses the thread sanitizer interface in Clang (v3.2+) and GCC (v4.8+) to determine whether the variable data race.

Currently, it only will check the non-volatile type of variable access. In other words, all the variables with thread-safety operations can declare as volatile types to avoid data race checking.

Get start

Build

Build this project with following commands:

$ make                  # Generate static library: libucsan.a
$ make clean            # Delete generated files

Makefile Parameter

  • nr_cpu : number of cpu.
  • nr_wp : number of watchpoint slot.
  • CC : compiler, gcc or clang.

How to use?

Add the static library libucsan.a to your project:

$ gcc -c main.c -fsanitize=thread
$ gcc -o main main.o -L/path/to/libucsan/ -lucsan -rdynamic -pthread

Or you can move the libucsan.a to your project directory. Then:

$ gcc -c main.c -fsanitize=thread
$ gcc -o main main.o libucsan.a -rdynamic -pthread

About

The User Concurrency Sanitizer (UCSAN)

License:MIT License


Languages

Language:C 88.8%Language:Shell 8.6%Language:Makefile 2.6%