[all-commits] [llvm/llvm-project] 4624e8: [Signal] Allow llvm clients to opt into one-shot S...

Vedant Kumar via All-commits all-commits at lists.llvm.org
Mon Nov 18 10:27:38 PST 2019


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 4624e83ce7b124545b55e45ba13f2d900ed65654
      https://github.com/llvm/llvm-project/commit/4624e83ce7b124545b55e45ba13f2d900ed65654
  Author: Vedant Kumar <vsk at apple.com>
  Date:   2019-11-18 (Mon, 18 Nov 2019)

  Changed paths:
    M lldb/tools/driver/Driver.cpp
    M lldb/tools/lldb-server/lldb-server.cpp
    M llvm/include/llvm/Support/InitLLVM.h
    M llvm/include/llvm/Support/Signals.h
    M llvm/lib/Support/InitLLVM.cpp
    M llvm/lib/Support/Unix/Signals.inc
    M llvm/lib/Support/Windows/Signals.inc

  Log Message:
  -----------
  [Signal] Allow llvm clients to opt into one-shot SIGPIPE handling

Allow clients of the llvm library to opt-in to one-shot SIGPIPE
handling, instead of forcing them to undo llvm's SIGPIPE handler
registration (which is brittle).

The current behavior is preserved for all llvm-derived tools (except
lldb) by means of a default-`true` flag in the InitLLVM constructor.

This prevents "IO error" crashes in long-lived processes (lldb is the
motivating example) which both a) load llvm as a dynamic library and b)
*really* need to ignore SIGPIPE.

As llvm signal handlers can be installed when calling into libclang
(say, via RemoveFileOnSignal), thereby overriding a previous SIG_IGN for
SIGPIPE, there is no clean way to opt-out of "exit-on-SIGPIPE" in the
current model.

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




More information about the All-commits mailing list