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

fix(debuginfo): Prefer DWARF names for Dart functions #293

Merged
merged 1 commit into from
Nov 26, 2020

Conversation

jan-auer
Copy link
Member

@jan-auer jan-auer commented Nov 26, 2020

We generally trust the symbol table to contain more accurate names than DW_AT_name and other attributes on DIEs in DWARF debug information. Some C++ compilers have been known to output truncated or simplified names into these attributes, whereas the symbol table always contains accurately mangled names.

The Dart compiler is an exception to this case. Its name mangling appears to be lossy and there is no generally available demangler. Thus, we need to prefer the demangled DW_AT_name.

Example:

  • Mangled Symbol: Precompiled__pM_658260265_sEa__anonymous_closure__8632
  • Demangled Symbol: _MyAppState.build.<anonymous closure>

Obtained via cargo run -p addr2line -- -fCi -e app.symbols 0x211b7c from this example.


Before:
image

After:
image

@jan-auer jan-auer self-assigned this Nov 26, 2020
@jan-auer jan-auer requested a review from a team November 26, 2020 17:39

// Trust the symbol table more to contain accurate mangled names. However, since Dart's name
// mangling is lossy, we need to load the demangled name instead.
let prefer_dwarf_names = producer.as_deref() == Some(b"Dart VM");
Copy link
Member Author

Choose a reason for hiding this comment

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

This is part 1 of the change: Detecting the Dart producer.

.map(|n| Name::new(n, NameMangling::Mangled, self.language))
})
} else {
let symbol_name = if self.prefer_dwarf_names || inline {
Copy link
Member Author

Choose a reason for hiding this comment

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

This is part 2 of the change: Skipping symbol table lookup if DWARF names are preferred.

@jan-auer jan-auer merged commit 075ee51 into master Nov 26, 2020
@jan-auer jan-auer deleted the fix/dart-symbol-names branch November 26, 2020 18:17
jan-auer added a commit that referenced this pull request Nov 26, 2020
* master:
  fix(debuginfo): Prefer DWARF names for Dart functions (#293)
jan-auer added a commit that referenced this pull request Dec 22, 2020
* master: (21 commits)
  fix: New nightly clippy lint (#295)
  fix(release): Do not publish examples to crates.io
  release: 8.0.0
  ref(debuginfo): Remove re-exports of error types (#300)
  meta: Update changelog
  ref(debuginfo): Switch to error with kind (#299)
  ref(minidump): Switch to error with kind (#298)
  ref(unreal): Switch to error with kind (#297)
  ref(symcache): Switch to error with kind (#296)
  feat: Rename architecture to wasm32 (#294)
  fix(debuginfo): Prefer DWARF names for Dart functions (#293)
  fix: clippy (#292)
  hack(dwarf): Skip line program sequences at 0 (#291)
  feat(wasm): support for wasm (#166)
  ci: Run rust nighlty on a schedule (#289)
  ref: Updates for rust 1.48 (#288)
  fix(debuginfo): Update dmsort to 1.0.1 to avoid panic due to UB (#287)
  ci: Use GHA instead of zeus (#286)
  ref: Introduce explicit NameMangling and better DemangleOptions (#275)
  meta: Bump all semver-major dependencies (#283)
  ...
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.

None yet

2 participants