Missing debug symbols in statically linked binaries

I am creating a statically linked binary using the stack and I am trying to add debug symbols to it (the following: https://downloads.haskell.org/~ghc/master/users-guide/debug-info.html ). However, GDB reports: no debugging symbols found .

What am I missing?

I added the file : -g -rtsopts and ld-options : -static to ghc-options in .cabal . I use the stack with the following command:

 stack install \ --install-ghc \ --split-objs \ --ghc-options="-fPIC -fllvm -pgmlo opt -pgmlc llc" 

GDB is invoked as follows: gdb --args nodebug-exe +RTS -V0

GHC 8.2.1

The whole source code is here: https://github.com/carbolymer/haskell-missing-debug-symbols

+5
source share
1 answer

--no-strip prevents deletion of debugging information in the stack assembly.

In the 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 to remove such information from compiled libraries and executables.

+5
source

Source: https://habr.com/ru/post/1273483/


All Articles