Skip to content

Alternatives to generate debug information for c/cpp/rust #27

Open
@snehasish

Description

@snehasish

I came across the symbolization support page for cpp and the steps documented to add debug information. There are a couple of options in clang and gcc which can be more effective.

  1. The -g (equivalent to -g2) flag generates a lot of debug information, most of which is unnecessary for symbolization. You can reduce the amount of debug information to only line tables by using -gmlt or -g1.

  2. The -gsplit-dwarf flag can generate debug information in a separate file. This helps reduce memory (and time) when linking large binaries with debug information in them. The debug information for each object file is placed in a .dwo file which can then be linked together to a single .dwp file. I believe this will save the objcopy steps.

Have you considered using these options?

Activity

brancz

brancz commented on Oct 13, 2023

@brancz
Member

Great questions!

The -g (equivalent to -g2) flag generates a lot of debug information, most of which is unnecessary for symbolization. You can reduce the amount of debug information to only line tables by using -gmlt or -g1.

Absolutely, line tables are sufficient for our purposes. I'll make sure we adapt the docs here!

The -gsplit-dwarf flag can generate debug information in a separate file. This helps reduce memory (and time) when linking large binaries with debug information in them. The debug information for each object file is placed in a .dwo file which can then be linked together to a single .dwp file. I believe this will save the objcopy steps.

At the moment we don't support dwarf packages, but we definitely want to!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @snehasish@brancz

        Issue actions

          Alternatives to generate debug information for c/cpp/rust · Issue #27 · polarsignals/docs