libbacktrace icon indicating copy to clipboard operation
libbacktrace copied to clipboard

libbacktrace fails on macOS Sequoia

Open nolaforensix opened this issue 1 year ago • 7 comments

Hi,

libbacktrace seems to fail on macOS Sequoia , both using make check and in the application in which I've used it for some time. Here's the log generated by make check:

thelonious:libbacktrace golden$ cat test-suite.log

package-unused version-unused: ./test-suite.log

TOTAL: 21

PASS: 11

SKIP: 0

XFAIL: 0

FAIL: 10

XPASS: 0

ERROR: 0

.. contents:: :depth: 2

FAIL: allocfail.sh

FAIL allocfail.sh (exit status: 1)

FAIL: btest

DW_FORM_addrx value out of range no debug info in Mach-O executable (make sure to compile with -g; may need to run dsymutil) no debug info in Mach-O executable (make sure to compile with -g; may need to run dsymutil) no debug info in Mach-O executable (make sure to compile with -g; may need to run dsymutil) no debug info in Mach-O executable (make sure to compile with -g; may need to run dsymutil) test1: not enough frames; got 0, expected at least 3 no debug info in Mach-O executable (make sure to compile with -g; may need to run dsymutil) no debug info in Mach-O executable (make sure to compile with -g; may need to run dsymutil) no debug info in Mach-O executable (make sure to compile with -g; may need to run dsymutil) no debug info in Mach-O executable (make sure to compile with -g; may need to run dsymutil) no debug info in Mach-O executable (make sure to compile with -g; may need to run dsymutil) FAIL: backtrace_full noinline FAIL: backtrace_full inline FAIL: backtrace_simple noinline FAIL: backtrace_simple inline PASS: backtrace_syminfo variable FAIL btest (exit status: 1)

FAIL: btest_alloc

DW_FORM_addrx value out of range no debug info in Mach-O executable (make sure to compile with -g; may need to run dsymutil) no debug info in Mach-O executable (make sure to compile with -g; may need to run dsymutil) no debug info in Mach-O executable (make sure to compile with -g; may need to run dsymutil) no debug info in Mach-O executable (make sure to compile with -g; may need to run dsymutil) test1: not enough frames; got 0, expected at least 3 no debug info in Mach-O executable (make sure to compile with -g; may need to run dsymutil) no debug info in Mach-O executable (make sure to compile with -g; may need to run dsymutil) no debug info in Mach-O executable (make sure to compile with -g; may need to run dsymutil) no debug info in Mach-O executable (make sure to compile with -g; may need to run dsymutil) no debug info in Mach-O executable (make sure to compile with -g; may need to run dsymutil) FAIL: backtrace_full noinline FAIL: backtrace_full inline FAIL: backtrace_simple noinline FAIL: backtrace_simple inline PASS: backtrace_syminfo variable FAIL btest_alloc (exit status: 1)

FAIL: edtest

DW_FORM_addrx value out of range no debug info in Mach-O executable (make sure to compile with -g; may need to run dsymutil) no debug info in Mach-O executable (make sure to compile with -g; may need to run dsymutil) no debug info in Mach-O executable (make sure to compile with -g; may need to run dsymutil) no debug info in Mach-O executable (make sure to compile with -g; may need to run dsymutil) test1: not enough frames; got 0, expected at least 3 FAIL: backtrace_full alloc stress FAIL edtest (exit status: 1)

FAIL: edtest_alloc

DW_FORM_addrx value out of range no debug info in Mach-O executable (make sure to compile with -g; may need to run dsymutil) no debug info in Mach-O executable (make sure to compile with -g; may need to run dsymutil) no debug info in Mach-O executable (make sure to compile with -g; may need to run dsymutil) no debug info in Mach-O executable (make sure to compile with -g; may need to run dsymutil) test1: not enough frames; got 0, expected at least 3 FAIL: backtrace_full alloc stress FAIL edtest_alloc (exit status: 1)

FAIL: ttest

