From: Willy Tarreau Date: Wed, 4 Mar 2020 05:01:40 +0000 (+0100) Subject: MINOR: debug: call backtrace() once upon startup X-Git-Tag: v2.1.5~50 X-Git-Url: http://git.haproxy.org/?a=commitdiff_plain;h=5ea6f15e8469d83998a39f28070de47cb8a99c3a;p=haproxy-2.1.git MINOR: debug: call backtrace() once upon startup Calling backtrace() will access libgcc at runtime. We don't want to do it after the chroot, so let's perform a first call to have it ready in memory for later use. (cherry picked from commit 0214b45a61cd7cfd59d729b23f497a687192cde6) Signed-off-by: Willy Tarreau --- diff --git a/src/debug.c b/src/debug.c index 4435fe3..bd9d6f3 100644 --- a/src/debug.c +++ b/src/debug.c @@ -719,6 +719,14 @@ static int init_debug() { struct sigaction sa; +#ifdef USE_BACKTRACE + /* calling backtrace() will access libgcc at runtime. We don't want to + * do it after the chroot, so let's perform a first call to have it + * ready in memory for later use. + */ + void *callers[1]; + backtrace(callers, sizeof(callers)/sizeof(*callers)); +#endif sa.sa_handler = NULL; sa.sa_sigaction = debug_handler; sigemptyset(&sa.sa_mask);