.. | .. |
---|
47 | 47 | |
---|
48 | 48 | NOTE this description is omitting other libraries involved, only |
---|
49 | 49 | focusing on build framework outcomes |
---|
| 50 | + |
---|
| 51 | +3) Build with ASan or UBSan |
---|
| 52 | +========================== |
---|
| 53 | + $ cd tools/perf |
---|
| 54 | + $ make DESTDIR=/usr |
---|
| 55 | + $ make DESTDIR=/usr install |
---|
| 56 | + |
---|
| 57 | +AddressSanitizer (or ASan) is a GCC feature that detects memory corruption bugs |
---|
| 58 | +such as buffer overflows and memory leaks. |
---|
| 59 | + |
---|
| 60 | + $ cd tools/perf |
---|
| 61 | + $ make DEBUG=1 EXTRA_CFLAGS='-fno-omit-frame-pointer -fsanitize=address' |
---|
| 62 | + $ ASAN_OPTIONS=log_path=asan.log ./perf record -a |
---|
| 63 | + |
---|
| 64 | +ASan outputs all detected issues into a log file named 'asan.log.<pid>'. |
---|
| 65 | + |
---|
| 66 | +UndefinedBehaviorSanitizer (or UBSan) is a fast undefined behavior detector |
---|
| 67 | +supported by GCC. UBSan detects undefined behaviors of programs at runtime. |
---|
| 68 | + |
---|
| 69 | + $ cd tools/perf |
---|
| 70 | + $ make DEBUG=1 EXTRA_CFLAGS='-fno-omit-frame-pointer -fsanitize=undefined' |
---|
| 71 | + $ UBSAN_OPTIONS=print_stacktrace=1 ./perf record -a |
---|
| 72 | + |
---|
| 73 | +If UBSan detects any problem at runtime, it outputs a “runtime error:” message. |
---|