DW_FORM_addrx value out of range DW_FORM_addrx value out of range DW_FORM_addrx value out of range DW_FORM_addrx value out of range DW_FORM_addrx value out of range no debug info in Mach-O executable (make sure to compile with -g; may need to run dsymutil) no debug info in Mach-O executable (make sure to compile with -g; may need to run dsymutil) no debug info in Mach-O executable (make sure to compile with -g; may need to run dsymutil) no debug info in Mach-O executable (make sure to compile with -g; may need to run dsymutil) test1: not enough frames; got 0, expected at least 3 no debug info in Mach-O executable (make sure to compile with -g; may need to run dsymutil) no debug info in Mach-O executable (make sure to compile with -g; may need to run dsymutil) no debug info in Mach-O executable (make sure to compile with -g; may need to run dsymutil) no debug info in Mach-O executable (make sure to compile with -g; may need to run dsymutil) test1: not enough frames; got 0, expected at least 3 no debug info in Mach-O executable (make sure to compile with -g; may need to run dsymutil) no debug info in Mach-O executable (make sure to compile with -g; may need to run dsymutil) DW_FORM_addrx value out of range DW_FORM_addrx value out of range no debug info in Mach-O executable (make sure to compile with -g; may need to run dsymutil) no debug info in Mach-O executable (make sure to compile with -g; may need to run dsymutil) no debug info in Mach-O executable (make sure to compile with -g; may need to run dsymutil) no debug info in Mach-O executable (make sure to compile with -g; may need to run dsymutil) no debug info in Mach-O executable (make sure to compile with -g; may need to run dsymutil) no debug info in Mach-O executable (make sure to compile with -g; may need to run dsymutil) no debug info in Mach-O executable (make sure to compile with -g; may need to run dsymutil) no debug info in Mach-O executable (make sure to compile with -g; may need to run dsymutil) test1: not enough frames; got 0, expected at least 3 no debug info in Mach-O executable (make sure to compile with -g; may need to run dsymutil) DW_FORM_addrx value out of range test1: not enough frames; got 0, expected at least 3 DW_FORM_addrx value out of range no debug info in Mach-O executable (make sure to compile with -g; may need to run dsymutil) no debug info in Mach-O executable (make sure to compile with -g; may need to run dsymutil) test1: not enough frames; got 0, expected at least 3 no debug info in Mach-O executable (make sure to compile with -g; may need to run dsymutil) no debug info in Mach-O executable (make sure to compile with -g; may need to run dsymutil) no debug info in Mach-O executable (make sure to compile with -g; may need to run dsymutil) no debug info in Mach-O executable (make sure to compile with -g; may need to run dsymutil) test1: not enough frames; got 0, expected at least 3 no debug info in Mach-O executable (make sure to compile with -g; may need to run dsymutil) no debug info in Mach-O executable (make sure to compile with -g; may need to run dsymutil) no debug info in Mach-O executable (make sure to compile with -g; may need to run dsymutil) test1: not enough frames; got 0, expected at least 3 DW_FORM_addrx value out of range no debug info in Mach-O executable (make sure to compile with -g; may need to run dsymutil) no debug info in Mach-O executable (make sure to compile with -g; may need to run dsymutil) no debug info in Mach-O executable (make sure to compile with -g; may need to run dsymutil) no debug info in Mach-O executable (make sure to compile with -g; may need to run dsymutil) test1: not enough frames; got 0, expected at least 3 no debug info in Mach-O executable (make sure to compile with -g; may need to run dsymutil) no debug info in Mach-O executable (make sure to compile with -g; may need to run dsymutil) no debug info in Mach-O executable (make sure to compile with -g; may need to run dsymutil) no debug info in Mach-O executable (make sure to compile with -g; may need to run dsymutil) test1: not enough frames; got 0, expected at least 3 no debug info in Mach-O executable (make sure to compile with -g; may need to run dsymutil) no debug info in Mach-O executable (make sure to compile with -g; may need to run dsymutil) no debug info in Mach-O executable (make sure to compile with -g; may need to run dsymutil) no debug info in Mach-O executable (make sure to compile with -g; may need to run dsymutil) test1: not enough frames; got 0, expected at least 3 FAIL: threaded backtrace_full noinline FAIL ttest (exit status: 1)

FAIL: ttest_alloc

