From 61341b422a3793fc2527ba5a553738a8524b16a8 Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Wed, 4 Mar 2020 07:39:32 +0100 Subject: [PATCH] MINOR: debug: dump the whole trace if we can't spot the starting point 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. (cherry picked from commit a91b7946bdd69fd837085f67f085565317efb1b1) Signed-off-by: Willy Tarreau --- src/debug.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/debug.c b/src/debug.c index 7d36b0d..e1cd500 100644 --- a/src/debug.c +++ b/src/debug.c @@ -105,14 +105,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]); -- 1.7.10.4