Skip to content

3. UFO Tracing In Depth

Andrew Chin edited this page May 2, 2019 · 4 revisions

During runtime, when an event occurs (memory reads and writes, function entry and exit, memory allocation and deallocation, thread creation, start, end, and join, condition wait and signal, mutex lock and unlock, and fork), TSan calls a function to track races (although TSan is focused on memory reads/writes). By inserting calls to the UFO tracing library in these functions, we can generate traces as a program executes. Here are the locations of the calls we insert into the TSan RTL:

  • tsan_interface.cc
    • line 29 __tsan_init() --> we insert aser::ufo::init_ufo()
  • tsan_rtl.cc
    • line 409 Finalize() --> we insert aser::ufo::finish_ufo()
    • line 468 ForkBefore() --> we insert aser::ufo::before_fork()
    • line 778 MemoryAccess() --> we insert aser::ufo::on_mem_acc()
    • line 968 FuncEntry() --> we insert aser::ufo::enter_func()
    • line 996 FuncExit() --> we insert aser::ufo::exit_func()
  • tsan_mman.cc
    • line 193 OnUserAlloc() --> we insert aser::ufo::on_alloc()
    • line 206 OnUserFree() --> we insert aser::ufo::on_dealloc()
  • tsan_rtl_thread.cc
    • line 55 OnCreated() --> we insert aser::ufo::on_thread_created()
    • line 96 OnStarted() --> we insert aser::ufo::on_thread_start()
    • line 287 ThreadFinish() --> we insert aser::ufo::on_thread_end()
    • line 316 ThreadJoin() --> we insert aser::ufo::on_thread_join()
  • tsan_interceptors.cc
    • line 1052 we intercept pthread_cond_wait() --> we insert aser::ufo::on_cond_wait()
    • line 1080 we intercept pthread_cond_signal() --> we insert aser::ufo::on_cond_signal()
  • tsan_rtl_mutex.cc
    • line 59 MutexPostLock() --> we insert aser::ufo::on_mtx_lock()
    • line 219 MutexUnlock() --> we insert aser::ufo::on_mtx_unlock()

Clone this wiki locally