]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: debug: call backtrace() once upon startup
authorWilly Tarreau <w@1wt.eu>
Wed, 4 Mar 2020 05:01:40 +0000 (06:01 +0100)
committerWilly Tarreau <w@1wt.eu>
Wed, 4 Mar 2020 05:01:40 +0000 (06:01 +0100)
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.

src/debug.c

index 6b41fc3910ba4be494c1cd17c3f8ec1db1078f84..ec905377bde540d393f71634fcf78f06d86417e6 100644 (file)
@@ -764,6 +764,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);