Skip to content

Add support for -g option #2702

Closed
Closed

Description

@bitonic

-g builds libraries with DWARF symbols, but it's quite awkward to use it:

cabal install --disable-library-stripping --ghc-options="-g -rtsopts"

I think we should have a flag that automatically does the above.

Moreover, I'd also like a flag that stores the downloaded source, so that the debug symbols will refer to sources which still exist.

Activity

  1. cartazio commented on Jul 4, 2015

    @cartazio
    Contributor

    i think you can add that to your ~/.cabal/config file as a default ghc options flag

  2. 23Skidoo commented on Jul 4, 2015

    @23Skidoo
    Member

    This seems to be already implemented (fbf8499). Try cabal install --disable-library-stripping --enable-debug-info.

    /cc @tibbe

  3. bitonic commented on Jul 5, 2015

    @bitonic
    Author

    OK, I'd still like the second part to happen:

    Moreover, I'd also like a flag that stores the downloaded source, so that the debug symbols will refer to sources which still exist.

    It's extremely nice to get perf output side-by-side to the Haskell source.

  4. bitonic commented on Jul 6, 2015

    @bitonic
    Author

    Also, I'd say that --enable-debug-info should automatically disable library stripping, if that's not the case already.

  5. 23Skidoo commented on Jul 6, 2015

    @23Skidoo
    Member

    Yes, makes sense.

  6. mpickering commented on Jun 24, 2019

    @mpickering
    Collaborator

    Just to point out that debug-info doesn't imply --disable-library-stripping still, which makes debug-info on its own rather useless. If someone points me to the right file then I will prepare a patch.

  7. 23Skidoo commented on Jun 25, 2019

    @23Skidoo
    Member

    @mpickering Good place to start is running rg stripLib and rg stripExe. We should also add a warning to cabal-install that fires when the user explicitly enables both one of library/executable-stripping: True and debug-info: True in the config file.

    I think that normally one will want to either enable debug-info on per-project basis, or enable it system-wide just for libraries and use the default (strip exes) for exes cabal installed system-wide. So perhaps we need a separate library-debug-info option?

  8. mpickering commented on Jun 25, 2019

    @mpickering
    Collaborator

    @23Skidoo It seems the natural place to implement this is Cabal.Distribution.Simple.Configure.configure but by that point we have lost the knowledge about how the option came to be set. Where is the right place to implement warnings about things found in cabal.project files?

  9. mpickering commented on Jun 25, 2019

    @mpickering
    Collaborator

    defaultConfigFlags also seems to set the default to Flag True rather than NoFlag.

    Unless there is a similar warning I can look at to see where to implement this check it seems like a lot of untangling to implement the logic where a warning happens if the user has explicitly set the option.

  10. added 2 commits that reference this issue on Jun 26, 2019
    318d469
    ffd45c5
  11. mpickering commented on Jul 1, 2019

    @mpickering
    Collaborator

    Is this patch actually a good idea? It was only on v2-install that the executables were stripped. Now with this patch there's no way to strip executables when they are installed. Executables built with v2-build didn't get stripped.

  12. 23Skidoo commented on Jul 1, 2019

    @23Skidoo
    Member

    Now with this patch there's no way to strip executables when they are installed.

    You mean, if you have debug-info: True in .cabal/config?

  13. mpickering commented on Jul 2, 2019

    @mpickering
    Collaborator

    Yes if you set debug-info: 3 in a global setting.

  14. 23Skidoo commented on Jul 2, 2019

    @23Skidoo
    Member

    Shouldn't this mean that installed exes should have debug info? Perhaps we can add a better warning (at .cabal/config load time).

  15. added a commit that references this issue on Aug 9, 2019
    b408d16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions