1
0
Fork 0

checkasm: add helper to report a fatal signal

This commit is contained in:
Rémi Denis-Courmont 2023-11-16 17:45:02 +02:00
parent 0fa421c8f1
commit 286d674221
2 changed files with 12 additions and 4 deletions

View File

@ -23,10 +23,8 @@
#include "config.h"
#include "config_components.h"
#if CONFIG_LINUX_PERF
# ifndef _GNU_SOURCE
# define _GNU_SOURCE // for syscall (performance monitoring API)
# endif
#ifndef _GNU_SOURCE
# define _GNU_SOURCE // for syscall (performance monitoring API), strsignal()
#endif
#include <stdarg.h>
@ -863,6 +861,15 @@ void checkasm_fail_func(const char *msg, ...)
}
}
void checkasm_fail_signal(int signum)
{
#ifdef __GLIBC__
checkasm_fail_func("fatal signal %d: %s", signum, strsignal(signum));
#else
checkasm_fail_func("fatal signal %d", signum);
#endif
}
/* Get the benchmark context of the current function */
CheckasmPerf *checkasm_get_perf_context(void)
{

View File

@ -102,6 +102,7 @@ struct CheckasmPerf;
void *checkasm_check_func(void *func, const char *name, ...) av_printf_format(2, 3);
int checkasm_bench_func(void);
void checkasm_fail_func(const char *msg, ...) av_printf_format(1, 2);
void checkasm_fail_signal(int signum);
struct CheckasmPerf *checkasm_get_perf_context(void);
void checkasm_report(const char *name, ...) av_printf_format(1, 2);