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

Parse short backtraces out of debuginfo #693

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

jyn514
Copy link
Member

@jyn514 jyn514 commented Jan 21, 2025

This implements the runtime side of rust-lang/compiler-team#818.

  • Extract a helper out of find_frames for iterating over a LookupContinuation
  • Make the type signature for search_object_map consistent across all platforms. Backtraces are inherently platform specific, but let's not make it any harder on ourselves than we have to.
  • Add a new pub fn short_backtraces() -> enum { ThisFrameOnly, Start, End } API
  • Use the new gimli::UnitRef::shared_attrs API to determine whether a given frame has a short backtrace. This, for now, requires a git dependency on gimli.

Note that this currently does not work on MacOS. I do not have a Mac to test this; someone lent me theirs and I tracked it down to cx.find_dwarf_and_unit returning None, but I have not had the time or resources to narrow it down further than that.

This implements the runtime side of rust-lang/compiler-team#818.

- Extract a helper out of `find_frames` for iterating over a `LookupContinuation`
- Make the type signature for `search_object_map` consistent across all platforms. Backtraces are inherently platform specific, but let's not make it any harder on ourselves than we have to.
- Add a new `pub fn short_backtraces() -> enum { ThisFrameOnly, Start, End }` API
- Use the new [`gimli::UnitRef::shared_attrs`](gimli-rs/gimli#756) API to determine whether a given frame has a short backtrace. This, for now, requires a git dependency on gimli.

Note that this currently does not work on MacOS. I do not have a Mac to test this; someone lent me theirs and I tracked it down to `cx.find_dwarf_and_unit` returning `None`, but I have not had the time or resources to narrow it down further than that.
}

#[allow(non_upper_case_globals)]
const DW_AT_short_backtrace: gimli::DwAt = gimli::DwAt(0x3c00);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if this changes upstream it will also need to change here: llvm/llvm-project#123683 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant