On Tuesday, 11 December 2018 at 16:32:31 UTC, Jacob Carlborg wrote:
On 2018-12-11 13:23, Iain Buclaw wrote:

Dwarf data is emitted on OSX. The section where to find all debug symbols is prefixed by "__DWARF". Even DMD does this on OSX. ;-)

Yes, but the linker strips any sections with the "S_ATTR_DEBUG" flag, which includes the everything in the "__DWARF" segment. Here's my commit message for convenience:

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.

Well, as a front-end language dev, how gcc emits things is not my bailiwick, just so long as I can guarantee language semantics. :-)

Reply via email to