Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename "sigfault" to "segfault" #10454

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion shell.nix
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,6 @@ pkgs.stdenv.mkDerivation rec {

LLVM_CONFIG = "${llvm_suite.llvm}/bin/llvm-config";

# ld: warning: object file (.../src/ext/libcrystal.a(sigfault.o)) was built for newer OSX version (10.14) than being linked (10.12)
# ld: warning: object file (.../src/ext/libcrystal.a(segfault.o)) was built for newer OSX version (10.14) than being linked (10.12)
MACOSX_DEPLOYMENT_TARGET = "10.11";
}
2 changes: 1 addition & 1 deletion src/ext.cr
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@[Link(ldflags: "#{__DIR__}/ext/libcrystal.a")]
lib LibExt
fun setup_sigfault_handler
fun setup_segfault_handler
end
10 changes: 5 additions & 5 deletions src/ext/sigfault.c → src/ext/segfault.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
#include <unistd.h>
#include <stdlib.h>

void __crystal_sigfault_handler(int sig, void *addr);
void __crystal_segfault_handler(int sig, void *addr);

void sigfault_handler(int sig, siginfo_t *info, void *data) {
__crystal_sigfault_handler(sig, info->si_addr);
void segfault_handler(int sig, siginfo_t *info, void *data) {
__crystal_segfault_handler(sig, info->si_addr);
}

void setup_sigfault_handler() {
void setup_segfault_handler() {
stack_t altstack;
struct sigaction action;

Expand All @@ -20,7 +20,7 @@ void setup_sigfault_handler() {

sigemptyset(&action.sa_mask);
action.sa_flags = SA_ONSTACK | SA_SIGINFO;
action.sa_sigaction = &sigfault_handler;
action.sa_sigaction = &segfault_handler;

sigaction(SIGSEGV, &action, NULL);
sigaction(SIGBUS, &action, NULL);
Expand Down
4 changes: 2 additions & 2 deletions src/kernel.cr
Original file line number Diff line number Diff line change
Expand Up @@ -535,12 +535,12 @@ end
end

Signal.setup_default_handlers
LibExt.setup_sigfault_handler
LibExt.setup_segfault_handler
{% end %}

{% if !flag?(:win32) %}
# load dwarf on start up of the program is executed with CRYSTAL_LOAD_DWARF=1
# this will make dwarf available on print_frame that is used on __crystal_sigfault_handler
# this will make dwarf available on print_frame that is used on __crystal_segfault_handler
#
# - CRYSTAL_LOAD_DWARF=0 will never use dwarf information (See Exception::CallStack.load_dwarf)
# - CRYSTAL_LOAD_DWARF=1 will load dwarf on startup
Expand Down
2 changes: 1 addition & 1 deletion src/signal.cr
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ module Crystal::SignalChildHandler
end

# :nodoc:
fun __crystal_sigfault_handler(sig : LibC::Int, addr : Void*)
fun __crystal_segfault_handler(sig : LibC::Int, addr : Void*)
# Capture fault signals (SEGV, BUS) and finish the process printing a backtrace first

# Determine if the SEGV was inside or 'near' the top of the stack
Expand Down