about summary refs log tree commit homepage
path: root/Mwrap.xs
diff options
context:
space:
mode:
authorEric Wong <mwrap-perl@80x24.org>2022-12-11 06:30:08 +0000
committerEric Wong <mwrap-perl@80x24.org>2022-12-11 06:31:28 +0000
commit01f2efbe91a148442ad27a0e93961ba31b5e72f8 (patch)
treebeb8cdf83e4e48c20f704347142f1e0499c4e0c3 /Mwrap.xs
parenta62fd3fd047eeb2b4b085321082e210b97802044 (diff)
downloadmwrap-01f2efbe91a148442ad27a0e93961ba31b5e72f8.tar.gz
"'Tis better to emit than to parse"

Since FreeBSD has backtrace_symbols_fmt(3) and glibc does not,
we'll use the hard-coded glibc backtrace_symbols(3) format.
This saves us the trouble of maintaining separate parsers.

I consider the default glibc format superior, anyways, since the
important piece (%f - filename) is up front, since the %a
(address) is process-specific and not useful when viewed from a
different process.
Diffstat (limited to 'Mwrap.xs')
-rw-r--r--Mwrap.xs9
1 files changed, 2 insertions, 7 deletions
diff --git a/Mwrap.xs b/Mwrap.xs
index 5541559..ceeb495 100644
--- a/Mwrap.xs
+++ b/Mwrap.xs
@@ -23,14 +23,9 @@ static SV *location_string(struct src_loc *l)
                 else
                         sv_setpvf(ret, "%s:%zu", l->f->fn, l->lineno);
         } else {
-                char **s = backtrace_symbols((void *)l->bt, (int)l->bt_len);
-
-                if (!s) {
-                        fprintf(stderr, "backtrace_symbols => NULL: %s\n",
-                                strerror(errno));
-                        return &PL_sv_undef;
-                }
+                char **s = bt_syms(l->bt, l->bt_len);
 
+                if (!s) return &PL_sv_undef;
                 ret = newSVpvn(s[0], strlen(s[0]));
                 free(s);
         }