Skip to content

Debugger won't find object files on Xcode 16.3- #404

@kon72

Description

@kon72

After upgrading Xcode to 16.3, I've noticed that the debugger doesn't have any source information.
dsymutil told me that N_OSO is pointing to an object file inside a sandbox that doesn't exist at runtime.
(Tested with apple_support@1.12.1)

$ dsymutil -s bazel-out/darwin_arm64-dbg/bin/exp/a | grep N_OSO
[     3] 00000034 66 (N_OSO        ) 00     0001   0000000068175874 '/private/var/tmp/_bazel_kon/145573fc157b84d695dc97cdf5deb424/sandbox/darwin-sandbox/1390/execroot/_main/bazel-out/darwin_arm64-dbg/bin/exp/_objs/a/a.o'

After some digging, it looks like Xcode 16.3 changed how it handles -oso_prefix linker flag.
Before 16.3, -oso_prefix was stripped after resolving symlinks.
As of 16.3, it's now stripped before resolving symlinks.
You can confirm this by the following repro:

$ /usr/bin/xcrun clang -g -fdebug-prefix-map=${PWD}=. -o a.o -c a.cc
$ ln -s ${PWD}/a.o sub
$ /usr/bin/xcrun clang -Wl,-oso_prefix,${PWD}/ -o a sub/a.o
$ dsymutil -s a | grep N_OSO

Xcode 16.2 prints:

[     3] 00000024 66 (N_OSO        ) 00     0001   000000006817626b 'a.o'

Xcode 16.3 and 16.4 beta prints:

[     3] 00000024 66 (N_OSO        ) 00     0001   0000000068176c8f 'sub/a.o'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions