[all-commits] [llvm/llvm-project] 9e80ad: [memprof] dump memprof profile when receive deadly...

Enna1 via All-commits all-commits at lists.llvm.org
Fri Oct 7 19:18:27 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 9e80add2cfa9bb03bbe77cca9adec18137204538
      https://github.com/llvm/llvm-project/commit/9e80add2cfa9bb03bbe77cca9adec18137204538
  Author: Enna1 <xumingjie.enna1 at bytedance.com>
  Date:   2022-10-08 (Sat, 08 Oct 2022)

  Changed paths:
    M compiler-rt/lib/memprof/memprof_rtl.cpp
    A compiler-rt/test/memprof/TestCases/memprof_profile_dump_on_abort.cpp

  Log Message:
  -----------
  [memprof] dump memprof profile when receive deadly signals

Currently memprof profile is dumped when program exits (call `FinishAndWrite()` in ~Allocator) or `__memprof_profile_dump` is manually called.
For programs that never exit (e.g. server-side application), it will be useful to dump memprof profile when specific signal is received.
This patch installs a signal handler for deadly signals(SIGSEGV, SIGBUS, SIGABRT, SIGILL, SIGTRAP, SIGFPE) like we do in other sanitizers. In the signal handler `__memprof_profile_dump` is called to dump memprof profile.

Reviewed By: tejohnson

Differential Revision: https://reviews.llvm.org/D134795




More information about the All-commits mailing list