]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: debug: dump the whole trace if we can't spot the starting point
authorWilly Tarreau <w@1wt.eu>
Wed, 4 Mar 2020 06:39:32 +0000 (07:39 +0100)
committerWilly Tarreau <w@1wt.eu>
Wed, 4 Mar 2020 11:04:07 +0000 (12:04 +0100)
Instead of special-casing the use of the symbol resolving to decide
whether to dump a partial or complete trace, let's simply start over
and dump everything when we reach the end after having found nothing.
It will be more robust against dirty traces as well.

src/debug.c

index 1fbcde7c43e3581d02fe17fb1e1a7cef2b566608..c01f7949485eedc7d88d1e11776c91374721dc0b 100644 (file)
@@ -108,14 +108,15 @@ void ha_thread_dump(struct buffer *buf, int thr, int calling_tid)
                if (nptrs)
                        chunk_appendf(buf, "             call trace(%d):\n", nptrs);
 
-#ifndef USE_DL
-               /* if we can't rely on dladdr1() we won't figure what level is
-                * in ha_panic() or ha_thread_dump_all_to_trash(), so we want
-                * to immediately start the dump.
-                */
-               dump = 2;
-#endif
-               for (j = 0; j < nptrs; j++) {
+               for (j = 0; j < nptrs || dump < 2; j++) {
+                       if (j == nptrs && !dump) {
+                               /* we failed to spot the starting point of the
+                                * dump, let's start over dumping everything we
+                                * have.
+                                */
+                               dump = 2;
+                               j = 0;
+                       }
                        bak = *buf;
                        dump_addr_and_bytes(buf, "             | ", callers[j], 8);
                        addr = resolve_sym_name(buf, ": ", callers[j]);