Preserve the __debug_line section on macOS in the final executable#8168
Preserve the __debug_line section on macOS in the final executable#8168dlang-bot merged 2 commits intodlang:masterfrom
__debug_line section on macOS in the final executable#8168Conversation
All calls to this function are guarded with and #if for EFL.
|
Thanks for your pull request and interest in making D better, @jacob-carlborg! We are looking forward to reviewing it, and you should be hearing from a maintainer soon.
Please see CONTRIBUTING.md for more information. If you have addressed all reviews or aren't sure how to proceed, don't hesitate to ping us with a simple comment. Bugzilla referencesYour PR doesn't reference any Bugzilla issue. If your PR contains non-trivial changes, please reference a Bugzilla issue or create a manual changelog. Testing this PR locallyIf you don't have a local development environment setup, you can use Digger to test this PR: dub fetch digger
dub run digger -- build "master + dmd#8168" |
|
I've not included a changelog entry here because it's not a user facing change. |
17ceaf8 to
ef1e24b
Compare
|
Please add your opening comment in as a comment in the code. |
It's already in the commit message, do you want it in the code as well? |
The linker on macOS will remove any debug info, i.e. every section with the `S_ATTR_DEBUG` flag, this includes everything in the `__DWARF` section. By using the `S_REGULAR` flag the linker will not remove this section. This allows to get the filenames and line numbers for backtraces from the executable. Normally the linker removes all the debug info but adds a reference to the object files. The debugger can then read the object files to get filename and line number information. It's also possible to use an additional tool that generates a separate `.dSYM` file. This file can then later be deployed with the application if debug info is needed when the application is deployed.
ef1e24b to
2bf7d0d
Compare
@WalterBright added comment to the code and added a test as well. |
|
Is the failing DAutoTest related to this change? Nothing else fails. |
|
Yeah the error is But it's unrelated to this PR. |
|
|
Everything is green. |
|
Ping, this is pretty trivial. |
|
Suggestion to revert this: https://www.digitalmars.com/d/archives/digitalmars/D/Not_Working_on_the_Mac_369782.html#N369787 |
|
There are a couple of options:
|
|
@jacob-carlborg I'd prefer to fix the problem rather than revert this. Except nobody seems to know what to do about it. |
|
Can you try fixing the alignment and see if it works? |
Unfortunately that's out of my league. It would be more suitable for someone that actually knows the compiler. |
The linker on macOS will remove any debug info, i.e. every section with the
S_ATTR_DEBUGflag, this includes everything in the__DWARFsection. By using theS_REGULARflag the linker will not remove this section. This allows to get the filenames and line numbers for backtraces from the executable.Normally the linker removes all the debug info but adds a reference to the object files. The debugger can then read the object files to get filename and line number information. It's also possible to use an additional tool that generates a separate
.dSYMfile. This file can then later be deployed with the application if debug info is needed when the application is deployed.