DW_FORM_addrx value out of range DW_FORM_addrx value out of range DW_FORM_addrx value out of range DW_FORM_addrx value out of range no debug info in Mach-O executable (make sure to compile with -g; may need to run dsymutil) no debug info in Mach-O executable (make sure to compile with -g; may need to run dsymutil) no debug info in Mach-O executable (make sure to compile with -g; may need to run dsymutil) no debug info in Mach-O executable (make sure to compile with -g; may need to run dsymutil) DW_FORM_addrx value out of range no debug info in Mach-O executable (make sure to compile with -g; may need to run dsymutil) no debug info in Mach-O executable (make sure to compile with -g; may need to run dsymutil) no debug info in Mach-O executable (make sure to compile with -g; may need to run dsymutil) no debug info in Mach-O executable (make sure to compile with -g; may need to run dsymutil) test1: not enough frames; got 0, expected at least 3 no debug info in Mach-O executable (make sure to compile with -g; may need to run dsymutil) no debug info in Mach-O executable (make sure to compile with -g; may need to run dsymutil) no debug info in Mach-O executable (make sure to compile with -g; may need to run dsymutil) no debug info in Mach-O executable (make sure to compile with -g; may need to run dsymutil) test1: not enough frames; got 0, expected at least 3 no debug info in Mach-O executable (make sure to compile with -g; may need to run dsymutil) no debug info in Mach-O executable (make sure to compile with -g; may need to run dsymutil) no debug info in Mach-O executable (make sure to compile with -g; may need to run dsymutil) no debug info in Mach-O executable (make sure to compile with -g; may need to run dsymutil) test1: not enough frames; got 0, expected at least 3 DW_FORM_addrx value out of range no debug info in Mach-O executable (make sure to compile with -g; may need to run dsymutil) DW_FORM_addrx value out of range DW_FORM_addrx value out of range no debug info in Mach-O executable (make sure to compile with -g; may need to run dsymutil) no debug info in Mach-O executable (make sure to compile with -g; may need to run dsymutil) no debug info in Mach-O executable (make sure to compile with -g; may need to run dsymutil) DW_FORM_addrx value out of rangetest1: not enough frames; got 0, expected at least 3 DW_FORM_addrx value out of range no debug info in Mach-O executable (make sure to compile with -g; may need to run dsymutil) test1: not enough frames; got 0, expected at least 3 no debug info in Mach-O executable (make sure to compile with -g; may need to run dsymutil) no debug info in Mach-O executable (make sure to compile with -g; may need to run dsymutil) no debug info in Mach-O executable (make sure to compile with -g; may need to run dsymutil) no debug info in Mach-O executable (make sure to compile with -g; may need to run dsymutil) no debug info in Mach-O executable (make sure to compile with -g; may need to run dsymutil) no debug info in Mach-O executable (make sure to compile with -g; may need to run dsymutil) test1: not enough frames; got 0, expected at least 3 no debug info in Mach-O executable (make sure to compile with -g; may need to run dsymutil) test1: not enough frames; got 0, expected at least 3

no debug info in Mach-O executable (make sure to compile with -g; may need to run dsymutil) no debug info in Mach-O executable (make sure to compile with -g; may need to run dsymutil) no debug info in Mach-O executable (make sure to compile with -g; may need to run dsymutil) no debug info in Mach-O executable (make sure to compile with -g; may need to run dsymutil) test1: not enough frames; got 0, expected at least 3 no debug info in Mach-O executable (make sure to compile with -g; may need to run dsymutil) no debug info in Mach-O executable (make sure to compile with -g; may need to run dsymutil) no debug info in Mach-O executable (make sure to compile with -g; may need to run dsymutil) no debug info in Mach-O executable (make sure to compile with -g; may need to run dsymutil) test1: not enough frames; got 0, expected at least 3 no debug info in Mach-O executable (make sure to compile with -g; may need to run dsymutil) no debug info in Mach-O executable (make sure to compile with -g; may need to run dsymutil) no debug info in Mach-O executable (make sure to compile with -g; may need to run dsymutil) no debug info in Mach-O executable (make sure to compile with -g; may need to run dsymutil) test1: not enough frames; got 0, expected at least 3 FAIL: threaded backtrace_full noinline FAIL ttest_alloc (exit status: 1)

FAIL: dwarf5

DW_FORM_addrx value out of range no debug info in Mach-O executable (make sure to compile with -g; may need to run dsymutil) no debug info in Mach-O executable (make sure to compile with -g; may need to run dsymutil) no debug info in Mach-O executable (make sure to compile with -g; may need to run dsymutil) no debug info in Mach-O executable (make sure to compile with -g; may need to run dsymutil) test1: not enough frames; got 0, expected at least 3 no debug info in Mach-O executable (make sure to compile with -g; may need to run dsymutil) no debug info in Mach-O executable (make sure to compile with -g; may need to run dsymutil) no debug info in Mach-O executable (make sure to compile with -g; may need to run dsymutil) no debug info in Mach-O executable (make sure to compile with -g; may need to run dsymutil) no debug info in Mach-O executable (make sure to compile with -g; may need to run dsymutil) FAIL: backtrace_full noinline FAIL: backtrace_full inline FAIL: backtrace_simple noinline FAIL: backtrace_simple inline PASS: backtrace_syminfo variable FAIL dwarf5 (exit status: 1)

FAIL: dwarf5_alloc

DW_FORM_addrx value out of range no debug info in Mach-O executable (make sure to compile with -g; may need to run dsymutil) no debug info in Mach-O executable (make sure to compile with -g; may need to run dsymutil) no debug info in Mach-O executable (make sure to compile with -g; may need to run dsymutil) no debug info in Mach-O executable (make sure to compile with -g; may need to run dsymutil) test1: not enough frames; got 0, expected at least 3 no debug info in Mach-O executable (make sure to compile with -g; may need to run dsymutil) no debug info in Mach-O executable (make sure to compile with -g; may need to run dsymutil) no debug info in Mach-O executable (make sure to compile with -g; may need to run dsymutil) no debug info in Mach-O executable (make sure to compile with -g; may need to run dsymutil) no debug info in Mach-O executable (make sure to compile with -g; may need to run dsymutil) FAIL: backtrace_full noinline FAIL: backtrace_full inline FAIL: backtrace_simple noinline FAIL: backtrace_simple inline PASS: backtrace_syminfo variable FAIL dwarf5_alloc (exit status: 1)

FAIL: mtest

DW_FORM_addrx value out of range no debug info in Mach-O executable (make sure to compile with -g; may need to run dsymutil) no debug info in Mach-O executable (make sure to compile with -g; may need to run dsymutil) no debug info in Mach-O executable (make sure to compile with -g; may need to run dsymutil) no debug info in Mach-O executable (make sure to compile with -g; may need to run dsymutil) test1: not enough frames; got 0, expected at least 3 FAIL: backtrace_full noinline PASS: backtrace_simple noinline PASS: backtrace_syminfo variable FAIL mtest (exit status: 1)

nolaforensix avatar Sep 24 '24 19:09 nolaforensix

Which version of clang are you using?

Also, which version of libbacktrace? The symptoms are similar to a bug that was fixed in revision 4ead348bb45f753121ca0bd44170ff8352d4c514.

ianlancetaylor avatar Sep 24 '24 19:09 ianlancetaylor

Hi,

It's the clang installed with Sequoia's version of XCode and a fresh git clone from the repo:

thelonious:scalpel3 golden$ clang --version
Apple clang version 16.0.0 (clang-1600.0.26.3)
Target: arm64-apple-darwin24.0.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

nolaforensix avatar Sep 25 '24 16:09 nolaforensix

Bug is reproduced.

% clang --version Apple clang version 16.0.0 (clang-1600.0.26.3) Target: arm64-apple-darwin24.0.0 Thread model: posix InstalledDir: /Library/Developer/CommandLineTools/usr/bin libbacktrace_macos_tests.txt

macOS Sequoia 15.0

latest version of master libbacktrace: commit 86885d14049fab06ef8a33aac51664230ca09200 (HEAD -> master, origin/master, origin/HEAD) Author: Ian Lance Taylor [email protected] Date: Tue Jul 16 21:27:05 2024 -0700

pnsafonov avatar Oct 01 '24 10:10 pnsafonov

backtrace_error_callback error_callback returns this: msg = no debug info in Mach-O executable (make sure to compile with -g; may need to run dsymutil) errnum = -1

pnsafonov avatar Oct 01 '24 13:10 pnsafonov

This is probably already clear, but just wanted to make sure: The executable IS compiled with -g and dsymutil was also run and the error occurs anyway.

nolaforensix avatar Oct 03 '24 22:10 nolaforensix

This is probably already clear, but just wanted to make sure: The executable IS compiled with -g and dsymutil was also run and the error occurs anyway.

I checked: binary compiled with -g option, symbol table exists in binary and correct.

pnsafonov avatar Oct 04 '24 11:10 pnsafonov

@pnsafonov The question is not so much the symbol table, it is where the debug information is. There is a bunch of code in libbacktrace to find it. Evidently that code is failing, but how?

ianlancetaylor avatar Oct 04 '24 16:10 ianlancetaylor

clang 16 changes are here: https://releases.llvm.org/16.0.0/tools/clang/docs/ReleaseNotes.html#dwarf-support-in-clang

Is the following the breaking change?

**DWARF Support in Clang Previously when emitting DWARFv4 and tuning for GDB, Clang would use DWARF v2’s DW_AT_bit_offset and DW_AT_data_member_location. Clang now uses DWARF v4’s DW_AT_data_bit_offset regardless of tuning.

Support for DW_AT_data_bit_offset was added in GDB 8.0. For earlier versions, you can use the -gdwarf-3 option to emit compatible DWARF.**

nolaforensix avatar Oct 21 '24 20:10 nolaforensix

@nolaforensix Thanks, but, no, that shouldn't make a difference. Those are for locating variables in memory, which libbacktrace doesn't care about.

ianlancetaylor avatar Oct 21 '24 22:10 ianlancetaylor

This is fix for this issue: https://github.com/ianlancetaylor/libbacktrace/pull/143

Tests on macOS are passed, backtrace working fine.

pnsafonov avatar Oct 25 '24 05:10 pnsafonov

Confirmed working, thanks for the quick fix!

nolaforensix avatar Oct 26 '24 16:10 nolaforensix