Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Splitting Debuginfo #30

Open
Gankra opened this issue Oct 24, 2022 · 5 comments
Open

Splitting Debuginfo #30

Gankra opened this issue Oct 24, 2022 · 5 comments
Labels
feature request New feature or request help wanted Extra attention is needed

Comments

@Gankra
Copy link
Contributor

Gankra commented Oct 24, 2022

Another future killer app: properly setting the flags and running the tools to produce proper symbol/debuginfo files (similar to source maps, but for native code).

This comment covers a lot of useful details on the state of this stuff in rust.

Some quick notes:

Each platform has different formats for this:

  • windows pdb
  • apple dsym
  • linux dwp / linux "strip"
  • breakpad (platform-agnostic) sym

Different platforms have different symbol servers:

To generate symbol files for rust you want to:

  • build a release binary
    • with opt-level=3 or w/e release is
    • with codegen-units=1
    • with LTO..?
  • with debug info cranked to max
  • if targetting breakpad: run dump_syms to get a .sym
  • strip the binary?

Then the user will want to:

  • grab the final debuginfo/symbol file
  • get the unique build ids that map the debuginfo to the binary (platform-specific, hopefully embedded in the file, but we should still get them out?)
  • upload it to a symbol server?
  • package it?
@Gankra Gankra added this to the future milestone Oct 24, 2022
@Gankra
Copy link
Contributor Author

Gankra commented Jan 12, 2023

We generate the pdb and upload it to the release, however we don't:

  • handle dsym (it's a directory so as it turns out we might need to zip it up)
  • handle dwp (upstream cargo issue, dwp's aren't quite ready for primetime)
  • grab ids (haven't bothered yet)

@Gankra
Copy link
Contributor Author

Gankra commented Jan 19, 2023

dwp is blocked on rust-lang/cargo#11572

dsyms would be nice to do before shipping...

@Gankra
Copy link
Contributor Author

Gankra commented Feb 1, 2023

The cargo issue was fixed (obvs needs to ride the trains) but rust-lang/rust#105991 is also an argument against using it.

@mstange
Copy link

mstange commented Feb 1, 2023

Some additional info for macOS symbol servers:
Yes, there is no symbol server scheme on macOS, but there are bunch of alternatives, including the ability to plug in a custom "find my dSYM" script, and also we can just decide on our own scheme.

The alternatives are described here: https://lldb.llvm.org/use/symbols.html

As for a macOS symbol server URL scheme, for the Mozilla symbol server I'm planning to use the following scheme: https://symbols.mozilla.org/uuid/D13BD7EC88D830C49C6BC4B34F2D9156/debuginfo.dSYM.tar.bz2

And then we can supply an off-the-shelf script for use with DBGShellCommands which supports this scheme, and also teach wholesym about it.

@Gankra Gankra modified the milestones: future, debuginfo-ready Feb 12, 2023
@Gankra Gankra added feature request New feature or request help wanted Extra attention is needed labels Feb 16, 2023
@Gankra
Copy link
Contributor Author

Gankra commented Jun 12, 2024

There is some work planned to cleanup the mess of symbol formats in rustc so it's easier to just ask for the right thing. Notably a new -Csplit-debuginfo=post-link mode has been approved to resolve the issues with dwp on linux. I believe it hasn't yet been implemented yet, though.

post-link debuginfo on linux would produce the more traditional and imo superior "strip" debuginfo format, which has the same basic properties as pdb and dSYM. With this you should be able to uniformly ask for a fully stripped binary and a completely independent native symbol file that contains all the info "missing" from the binary.

All standard tools would know how to handle these, and you'd be able to do either online or offline debugging of binary/crash (with the appropriate machinery to fetch the symbols from servers).

It's possible this format can be manually "polyfilled" by cargo-dist since it is apparently a case of just using the strip cli utility properly. This would however require some non-trivial work to make sure we get everything right. Work that would preferrably be upstream in rustc. (AIUI the "strip" debuginfo format is essentially taking a fully debuginfo'd ELF binary, running strip on it, and spitting out a file that contains all the sections that were removed. So it's like an ELF executable with all the actual executable parts missing.)

mistydemeo pushed a commit that referenced this issue Jun 17, 2024
feat: WorkspaceInfo inherits new PackageInfo features
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants