haskell - 静态链接二进制文件中缺少调试符号

标签 haskell gdb ghc cabal haskell-stack

我正在使用堆栈构建静态链接的二进制文件,并尝试向其中添加调试符号(如下: https://downloads.haskell.org/~ghc/master/users-guide/debug-info.html )。然而 GDB 报告:未找到调试符号

我错过了什么?

我已将 .cabal file 中的 ghc-options 添加到:-g -rtsoptsld-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/

相关文章:

sqlite - Yesod/Persistent 中的外键约束?

haskell - 查找树的深度 haskell

c++ - GDB:如何在没有可用名称符号时打印函数参数值

c++ - 调试 "malloc error: pointer being freed was not allocated",使用 gdb

haskell - 转换具有两个以上 Action 的 "do"表示法以使用绑定(bind)函数

haskell - 在haskell中实现选择2个以上的镜头

haskell - 这个双仿函数子集有名字吗?

c++ - 堆栈跟踪在到达我的代码之前停止(在使用 NDK 的 Android 上)

Haskell 智能构造函数的编译时检查

haskell - GHC 中函数参数的内联