我正在使用堆栈构建静态链接的二进制文件,并尝试向其中添加调试符号(如下: https://downloads.haskell.org/~ghc/master/users-guide/debug-info.html )。然而 GDB 报告:未找到调试符号
。
我错过了什么?
我已将 .cabal
file 中的 ghc-options
添加到:-g -rtsopts
和ld-options
:-static
。我正在使用堆栈使用以下命令进行构建:
stack install \
--install-ghc \
--split-objs \
--ghc-options="-fPIC -fllvm -pgmlo opt -pgmlc llc"
GDB 调用如下:gdb --args nodebug-exe +RTS -V0
GHC 8.2.1
完整源代码在这里:https://github.com/carbolymer/haskell-missing-debug-symbols
最佳答案
--no-strip
防止调试信息在堆栈构建中被删除。
来自documentation :
stack now supports debugging and profiling with DWARF information, using the --no-strip, --no-library-stripping, and --no-executable-stripping flags to disable the default behavior of removing such information from compiled libraries and executables.
关于haskell - 静态链接二进制文件中缺少调试符号,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47359448/