]> git.ipfire.org Git - thirdparty/strongswan.git/commitdiff
backtrace: Suppress internal errors by libbfd
authorTobias Brunner <tobias@strongswan.org>
Thu, 1 Dec 2022 08:31:44 +0000 (09:31 +0100)
committerTobias Brunner <tobias@strongswan.org>
Fri, 2 Dec 2022 13:57:55 +0000 (14:57 +0100)
At least since Ubuntu 22.04 there are lots of (apparently non-fatal)
"DWARF error: could not find variable specification" errors generated
by bfd_find_nearest_line().  This also happens with addr2line, which
internally uses libbfd.  No idea what the actual issue is (it still
happens with binutils 2.39 in Ubuntu 22.10), but since it doesn't seem
to affect the functionality we need this avoids filling the test logs
with useless messages.

src/libstrongswan/utils/backtrace.c

index 2fdfab1ee039ffe11ea4319ab1454fa8f63c6c10..f2631f3945a64e93d7ff67dfaa6a7e19af748801 100644 (file)
@@ -242,6 +242,15 @@ static bool bfd_equals(char *a, char *b)
        return streq(a, b);
 }
 
+/**
+ * Do not print internal errors by libbfd as we get quite a lot of
+ * "DWARF error: could not find variable specification" messages when running
+ * against Ubuntu 20.04's libcrypto (same with addr2line and still in 22.10).
+ */
+void suppress_bfd_errors (const char *fmt, va_list args)
+{
+}
+
 /**
  * See header.
  */
@@ -251,6 +260,7 @@ void backtrace_init()
        bfds = hashtable_create((hashtable_hash_t)bfd_hash,
                                                        (hashtable_equals_t)bfd_equals, 8);
        bfd_mutex = mutex_create(MUTEX_TYPE_DEFAULT);
+       bfd_set_error_handler(suppress_bfd_errors);
 }
 
 /**