Skip to content

Commit

Permalink
Add a libFollySegFault.so convenience lib
Browse files Browse the repository at this point in the history
Summary:
As per glibc's `libSegFault.so`, provide a standalone DSO that
non-fbcode binaries can `LD_PRELOAD` to get symbolification
via folly's symbolizer on signals/crashes.

Reviewed By: mzlee

Differential Revision: D52861325

fbshipit-source-id: f26329a431ae1abeb0aba208c2d3fce6a84b080a
  • Loading branch information
andrewjcg authored and facebook-github-bot committed Jan 22, 2024
1 parent 311ca18 commit 1b30ddf
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
21 changes: 21 additions & 0 deletions folly/experimental/symbolizer/tool/LibSegFault.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

#include <folly/experimental/symbolizer/SignalHandler.h>

static void __attribute__((constructor)) install_handler(void) {
folly::symbolizer::installFatalSignalHandler();
}
4 changes: 4 additions & 0 deletions folly/experimental/symbolizer/tool/libFollySegFault.so.v
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
/* We don't export anything, since our constructor does all the work. */
local: *;
};

0 comments on commit 1b30ddf

Please sign in to comment.