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

Update libbacktrace to latest master #299

Merged
merged 3 commits into from Mar 24, 2020
Merged

Update libbacktrace to latest master #299

merged 3 commits into from Mar 24, 2020

Conversation

ghost
Copy link

@ghost ghost commented Mar 3, 2020

@alexcrichton
Copy link
Member

Ok I did a bit of debugging locally to figure out what's going on there. The failing test case here is testing the accuracy of backtrace symbolization without debuginfo, where we still want at least some sort of human readable names. Something is coming out but not every symbol is being resolved when it should be.

The previous iteration of libbacktrace passed this test because it never actually called the callback in backtrace_syminfo, triggering a fallthrough to call dladdr instead. It looks like now backtrace_syminfo is indeed being called with the callback, only it's less useful than before.

Honestly I'm not actually entirely sure about the relationship between dladdr, backtrace_syminfo, and backtrace_pcinfo. My general understanding is that backtrace_pcinfo only works if there's dwraf, and dladdr and backtrace_syminfo are otherwise pretty equiavlent. I'm not sure if that's actually true in all the implementations today. We may be able to fix this by removing this fallback and forcing a fallback to dladdr instead. I'm not really sure if backtrace_syminfo will ever give more accurate information than dladdr. In this case at least dladdr does seem a bit more accurate.

@alexcrichton
Copy link
Member

Ok I dug in some more. Applying this patch confirms that the symtab entry, which I believe is all that dladdr consults, is indeed correct and we can symbolize purely based on the symbol table. I believe this is what libbacktrace is trying to do, but presumably there's a bug in libbacktrace in parsing and/or managing the symbol table.

@philipc
Copy link
Contributor

philipc commented Mar 4, 2020

From a quick look, it is skipping over externally visible symbols, which seems wrong to me.

@alexcrichton
Copy link
Member

Oh nice, thanks @philipc! Indeed deleting those two lines gets the test passing. @t6 would you be willing to try to get that patch into upstream libbacktrace?

@nox
Copy link

nox commented Mar 6, 2020

@alexcrichton Seems like the N_EXT condition should be replaced by N_UNDF, given the function is named macho_defined_symbol.

https://developer.apple.com/documentation/kernel/nlist_64/1583944-n_type?language=objc

@nox
Copy link

nox commented Mar 6, 2020

Ah never mind, it's just a N_TYPE and that's checked immediately afterwards in the switch statement so all that is needed is removing the N_EXT check indeed.

@nox
Copy link

nox commented Mar 24, 2020

@alexcrichton Do you think we could update libbacktrace with local patches instead of waiting for upstream? There is no ETA as to when they will reply.

ianlancetaylor/libbacktrace#34 (comment)

@alexcrichton
Copy link
Member

Oops sorry didn't see that this had made progress! Thanks for the ping @nox.

Thanks for pushing this through @t6!

@alexcrichton alexcrichton merged commit 703aeee into rust-lang:master Mar 24, 2020
@nox
Copy link

nox commented Mar 24, 2020

You're welcome @alexcrichton. Can't wait for a new release! That will allow us to remove a [patch] in our top-level Cargo.toml file in Servo, which is nice.

@alexcrichton
Copy link
Member

Ok I've published new releases with these updates as well.

nox added a commit to servo/servo that referenced this pull request Mar 24, 2020
bors-servo pushed a commit to servo/servo that referenced this pull request Mar 24, 2020
 Update backtrace to 0.3.46

rust-lang/backtrace-rs#299 landed so we can stop patching backtrace in our tree.
bors-servo pushed a commit to servo/servo that referenced this pull request Mar 25, 2020
 Update backtrace to 0.3.46

rust-lang/backtrace-rs#299 landed so we can stop patching backtrace in our tree.
bors-servo pushed a commit to servo/servo that referenced this pull request Mar 25, 2020
 Update backtrace to 0.3.46

rust-lang/backtrace-rs#299 landed so we can stop patching backtrace in our tree.
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

3 participants