From 77012513dd15ff875a7ee1a9a80ee3259d9fac7e Mon Sep 17 00:00:00 2001 From: Serhei Makarov Date: Thu, 29 Aug 2024 10:45:46 -0400 Subject: [PATCH] eu-stacktrace fixup: report dwfltab overflow cleanly --- src/stacktrace.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/stacktrace.c b/src/stacktrace.c index 6a18bb2c..7c24ddb4 100644 --- a/src/stacktrace.c +++ b/src/stacktrace.c @@ -1166,11 +1166,17 @@ sysprof_unwind_cb (SysprofCaptureFrame *frame, void *arg) { /* For final diagnostics. */ dwfltab_ent *dwfl_ent = dwfltab_find(frame->pid); - if (dwfl_ent != NULL && ev_sample->n_addrs > dwfl_ent->max_frames) - dwfl_ent->max_frames = ev_sample->n_addrs; - dwfl_ent->total_samples ++; - if (ev_sample->n_addrs <= 2) - dwfl_ent->lost_samples ++; + if (dwfl_ent == NULL && show_failures) + fprintf(stderr, "sysprof_unwind_cb pid %lld (%s): could not create Dwfl table entry\n", + (long long)frame->pid, comm); + else if (dwfl_ent != NULL) + { + if (ev_sample->n_addrs > dwfl_ent->max_frames) + dwfl_ent->max_frames = ev_sample->n_addrs; + dwfl_ent->total_samples ++; + if (ev_sample->n_addrs <= 2) + dwfl_ent->lost_samples ++; + } } } if (frame->type != SYSPROF_CAPTURE_FRAME_STACK_USER) -- 2.47.3