libspl/backtrace: comment and harden libunwind backtracer
commitb85c5641611287095367ff9d5410cd74a896ab4f
authorRob Norris <robn@despairlabs.com>
Fri, 18 Oct 2024 04:10:33 +0000 (18 15:10 +1100)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Sun, 20 Oct 2024 16:36:02 +0000 (20 09:36 -0700)
tree45f94ba06de6280e814df086a738a3565b61c212
parent2596a75306980c7cb3de22fcf09e65dac2fbf279
libspl/backtrace: comment and harden libunwind backtracer

This is the sort of code that we get right once and never look at again.
Anyone reading this code is already likely in the middle of a debugging
nightmare, and then they have a wall of manual string construction and
an unfamiliar and idiosyncratic library to deal with. So, comment the
whole thing to try to make it clear what's going on.

In pursuit of the above, I've added return checks to some of the
libunwind calls, fixed the frame loop to not skip the "top" frame
(however unseful it may be), and fix a couple of calls to
spl_bt_u64_to_hex_str() which requested 18 digits instead of 16.

Sponsored-by: https://despairlabs.com/sponsor/
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Tino Reichardt <milky-zfs@mcmilk.de>
Signed-off-by: Rob Norris <robn@despairlabs.com>
Closes #16653
lib/libspl/backtrace.c