segfault-raub

Catches SIGSEGV and prints diagnostic information

Usage no npm install needed!

<script type="module">
  import segfaultRaub from 'https://cdn.skypack.dev/segfault-raub';
</script>

README

Segfault handler for Node.js

This is a part of Node3D project.

NPM CodeFactor

npm i segfault-raub

Synopsis

This module does nothing (zero perf impact) as long as Node is well-behaved. If a SIGSEGV signal is raised, the module will print a native stack trace to both STDERR and to the "segfault.log" file (if exists). If there is no such file, it won't be created, so it is up to you if the log-file is needed.

Note: this addon uses N-API, and therefore is ABI-compatible across different Node.js versions. Addon binaries are precompiled and there is no compilation step during the npm i command.

Usage

Just require the module and that's it. You may require it as many times you want, but the SIGSEGV hook will only be set once. There are no calls required, and no options.

require('segfault-raub');

There is one exported function though:

const { causeSegfault } = require('segfault-raub');
causeSegfault();

In doing so, you will cause a segfault (accessing 0x01 pointer), and see how it goes.

Legal notice

This is a fork of segfault-handler. The original licensing rules seem to apply, presumably (LICENSE is kept untouched).

This software is licensed for use under the BSD-3 Clause license.

Also this project uses callstack walker which is licensed under BSD-2 Clause.