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

Add LLVM flags to limit DWARF version to 2 on BSD #77765

Merged
merged 1 commit into from
Oct 14, 2020

Conversation

amshafer
Copy link
Contributor

@amshafer amshafer commented Oct 9, 2020

This has been a thorn in my side for a while, I can finally generate flamegraphs of rust programs on bsd again. This fixes dtrace profiling on freebsd, I think it might help with lldb as well but I can't test that because my current rust-lldb setup is messed up.

I'm limiting the dwarf version to 2 on all bsd's (netbsd/openbsd/freebsd) since it looks like this applies to all of them, but I have only tested on freebsd.

Let me know if there's anything I can improve!


Currently on FreeBSD dtrace profiling does not work and shows jumbled/incorrect
symbols in the backtraces. FreeBSD does not support the latest versions of DWARF
in dtrace (and lldb?) yet, and needs to be limited to DWARF2 in the same way as macos.

This adds an is_like_bsd flag since it was missing. NetBSD/OpenBSD/FreeBSD all
match this.

This effectively copies #11864 but targets FreeBSD instead of macos.

@rust-highfive
Copy link
Collaborator

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @davidtwco (or someone else) soon.

If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes.

Please see the contribution instructions for more information.

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Oct 9, 2020
@davidtwco
Copy link
Member

r? @petrochenkov

@petrochenkov petrochenkov added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Oct 12, 2020
@amshafer amshafer force-pushed the master branch 2 times, most recently from 4a779a1 to fb3ae79 Compare October 13, 2020 01:09
@petrochenkov petrochenkov added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Oct 13, 2020
@petrochenkov
Copy link
Contributor

@amshafer
Could you also squash commits after addressing #77765 (comment)?

@petrochenkov petrochenkov added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Oct 13, 2020
Certain platforms need to limit the DWARF version emitted (oxs, *bsd). This
change adds a dwarf_version entry to the options that allows a platform to
specify the dwarf version to use. By default this option is none and the default
DWARF version is selected.

Also adds an option for printing Option<u32> json keys
@amshafer
Copy link
Contributor Author

Thanks, sorry for all the iterations. I squashed it all into one commit, and added the error message. Please let me know if there's anything else.

@petrochenkov
Copy link
Contributor

Thanks!
@bors r+

@bors
Copy link
Contributor

bors commented Oct 13, 2020

📌 Commit 4511f8b has been approved by petrochenkov

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Oct 13, 2020
bors added a commit to rust-lang-ci/rust that referenced this pull request Oct 14, 2020
Rollup of 8 pull requests

Successful merges:

 - rust-lang#77765 (Add LLVM flags to limit DWARF version to 2 on BSD)
 - rust-lang#77788 (BTreeMap: fix gdb provider on BTreeMap with ZST keys or values)
 - rust-lang#77795 (Codegen backend interface refactor)
 - rust-lang#77808 (Moved the main `impl` for FnCtxt to its own file.)
 - rust-lang#77817 (Switch rustdoc from `clean::Stability` to `rustc_attr::Stability`)
 - rust-lang#77829 (bootstrap: only use compiler-builtins-c if they exist)
 - rust-lang#77870 (Use intra-doc links for links to module-level docs)
 - rust-lang#77897 (Move `Strip` into a separate rustdoc pass)

Failed merges:

 - rust-lang#77879 (Provide better documentation and help messages for x.py setup)
 - rust-lang#77902 (Include aarch64-pc-windows-msvc in the dist manifests)

r? `@ghost`
@bors
Copy link
Contributor

bors commented Oct 14, 2020

⌛ Testing commit 4511f8b with merge 31e4087...

@bors bors merged commit 5962352 into rust-lang:master Oct 14, 2020
@rustbot rustbot added this to the 1.49.0 milestone Oct 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants