]> git.ipfire.org Git - thirdparty/elfutils.git/commitdiff
eu-stacktrace fixup: report dwfltab overflow cleanly
authorSerhei Makarov <serhei@serhei.io>
Thu, 29 Aug 2024 14:45:46 +0000 (10:45 -0400)
committerSerhei Makarov <serhei@serhei.io>
Thu, 29 Aug 2024 18:17:53 +0000 (14:17 -0400)
src/stacktrace.c

index 6a18bb2cbbe32b2cc652e1af55a85a1292735910..7c24ddb4b34923fb36b95962d137067f7b382df4 100644 (file)
@@ -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)