Debug prefix map seems like one solution here, but do we need to remap it back for LLDB to work properly? This post seems to claim it's not necessary to remap it for LLDB? Is that also the case for code compiled by Clang?
For situations like this I think it would be best to use -fdebug-prefix-map to replace all occurrences of the sysroot with a placeholder such as $SDKROOT and then modify the DBGSourcePathRemapping dictionary in the .dSYM bundle to automatically change it back to a location that makes sense on the developer's machine. (See also my summary in 44213 – DW_AT_LLVM_isysroot isn't useful which I think is mostly complete now).
Sorry! I replied before I finished my morning coffee.
This of course correct. As of 5.3, LLDB effectively ignores the concrete value of the sysroot attribute (it will search for a local, compatible SDK) so the last step of remapping it is not necessary! You might still want to remap the sysroot on the build server to get reproducible results though.
Gotcha, thanks! So we can remap to $CLANG_SYSROOT or something like that for hermeticity.
From my second post we also see paths of the form DW_AT_decl_file ("/Applications/Xcode_11.7.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/limits") for Clang. We'll need to remap $DEVELOPER_DIR or $TOOLCHAIN for hermeticity and then remap it again for the debugger?
This is what I referred to as the Clang resource dir in the llvm bugreport. We should probably use a similar scheme for it, but we don't have the automatic support yet that we have for the SDK. So, yes, you'll have to remap this first to a recognizable token and then do the reverse mapping on the client (e.g., in the dSYM dictionary).
Which seems to be a bit different (usr/lib), so I think we might just go ahead and remap DEVELOPER_DIR itself although maybe it should be the toolchain path.
Oh. Thanks for pointing that out! I didn't realize that libc++ was not in the resource dir but rather installed alongside Clang. $TOOLCHAIN_ROOT or something would be more appropriate it seems.