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

Uclibc fixes #1

Open
wants to merge 71 commits into
base: master
Choose a base branch
from
Open

Uclibc fixes #1

wants to merge 71 commits into from

Conversation

plauche
Copy link

@plauche plauche commented Aug 29, 2020

No description provided.

plauche and others added 30 commits January 31, 2020 13:21
* Remove backtrace header and bump version

* re-trigger CI
rust-lang#298)

Fixes rust-lang#289

`mmap` should be available on all platforms we support (except Windows),
so we can use `libbacktrace`'s more efficient mmap-based code.
If dwarf debug info isn't available we fall back to searching the symbol
table. Typically this is done with `dladdr` on most platforms but with
gimli we typically have all the infrastructure already in place to do
the search ourselves. This functionality was already filled out on
Linux and Windows, but it wasn't implemented on macOS yet because it
wasn't necessary.

Implementing a pretty simple version, however, shows substantial
speedups for the various benchmarks. Presumably `dladdr` isn't exactly
the fastest thing in the world and our sorted list search which is
cached must be much faster here!

The current comparison of before/after this change looks like:

```
 name                                 before ns/iter  after ns/iter  diff ns/iter   diff %  speedup
 new                                  81,472          9,047               -72,425  -88.90%   x 9.01
 new_unresolved                       2,126           2,009                  -117   -5.50%   x 1.06
 new_unresolved_and_resolve_separate  82,252          9,134               -73,118  -88.90%   x 9.01
 trace                                1,273           1,185                   -88   -6.91%   x 1.07
 trace_and_resolve_callback           67,403          2,123               -65,280  -96.85%  x 31.75
 trace_and_resolve_separate           76,452          2,822               -73,630  -96.31%  x 27.09
```
* Add regression test for SIGPIPE on macOS

* Disable `mmap` on macOS

See rust-lang/rust#45866 for more details

* Run `cargo fmt`

* Remove unused variable name

* s/macos/darwin/

* Move macOS test to its own file

* Move macOS dSYM test to its own directory

* Remove 'darwin' check to verify new test

* Fix rustfmt

* Re-add darwin check

* Move macOS test to a non-workspace crate
* Add test case for line-tables-only

* Support line-tables-only when using libbacktrace

Previously when `backtrace_pcinfo` succeeded, but failed to obtain a
filename or a function name, the line number would be ignored. Instead,
when successful combine all available information.

For example, when using clang `-g1` or `-gline-tables-only` before:

```
   1: baz
   2: bar
   3: foo
```

and after:

```
   1: baz
             at src/callback.c:5
   2: bar
             at src/callback.c:9
   3: foo
             at src/callback.c:13
```

Co-authored-by: Tomasz Miąsko <[email protected]>
* Update libbacktrace to latest master

* Temporarily switch to t6/libbacktrace which has 5d4a5ff0d17040b5dd5dfaf2c3694b9a7b67b85d

* Define HAVE_MACH_O_DYLD_H on macOS
…ng#294)

* Define HAVE_KERN_PROC on FreeBSD to fix rust-lang/rust#54434

For the same reason define HAVE_KERN_PROC_ARGS on NetBSD.

This depends on having [1] available in libbacktrace.

[1] ianlancetaylor/libbacktrace@0f06cda

* Add dragonfly too
Try to slim down the dependencies of `gimli-symbolize`
This is a pretty small dependency for the `gimli-symbolize` feature, and
in an effort to reduce the number of external dependencies this commit
inlines the small amount of code we used from that crate here directly.
This should hopefully make this a bit easier to port to libstd
eventually.
* Remove coresymbolication implementation

This isn't used anywhere by default any more and I don't think there's
any reason to enable it. This older implementation uses private APIs
which aren't supposed to be used. Additionally libbacktrace nowadays
should be workable enough and with gimli soon on the horizon that should
be a suitable default for macOS and iOS.

* Disable android emulator in CI
* Remove dladdr fallback and implementation

This has been present for a very long time but I believe this has never
actually been that necessary. Non-MSVC platforms all use libbacktrace by
default, and libbacktrace will consult symbol tables of object files to
do what `dladdr` does, just inside of libbacktrace. Additionally gimli
implements the same logic. I believe that this means that `dladdr` isn't
necessary for resolving any symbols since our other strategies should
already be doing everything for us.

This commit makes the feature defunkt and otherwise removes the various
forms of fallback to dladdr.

* Switch to the `object` crate for object parsing

This commit switches the gimli feature from the `goblin` crate to the
`object` crate for parsing object files. The main motivation here is
trimming the dependencies of the `gimli-symbolize` feature to a bare
minimum. The `object` crate itself has no dependencies now and should be
a relatively easy drop-in replacement for the `goblin` crate.

* Parse fat libraries on macOS

This commit updates the object parsing code for macOS to support fat
libraries. This enables gimli to symbolize addresses coming from system
libraries which are currently installed frequently as fat libraries.

Closes rust-lang#319

* Fix macOS symbolication of system libraries

This commit fixes an issue where symbolication of system libraries
didn't work on macOS. Symbolication through the symbol table was always
off by a slide amount for the library. It's not entirely clear why this
kept happening or what was going on, but some poking in LLDB's source
revealed a way we can differentiate and figure out what addresses need
to be looked up in the symbol table. Some more information is contained
in the comments of the commit itself.

Closes rust-lang#318

Co-authored-by: Philip Craig <[email protected]>
Prunes out the `gimli-symbolize` dependency tree to just 3 crates!
alexcrichton and others added 29 commits May 12, 2020 12:14
It's not entirely clear to me if this'll fix the issue, or why this
issue is coming up, but maybe some biases are negative in some systems?
Make sure we keep the code up-to-date!
…g#341)

* Add the `Frame::sp` method to get the frame's stack pointer

* rustfmt
Try to stay on the update train for QEMU fixes
This commit uses the information and APIs learned from
rust-lang/rust#71060 to implement support for dynamic libraries on
MinGW. Previously symbols only worked if they came from the main
executable, but now the process's list of dynamic libraries are also
searched so we can symbolicate, for example, symbols in the compiler
which come from loaded libraries rather than the main executable.
ELF files allow debug info sections to be compressed. The libbacktrace
backed supported these compressed sections, but the Gimli backend did
not. This commit adds that support to the Gimli backend.

In my tests (with the BFD linker, lld, and gold) these debug info
sections do not obey the alignment requirements that the object crate
expects for the gABI compression header, so this commit additionally
enables the "unaligned" feature in the upcoming version of the object
crate.

There is a bit of unsafe to ensure the lifetime of the decompressed
sections matches the lifetime of the mmap'd file. I don't think there is
a way around this unsafe code, unless we are willing to ditch Gimli's
EndianSlice for an (apparently slower) EndianReader backed by a
Cow<[u8]>.

Fix rust-lang#342.
* Prepare for this crate to go into libstd

This commit is a preparation of this crate to be included as a submodule
into the standard library. I'm not 100% sold on this yet but I'm
somewhat convinced that this is going to happen this way. This is
progress on rust-lang#328 and a preview of what it might look like to implement
this strategy.

Currently I don't plan to merge this to the `master` branch unless it's
decided to move forward with this integration strategy of the
gimli feature of the backtrace crate.

* Update as-if-std integration
…ust-lang#361)

* Disable libbacktrace on DevkitA64

* Force noop symbolizer on DevkitA64 (for now)

* Add support for linkle's DWARF format to gimli symbolizer

* fmt

* Address review

* Subtract bias from len, revert back to wrapping_add

* Use Vec::with_capacity in mmap_fake

* fmt
Special-case platforms with `mmap` support, falling back to the `std::fs`
implementation for platforms that don't have it.
* Provide access to source column numbers of symbol locations, in
addition to filename and line numbers (where available - currently
only gimli).

* Print column numbers in backtraces, if available.

* cargo fmt

* Fixed breaking-change to public API, by delegating to new print_raw_with_column (as suggested by @alexcrichton in review rust-lang#367 (comment))

* Added tests for column numbers

* Reflect actual conditional compilation logic
in smoke test guards
* Module base address added to the Frame

* Test added for module base address of the Frame

* Process handle cached
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.