unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#71292: 30.0.50; macOS: .elns have no debug info
@ 2024-05-31 13:55 Gerd Möllmann
  2024-05-31 15:39 ` Eli Zaretskii
  0 siblings, 1 reply; 15+ messages in thread
From: Gerd Möllmann @ 2024-05-31 13:55 UTC (permalink / raw)
  To: 71292

On macOS, executables (including .dylibs (=.eln)) never not contain
debug info themselves. Debug info is instead contained in .o files, and
executables reference the .o files used to build them in a debug map.
This can be seen with, e.g.

  dsymutil --dump-debug-map

This means no .o files, no debug info.

libgccjit deletes the .o files if debug > 0, gcc-14 -g does not delete
them, the .o files are kept in some temporary directory.

I found that the following change makes libgccjit behave like gcc:

modified   lisp/emacs-lisp/comp.el
@@ -99,7 +99,7 @@ native-comp-compiler-options
   :version "28.1")

 (defcustom native-comp-driver-options
-  (cond ((eq system-type 'darwin) '("-Wl,-w"))
+  (cond ((eq system-type 'darwin) '("-Wl,-w" "-save-temps=obj"))
         ((eq system-type 'cygwin) '("-Wl,-dynamicbase")))
   "Options passed verbatim to the native compiler's back-end driver.

This does not address the generation of .dSYM bundles. The .o files in
the temp dirs will be deleted at some point by which the debug info of
an executable is lost. This can be prevented by producing a .dSYM
bundle for the executable with

  dsymutil <executable>

and keeping the .dSYM around with the executable. .dSYM bundles can be
loaded in LLDB with

  process symbols add <dsym>.

To produce .dSYMs for native lisp:

  #! /usr/bin/env zsh
  rm -rf native-lisp/**/*.dSYM
  for f in native-lisp/**/*.eln; do
    dsymutil $f
  done

I've made jit@gcc.gnu.org aware of this. Maybe they will change
something in the future.

Example in LLDB with native-comp-debug == 2

  frame #7: 0x000000010350db68 comp-7672a6ed-3a3b5dd7.eln`F636f6d702d2d6c696d706c6966792d626c6f636b_comp__limplify_block_0 + 1632 at comp-7672a6ed-3a3b5dd7.c:101440

and one can look at the C file.






^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2024-06-03 15:30 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-05-31 13:55 bug#71292: 30.0.50; macOS: .elns have no debug info Gerd Möllmann
2024-05-31 15:39 ` Eli Zaretskii
2024-05-31 16:31   ` Gerd Möllmann
2024-05-31 18:07     ` Eli Zaretskii
2024-05-31 18:12       ` Gerd Möllmann
2024-05-31 18:32         ` Eli Zaretskii
2024-05-31 18:52           ` Gerd Möllmann
2024-05-31 19:05             ` Eli Zaretskii
2024-05-31 19:22               ` Gerd Möllmann
2024-06-01  6:15                 ` Gerd Möllmann
2024-06-01  6:24                   ` Gerd Möllmann
2024-06-01  6:36                   ` Eli Zaretskii
2024-06-02  5:41                     ` Gerd Möllmann
2024-06-02  6:40                       ` Eli Zaretskii
2024-06-03 15:30                         ` Andrea Corallo

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).