From e07c9ee575f3f666564f5d57d148a47d3bfb6372 Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Wed, 18 Mar 2026 13:39:23 +0100 Subject: [PATCH] MINOR: debug: copy debug symbols from /usr/lib/debug when present When set-dumpable=libs, let's also pick the debug symbols for the libs we're loading. For now we only try /usr/lib/debug/, which is quite common and easy to guess. Build IDs could also be used but are more complex to deal with, so let's stay simple for now. --- src/tools.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/tools.c b/src/tools.c index 390f5f3d5..879879c47 100644 --- a/src/tools.c +++ b/src/tools.c @@ -6057,6 +6057,15 @@ static int dl_collect_libs_cb(struct dl_phdr_info *info, size_t size, void *data goto leave; load_file_into_tar(&ctx->storage, &ctx->size, ctx->prefix, fname, NULL, "haproxy-libs-dump"); + + /* try to load equivalent debug symbols for absolute paths */ + if (*fname == '/') { + char dbg[PATH_MAX]; + + snprintf(dbg, sizeof(dbg), "/usr/lib/debug%s", fname); + load_file_into_tar(&ctx->storage, &ctx->size, ctx->prefix, dbg, NULL, "haproxy-libs-dump"); + } + leave: /* increment the object's number */ ctx->pos++;