Skip to content

OSX: LDC linked against regular LLVM won't show line numbers in stack trace #3280

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Geod24 opened this issue Jan 15, 2020 · 5 comments
Closed

Comments

@Geod24
Copy link
Contributor

Geod24 commented Jan 15, 2020

On OSX, the linker strips .debug_lines, which makes the backtrace code in Druntime non-functional.
LDC already has a workaround for this (here), however this workaround requires to compile against a modified version of LLVM.

So if one downloads the release from Github, things work correctly, but for Homebrew users (who build from source), line numbers aren't shown by default.

Is there any chance that the patch can be upstreamed so people linking against stock LLVM can benefit from it ?

@kinke
Copy link
Member

kinke commented Jan 15, 2020

I doubt they'll accept such a hack. The probably nicer proper solution would involve druntime being able to use the separate debuginfo (.dSYM) files generated by default (IIRC, something similar to .pdb files).

@kinke
Copy link
Member

kinke commented Jan 15, 2020

Also, there are more things that only work with our LLVM fork, mainly cross-compiling to Android (another hack that surely won't be accepted) and -link-internally for some targets (well, those one-liners would be upstreamable).

@Geod24
Copy link
Contributor Author

Geod24 commented Jan 16, 2020

Opened https://issues.dlang.org/show_bug.cgi?id=20510, since the proper solution seems to be in Druntime. Thanks!

-link-internally for some targets

Is Windows one of them ?

@kinke
Copy link
Member

kinke commented Jan 16, 2020

Is Windows one of them ?

With recent LLVM, it only affects those targets for which it's most useful - Windows/MSVC and WebAssembly.

@JohanEngelen
Copy link
Member

Fixed by #4291

JohanEngelen added a commit to JohanEngelen/ldc that referenced this issue Dec 18, 2022
JohanEngelen added a commit that referenced this issue Dec 28, 2022
…n backtraces. (#4291)

* macOS debuginfo: add support for using `atos` to get file:line info in backtraces.
Resolves issue #3864

* Return to LLVM default of emitting __debug_line section in __DWARF segment as a debug section (not regular)

* Re-enable test now that issue #3280 is fixed.

* Allow full path names in exception file:line debug output.

* Allow full path names in exception file:line debug output.

* Add changelog entry
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants