Skip to content

Commit

Permalink
Precise which processus on which host triggered a segfault
Browse files Browse the repository at this point in the history
  • Loading branch information
philippemilink committed Mar 6, 2025
1 parent 2a0e913 commit af68b76
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
3 changes: 2 additions & 1 deletion include/starpu_util.h
Original file line number Diff line number Diff line change
Expand Up @@ -193,12 +193,13 @@ extern "C" {
#endif /* __GNUC__ */

#define STARPU_BACKTRACE_LENGTH 32
#define STARPU_BACKTRACE_FILE stderr
#ifdef __GLIBC__
#define STARPU_DUMP_BACKTRACE() \
do { \
void *__ptrs[STARPU_BACKTRACE_LENGTH]; \
int __n = backtrace(__ptrs, STARPU_BACKTRACE_LENGTH); \
backtrace_symbols_fd(__ptrs, __n, 2); \
backtrace_symbols_fd(__ptrs, __n, fileno(STARPU_BACKTRACE_FILE)); \
} \
while (0)
#else
Expand Down
5 changes: 5 additions & 0 deletions src/core/workers.c
Original file line number Diff line number Diff line change
Expand Up @@ -1452,7 +1452,12 @@ void _starpu_handler(int sig)
}
if (sig == SIGSEGV)
{
char real_hostname[128];
gethostname(real_hostname, sizeof(real_hostname));
fprintf(STARPU_BACKTRACE_FILE, "SIGSEGV on %s PID %d\n", real_hostname, getpid());
STARPU_DUMP_BACKTRACE();
fflush(STARPU_BACKTRACE_FILE);

void (*sig_act)(int) = act_sigsegv;
if (sig_act == NULL)
sig_act = SIG_DFL;
Expand Down

0 comments on commit af68b76

Please sign in to comment.