Centralise fault handling

This should be done as all platforms essentially did the same anyway and there was nothing platform specific.
This commit is contained in:
Benny Baumann 2020-10-03 17:53:15 +02:00 committed by cgzones
parent b47bc667a2
commit 601480003f
18 changed files with 115 additions and 335 deletions

112
CRT.c
View File

@ -18,8 +18,13 @@ in the source distribution for its full text.
#include <string.h> #include <string.h>
#include <locale.h> #include <locale.h>
#include <langinfo.h> #include <langinfo.h>
#ifdef HAVE_SETUID_ENABLED
#include <unistd.h> #include <unistd.h>
#ifdef HAVE_EXECINFO_H
#include <execinfo.h>
#endif
#ifdef HAVE_SETUID_ENABLED
#include <sys/types.h> #include <sys/types.h>
#endif #endif
@ -545,8 +550,6 @@ char* CRT_termType;
int CRT_colorScheme = 0; int CRT_colorScheme = 0;
void *backtraceArray[128];
ATTR_NORETURN ATTR_NORETURN
static void CRT_handleSIGTERM(int sgn) { static void CRT_handleSIGTERM(int sgn) {
(void) sgn; (void) sgn;
@ -591,9 +594,9 @@ void CRT_restorePrivileges() {
#endif /* HAVE_SETUID_ENABLED */ #endif /* HAVE_SETUID_ENABLED */
// TODO: pass an instance of Settings instead. static struct sigaction old_sig_handler[32];
struct sigaction old_sigsegv_handler; // TODO: pass an instance of Settings instead.
void CRT_init(int delay, int colorScheme, bool allowUnicode) { void CRT_init(int delay, int colorScheme, bool allowUnicode) {
initscr(); initscr();
@ -650,9 +653,15 @@ void CRT_init(int delay, int colorScheme, bool allowUnicode) {
struct sigaction act; struct sigaction act;
sigemptyset (&act.sa_mask); sigemptyset (&act.sa_mask);
act.sa_flags = (int)SA_RESETHAND; act.sa_flags = (int)SA_RESETHAND|SA_NODEFER;
act.sa_handler = CRT_handleSIGSEGV; act.sa_handler = CRT_handleSIGSEGV;
sigaction (SIGSEGV, &act, &old_sigsegv_handler); sigaction (SIGSEGV, &act, &old_sig_handler[SIGSEGV]);
sigaction (SIGFPE, &act, &old_sig_handler[SIGFPE]);
sigaction (SIGILL, &act, &old_sig_handler[SIGILL]);
sigaction (SIGBUS, &act, &old_sig_handler[SIGBUS]);
sigaction (SIGPIPE, &act, &old_sig_handler[SIGPIPE]);
sigaction (SIGSYS, &act, &old_sig_handler[SIGSYS]);
sigaction (SIGABRT, &act, &old_sig_handler[SIGABRT]);
signal(SIGTERM, CRT_handleSIGTERM); signal(SIGTERM, CRT_handleSIGTERM);
signal(SIGQUIT, CRT_handleSIGTERM); signal(SIGQUIT, CRT_handleSIGTERM);
@ -740,3 +749,92 @@ void CRT_setColors(int colorScheme) {
CRT_colors = CRT_colorSchemes[colorScheme]; CRT_colors = CRT_colorSchemes[colorScheme];
} }
void CRT_handleSIGSEGV(int signal) {
CRT_done();
fprintf(stderr, "\n\n"
"FATAL PROGRAM ERROR DETECTED\n"
"============================\n"
"Please check at https://htop.dev/issues whether this issue has already been reported.\n"
"If no similar issue has been reported before, please create a new issue with the following information:\n"
"\n"
"- Your htop version (htop --version)\n"
"- Your OS and kernel version (uname -a)\n"
"- Your distribution and release (lsb_release -a)\n"
"- Likely steps to reproduce (How did it happened?)\n"
#ifdef HAVE_EXECINFO_H
"- Backtrace of the issue (see below)\n"
#endif
"\n"
);
const char* signal_str = strsignal(signal);
if(!signal_str) {
signal_str = "unknown reason";
}
fprintf(stderr,
"Error information:\n"
"------------------\n"
"A signal %d (%s) was received.\n"
"\n",
signal, signal_str
);
#ifdef HAVE_EXECINFO_H
fprintf(stderr,
"Backtrace information:\n"
"----------------------\n"
"The following function calls were active when the issue was detected:\n"
"---\n"
);
void *backtraceArray[256];
size_t size = backtrace(backtraceArray, ARRAYSIZE(backtraceArray));
backtrace_symbols_fd(backtraceArray, size, 2);
fprintf(stderr,
"---\n"
"\n"
"To make the above information more practical to work with,\n"
"you should provide a disassembly of your binary.\n"
"This can usually be done by running the following command:\n"
"\n"
#ifdef HTOP_DARWIN
" otool -tvV `which htop` > ~/htop.otool\n"
#else
" objdump -d -S -w `which htop` > ~/htop.objdump\n"
#endif
"\n"
"Please include the generated file in your report.\n"
"\n"
);
#endif
fprintf(stderr,
"Running this program with debug symbols or inside a debugger may provide further insights.\n"
"\n"
"Thank you for helping to improve htop!\n"
"\n"
"htop " VERSION " aborting.\n"
"\n"
);
/* Call old sigsegv handler; may be default exit or third party one (e.g. ASAN) */
if(sigaction (signal, &old_sig_handler[signal], NULL) < 0) {
/* This avoids an infinite loop in case the handler could not be reset. */
fprintf(stderr,
"!!! Chained handler could not be restored. Forcing exit.\n"
);
_exit(1);
}
/* Trigger the previous signal handler. */
raise(signal);
// Always terminate, even if installed handler returns
fprintf(stderr,
"!!! Chained handler did not exit. Forcing exit.\n"
);
_exit(1);
}

5
CRT.h
View File

@ -117,8 +117,7 @@ typedef enum ColorElements_ {
void CRT_fatalError(const char* note) ATTR_NORETURN; void CRT_fatalError(const char* note) ATTR_NORETURN;
extern struct sigaction old_sigsegv_handler; void CRT_handleSIGSEGV(int signal) ATTR_NORETURN;
void CRT_handleSIGSEGV(int sgn);
#define KEY_ALT(x) (KEY_F(64 - 26) + (x - 'A')) #define KEY_ALT(x) (KEY_F(64 - 26) + (x - 'A'))
@ -147,8 +146,6 @@ extern char* CRT_termType;
extern int CRT_colorScheme; extern int CRT_colorScheme;
extern void *backtraceArray[128];
#ifdef HAVE_SETUID_ENABLED #ifdef HAVE_SETUID_ENABLED
void CRT_dropPrivileges(void); void CRT_dropPrivileges(void);

View File

@ -124,7 +124,6 @@ linux_platform_headers = \
linux/IOPriority.h \ linux/IOPriority.h \
linux/LinuxProcess.h \ linux/LinuxProcess.h \
linux/LinuxProcessList.h \ linux/LinuxProcessList.h \
linux/LinuxCRT.h \
linux/Battery.h \ linux/Battery.h \
linux/PressureStallMeter.h \ linux/PressureStallMeter.h \
zfs/ZfsArcMeter.h \ zfs/ZfsArcMeter.h \
@ -134,7 +133,7 @@ linux_platform_headers = \
if HTOP_LINUX if HTOP_LINUX
AM_LDFLAGS += -rdynamic AM_LDFLAGS += -rdynamic
myhtopplatsources = linux/Platform.c linux/IOPriorityPanel.c \ myhtopplatsources = linux/Platform.c linux/IOPriorityPanel.c \
linux/LinuxProcess.c linux/LinuxProcessList.c linux/LinuxCRT.c linux/Battery.c \ linux/LinuxProcess.c linux/LinuxProcessList.c linux/Battery.c \
linux/PressureStallMeter.c \ linux/PressureStallMeter.c \
zfs/ZfsArcMeter.c zfs/ZfsCompressedArcMeter.c zfs/ZfsArcStats.c zfs/ZfsArcMeter.c zfs/ZfsCompressedArcMeter.c zfs/ZfsArcStats.c
@ -148,7 +147,6 @@ freebsd_platform_headers = \
freebsd/Platform.h \ freebsd/Platform.h \
freebsd/FreeBSDProcessList.h \ freebsd/FreeBSDProcessList.h \
freebsd/FreeBSDProcess.h \ freebsd/FreeBSDProcess.h \
freebsd/FreeBSDCRT.h \
freebsd/Battery.h \ freebsd/Battery.h \
zfs/ZfsArcMeter.h \ zfs/ZfsArcMeter.h \
zfs/ZfsCompressedArcMeter.h \ zfs/ZfsCompressedArcMeter.h \
@ -156,8 +154,9 @@ freebsd_platform_headers = \
zfs/openzfs_sysctl.h zfs/openzfs_sysctl.h
if HTOP_FREEBSD if HTOP_FREEBSD
AM_LDFLAGS += -lexecinfo
myhtopplatsources = freebsd/Platform.c freebsd/FreeBSDProcessList.c \ myhtopplatsources = freebsd/Platform.c freebsd/FreeBSDProcessList.c \
freebsd/FreeBSDProcess.c freebsd/FreeBSDCRT.c freebsd/Battery.c \ freebsd/FreeBSDProcess.c freebsd/Battery.c \
zfs/ZfsArcMeter.c zfs/ZfsCompressedArcMeter.c zfs/ZfsArcStats.c zfs/openzfs_sysctl.c zfs/ZfsArcMeter.c zfs/ZfsCompressedArcMeter.c zfs/ZfsArcStats.c zfs/openzfs_sysctl.c
myhtopplatheaders = $(freebsd_platform_headers) myhtopplatheaders = $(freebsd_platform_headers)
@ -170,13 +169,12 @@ dragonflybsd_platform_headers = \
dragonflybsd/Platform.h \ dragonflybsd/Platform.h \
dragonflybsd/DragonFlyBSDProcessList.h \ dragonflybsd/DragonFlyBSDProcessList.h \
dragonflybsd/DragonFlyBSDProcess.h \ dragonflybsd/DragonFlyBSDProcess.h \
dragonflybsd/DragonFlyBSDCRT.h \
dragonflybsd/Battery.h dragonflybsd/Battery.h
if HTOP_DRAGONFLYBSD if HTOP_DRAGONFLYBSD
AM_LDFLAGS += -lkvm -lkinfo -lexecinfo AM_LDFLAGS += -lkvm -lkinfo -lexecinfo
myhtopplatsources = dragonflybsd/Platform.c dragonflybsd/DragonFlyBSDProcessList.c \ myhtopplatsources = dragonflybsd/Platform.c dragonflybsd/DragonFlyBSDProcessList.c \
dragonflybsd/DragonFlyBSDProcess.c dragonflybsd/DragonFlyBSDCRT.c dragonflybsd/Battery.c dragonflybsd/DragonFlyBSDProcess.c dragonflybsd/Battery.c
myhtopplatheaders = $(dragonflybsd_platform_headers) myhtopplatheaders = $(dragonflybsd_platform_headers)
endif endif
@ -188,12 +186,11 @@ openbsd_platform_headers = \
openbsd/Platform.h \ openbsd/Platform.h \
openbsd/OpenBSDProcessList.h \ openbsd/OpenBSDProcessList.h \
openbsd/OpenBSDProcess.h \ openbsd/OpenBSDProcess.h \
openbsd/OpenBSDCRT.h \
openbsd/Battery.h openbsd/Battery.h
if HTOP_OPENBSD if HTOP_OPENBSD
myhtopplatsources = openbsd/Platform.c openbsd/OpenBSDProcessList.c \ myhtopplatsources = openbsd/Platform.c openbsd/OpenBSDProcessList.c \
openbsd/OpenBSDProcess.c openbsd/OpenBSDCRT.c openbsd/Battery.c openbsd/OpenBSDProcess.c openbsd/Battery.c
myhtopplatheaders = $(openbsd_platform_headers) myhtopplatheaders = $(openbsd_platform_headers)
endif endif
@ -205,7 +202,6 @@ darwin_platform_headers = \
darwin/Platform.h \ darwin/Platform.h \
darwin/DarwinProcess.h \ darwin/DarwinProcess.h \
darwin/DarwinProcessList.h \ darwin/DarwinProcessList.h \
darwin/DarwinCRT.h \
darwin/Battery.h \ darwin/Battery.h \
zfs/ZfsArcMeter.h \ zfs/ZfsArcMeter.h \
zfs/ZfsCompressedArcMeter.h \ zfs/ZfsCompressedArcMeter.h \
@ -215,7 +211,7 @@ darwin_platform_headers = \
if HTOP_DARWIN if HTOP_DARWIN
AM_LDFLAGS += -framework IOKit -framework CoreFoundation AM_LDFLAGS += -framework IOKit -framework CoreFoundation
myhtopplatsources = darwin/Platform.c darwin/DarwinProcess.c \ myhtopplatsources = darwin/Platform.c darwin/DarwinProcess.c \
darwin/DarwinProcessList.c darwin/DarwinCRT.c darwin/Battery.c \ darwin/DarwinProcessList.c darwin/Battery.c \
zfs/ZfsArcMeter.c zfs/ZfsCompressedArcMeter.c zfs/ZfsArcStats.c zfs/openzfs_sysctl.c zfs/ZfsArcMeter.c zfs/ZfsCompressedArcMeter.c zfs/ZfsArcStats.c zfs/openzfs_sysctl.c
myhtopplatheaders = $(darwin_platform_headers) myhtopplatheaders = $(darwin_platform_headers)
@ -228,7 +224,6 @@ solaris_platform_headers = \
solaris/Platform.h \ solaris/Platform.h \
solaris/SolarisProcess.h \ solaris/SolarisProcess.h \
solaris/SolarisProcessList.h \ solaris/SolarisProcessList.h \
solaris/SolarisCRT.h \
solaris/Battery.h \ solaris/Battery.h \
zfs/ZfsArcMeter.h \ zfs/ZfsArcMeter.h \
zfs/ZfsCompressedArcMeter.h \ zfs/ZfsCompressedArcMeter.h \
@ -237,7 +232,7 @@ solaris_platform_headers = \
if HTOP_SOLARIS if HTOP_SOLARIS
myhtopplatsources = solaris/Platform.c \ myhtopplatsources = solaris/Platform.c \
solaris/SolarisProcess.c solaris/SolarisProcessList.c \ solaris/SolarisProcess.c solaris/SolarisProcessList.c \
solaris/SolarisCRT.c solaris/Battery.c \ solaris/Battery.c \
zfs/ZfsArcMeter.c zfs/ZfsCompressedArcMeter.c zfs/ZfsArcStats.c zfs/ZfsArcMeter.c zfs/ZfsCompressedArcMeter.c zfs/ZfsArcStats.c
myhtopplatheaders = $(solaris_platform_headers) myhtopplatheaders = $(solaris_platform_headers)
@ -250,13 +245,12 @@ unsupported_platform_headers = \
unsupported/Platform.h \ unsupported/Platform.h \
unsupported/UnsupportedProcess.h \ unsupported/UnsupportedProcess.h \
unsupported/UnsupportedProcessList.h \ unsupported/UnsupportedProcessList.h \
unsupported/UnsupportedCRT.h \
unsupported/Battery.h unsupported/Battery.h
if HTOP_UNSUPPORTED if HTOP_UNSUPPORTED
myhtopplatsources = unsupported/Platform.c \ myhtopplatsources = unsupported/Platform.c \
unsupported/UnsupportedProcess.c unsupported/UnsupportedProcessList.c \ unsupported/UnsupportedProcess.c unsupported/UnsupportedProcessList.c \
unsupported/UnsupportedCRT.c unsupported/Battery.c unsupported/Battery.c
myhtopplatheaders = $(unsupported_platform_headers) myhtopplatheaders = $(unsupported_platform_headers)
endif endif

View File

@ -14,7 +14,7 @@
void fail() { void fail() {
curs_set(1); curs_set(1);
endwin(); endwin();
err(1, NULL); abort();
} }
void* xMalloc(size_t size) { void* xMalloc(size_t size) {

View File

@ -1,35 +0,0 @@
/*
htop - DarwinCRT.c
(C) 2014 Hisham H. Muhammad
Released under the GNU GPLv2, see the COPYING file
in the source distribution for its full text.
*/
#include "config.h"
#include "DarwinCRT.h"
#include "CRT.h"
#include <stdio.h>
#include <stdlib.h>
#include <execinfo.h>
void CRT_handleSIGSEGV(int sgn) {
(void) sgn;
CRT_done();
#ifdef __APPLE__
fprintf(stderr, "\n\nhtop " VERSION " aborting. Please report bug at https://htop.dev\n");
#ifdef HAVE_EXECINFO_H
size_t size = backtrace(backtraceArray, sizeof(backtraceArray) / sizeof(void *));
fprintf(stderr, "\n Please include in your report the following backtrace: \n");
backtrace_symbols_fd(backtraceArray, size, 2);
fprintf(stderr, "\nAdditionally, in order to make the above backtrace useful,");
fprintf(stderr, "\nplease also run the following command to generate a disassembly of your binary:");
fprintf(stderr, "\n\n otool -tvV `which htop` > ~/htop.otool");
fprintf(stderr, "\n\nand then attach the file ~/htop.otool to your bug report.");
fprintf(stderr, "\n\nThank you for helping to improve htop!\n\n");
#endif
#else
fprintf(stderr, "\nUnfortunately, you seem to be using an unsupported platform!");
fprintf(stderr, "\nPlease contact your platform package maintainer!\n\n");
#endif
abort();
}

View File

@ -1,14 +0,0 @@
#ifndef HEADER_DarwinCRT
#define HEADER_DarwinCRT
/*
htop - DarwinCRT.h
(C) 2014 Hisham H. Muhammad
Released under the GNU GPLv2, see the COPYING file
in the source distribution for its full text.
*/
#include "Macros.h"
void CRT_handleSIGSEGV(int sgn) ATTR_NORETURN;
#endif

View File

@ -1,35 +0,0 @@
/*
htop - dragonflybsd/DragonFlyBSDCRT.c
(C) 2014 Hisham H. Muhammad
(C) 2017 Diederik de Groot
Released under the GNU GPLv2, see the COPYING file
in the source distribution for its full text.
*/
#include "config.h"
#include "DragonFlyBSDCRT.h"
#include "CRT.h"
#include <stdio.h>
#include <stdlib.h>
#ifdef HAVE_EXECINFO_H
#include <execinfo.h>
#endif
void CRT_handleSIGSEGV(int sgn) {
(void) sgn;
CRT_done();
fprintf(stderr, "\n\nhtop " VERSION " aborting. Please report bug at https://htop.dev\n");
#ifdef HAVE_EXECINFO_H
size_t size = backtrace(backtraceArray, sizeof(backtraceArray) / sizeof(void *));
fprintf(stderr, "\n Please include in your report the following backtrace: \n");
backtrace_symbols_fd(backtraceArray, size, 2);
fprintf(stderr, "\nAdditionally, in order to make the above backtrace useful,");
fprintf(stderr, "\nplease also run the following command to generate a disassembly of your binary:");
fprintf(stderr, "\n\n objdump -d `which htop` > ~/htop.objdump");
fprintf(stderr, "\n\nand then attach the file ~/htop.objdump to your bug report.");
fprintf(stderr, "\n\nThank you for helping to improve htop!\n\n");
#else
fprintf(stderr, "\nPlease contact your DragonFlyBSD package maintainer!\n\n");
#endif
abort();
}

View File

@ -1,15 +0,0 @@
#ifndef HEADER_DragonFlyBSDCRT
#define HEADER_DragonFlyBSDCRT
/*
htop - dragonflybsd/DragonFlyBSDCRT.h
(C) 2014 Hisham H. Muhammad
(C) 2017 Diederik de Groot
Released under the GNU GPLv2, see the COPYING file
in the source distribution for its full text.
*/
#include "Macros.h"
void CRT_handleSIGSEGV(int sgn) ATTR_NORETURN;
#endif

View File

@ -1,21 +0,0 @@
/*
htop - FreeBSDCRT.c
(C) 2014 Hisham H. Muhammad
Released under the GNU GPLv2, see the COPYING file
in the source distribution for its full text.
*/
#include "config.h"
#include "FreeBSDCRT.h"
#include "CRT.h"
#include <stdio.h>
#include <stdlib.h>
void CRT_handleSIGSEGV(int sgn) {
(void) sgn;
CRT_done();
fprintf(stderr, "\n\nhtop " VERSION " aborting.\n");
fprintf(stderr, "\nUnfortunately, you seem to be using an unsupported platform!");
fprintf(stderr, "\nPlease contact your platform package maintainer!\n\n");
abort();
}

View File

@ -1,14 +0,0 @@
#ifndef HEADER_FreeBSDCRT
#define HEADER_FreeBSDCRT
/*
htop - FreeBSDCRT.h
(C) 2014 Hisham H. Muhammad
Released under the GNU GPLv2, see the COPYING file
in the source distribution for its full text.
*/
#include "Macros.h"
void CRT_handleSIGSEGV(int sgn) ATTR_NORETURN;
#endif

View File

@ -1,41 +0,0 @@
/*
htop - LinuxCRT.c
(C) 2014 Hisham H. Muhammad
Released under the GNU GPLv2, see the COPYING file
in the source distribution for its full text.
*/
#include "config.h"
#include "LinuxCRT.h"
#include "CRT.h"
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#ifdef HAVE_EXECINFO_H
#include <execinfo.h>
#endif
void CRT_handleSIGSEGV(int sgn) {
(void) sgn;
CRT_done();
#ifdef __linux
fprintf(stderr, "\n\nhtop " VERSION " aborting. Please report bug at https://htop.dev\n");
#ifdef HAVE_EXECINFO_H
size_t size = backtrace(backtraceArray, ARRAYSIZE(backtraceArray));
fprintf(stderr, "\n Please include in your report the following backtrace: \n");
backtrace_symbols_fd(backtraceArray, size, 2);
fprintf(stderr, "\nAdditionally, in order to make the above backtrace useful,");
fprintf(stderr, "\nplease also run the following command to generate a disassembly of your binary:");
fprintf(stderr, "\n\n objdump -d `which htop` > ~/htop.objdump");
fprintf(stderr, "\n\nand then attach the file ~/htop.objdump to your bug report.");
fprintf(stderr, "\n\nThank you for helping to improve htop!\n\n");
#endif
#else
fprintf(stderr, "\nUnfortunately, you seem to be using an unsupported platform!");
fprintf(stderr, "\nPlease contact your platform package maintainer!\n\n");
#endif
/* Call old sigsegv handler; may be default exit or third party one (e.g. ASAN) */
sigaction (SIGSEGV, &old_sigsegv_handler, NULL);
}

View File

@ -1,14 +0,0 @@
#ifndef HEADER_LinuxCRT
#define HEADER_LinuxCRT
/*
htop - LinuxCRT.h
(C) 2014 Hisham H. Muhammad
Released under the GNU GPLv2, see the COPYING file
in the source distribution for its full text.
*/
#include "Macros.h"
void CRT_handleSIGSEGV(int sgn);
#endif

View File

@ -1,22 +0,0 @@
/*
htop - OpenBSDCRT.c
(C) 2014 Hisham H. Muhammad
(C) 2015 Michael McConville
Released under the GNU GPLv2, see the COPYING file
in the source distribution for its full text.
*/
#include "config.h"
#include "OpenBSDCRT.h"
#include "CRT.h"
#include <stdio.h>
#include <stdlib.h>
void CRT_handleSIGSEGV(int sgn) {
(void) sgn;
CRT_done();
fprintf(stderr, "\n\nhtop " VERSION " aborting.\n");
fprintf(stderr, "\nUnfortunately, you seem to be using an unsupported platform!");
fprintf(stderr, "\nPlease contact your platform package maintainer!\n\n");
abort();
}

View File

@ -1,15 +0,0 @@
#ifndef HEADER_OpenBSDCRT
#define HEADER_OpenBSDCRT
/*
htop - OpenBSDCRT.h
(C) 2014 Hisham H. Muhammad
(C) 2015 Michael McConville
Released under the GNU GPLv2, see the COPYING file
in the source distribution for its full text.
*/
#include "Macros.h"
void CRT_handleSIGSEGV(int sgn) ATTR_NORETURN;
#endif

View File

@ -1,33 +0,0 @@
/*
htop - SolarisCRT.c
(C) 2014 Hisham H. Muhammad
(C) 2018 Guy M. Broome
Released under the GNU GPLv2, see the COPYING file
in the source distribution for its full text.
*/
#include "config.h"
#include "SolarisCRT.h"
#include "CRT.h"
#include <stdio.h>
#include <stdlib.h>
#ifdef HAVE_EXECINFO_H
#include <execinfo.h>
#endif
void CRT_handleSIGSEGV(int sgn) {
(void) sgn;
CRT_done();
fprintf(stderr, "\n\nhtop " VERSION " aborting. Please report bug at https://htop.dev\n");
#ifdef HAVE_EXECINFO_H
size_t size = backtrace(backtraceArray, sizeof(backtraceArray) / sizeof(void *));
fprintf(stderr, "\n Please include in your report the following backtrace: \n");
backtrace_symbols_fd(backtraceArray, size, 2);
fprintf(stderr, "\nAdditionally, in order to make the above backtrace useful,");
fprintf(stderr, "\nplease also run the following command to generate a disassembly of your binary:");
fprintf(stderr, "\n\n objdump -d `which htop` > ~/htop.objdump");
fprintf(stderr, "\n\nand then attach the file ~/htop.objdump to your bug report.");
fprintf(stderr, "\n\nThank you for helping to improve htop!\n\n");
#endif
abort();
}

View File

@ -1,15 +0,0 @@
#ifndef HEADER_SolarisCRT
#define HEADER_SolarisCRT
/*
htop - SolarisCRT.h
(C) 2014 Hisham H. Muhammad
(C) 2018 Guy M. Broome
Released under the GNU GPLv2, see the COPYING file
in the source distribution for its full text.
*/
#include "Macros.h"
void CRT_handleSIGSEGV(int sgn) ATTR_NORETURN;
#endif

View File

@ -1,21 +0,0 @@
/*
htop - UnsupportedCRT.c
(C) 2014 Hisham H. Muhammad
Released under the GNU GPLv2, see the COPYING file
in the source distribution for its full text.
*/
#include "config.h"
#include "UnsupportedCRT.h"
#include "CRT.h"
#include <stdio.h>
#include <stdlib.h>
void CRT_handleSIGSEGV(int sgn) {
(void) sgn;
CRT_done();
fprintf(stderr, "\n\nhtop " VERSION " aborting.\n");
fprintf(stderr, "\nUnfortunately, you seem to be using an unsupported platform!");
fprintf(stderr, "\nPlease contact your platform package maintainer!\n\n");
abort();
}

View File

@ -1,14 +0,0 @@
#ifndef HEADER_UnsupportedCRT
#define HEADER_UnsupportedCRT
/*
htop - UnsupportedCRT.h
(C) 2014 Hisham H. Muhammad
Released under the GNU GPLv2, see the COPYING file
in the source distribution for its full text.
*/
#include "Macros.h"
void CRT_handleSIGSEGV(int sgn) ATTR_NORETURN;
#endif