homebrew-emacs-plus
homebrew-emacs-plus copied to clipboard
--with-debug is ignored?
https://github.com/d12frosted/homebrew-emacs-plus/blob/master/Formula/emacs-plus%4028.rb
it doesn't look like the value of this option affects anything?
I'm trying to debug an emacs 100% cpu hang and am trying to run it with gdb to do it. I've brew uninstall emacs-plus@28ed, and then intsalled with brew install emacs-plus@28 --with-debug --with-native-comp, but when I'm trying to run gdb on it (gdb /usr/local/Cellar/emacs-plus@28/28.0.50/Emacs.app/Contents/MacOS/Emacs), I get
GNU gdb (GDB) 10.2
Copyright (C) 2021 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-apple-darwin19.6.0".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from Emacs...
(No debugging symbols found in Emacs)
I suspect that the --with-debug option is ignored
It is not ignored, and it should be working.
https://github.com/d12frosted/homebrew-emacs-plus/blob/7f2442857f5835d40ded54ee64a89afe21e31030/Formula/emacs-plus%4028.rb#L119
Could you please build verbosely and share output?
'brew install emacs-plus@28 --with-debug --keep-tmp' or './build 28 --with-debug --keep-tmp'
The problem is that clang doesn't actually produce the debugging symbols if you separate the compiling and linking stages as emacs does it just keeps references in the executable to the symbols left in the object files. You have to run dsymutil on the emacs executable to go searching for the object files to produce the dSYM bundle. However, brew will delete those object files before you have a chance to run dsymutil because it considers them temporary files so you have to pass '--keep-tmp'.
further reading if you are interested: https://stackoverflow.com/questions/32297349/why-does-a-2-stage-command-line-build-with-clang-not-generate-a-dsym-directory?rq=3 https://stackoverflow.com/questions/10044697/where-how- does-apples-gcc-store-dwarf-inside-an-executable/12827463#12827463 https://wiki.dwarfstd.org/Apple%27s_%22Lazy%22_DWARF_Scheme.md
@d12frosted easy fix might be to automatically pass --keep-tmp if --with-debug is selected. Or possibly have the build script run dsymutil automatically
@s-m-t you can try modifying the following line locally to see if it works:
https://github.com/d12frosted/homebrew-emacs-plus/blob/7f2442857f5835d40ded54ee64a89afe21e31030/Formula/emacs-plus%4028.rb#L119
If that works, let's just pass --keep-tmp and call it a day :)