Skip to content

Show symbols of backtraces #2

@nielx

Description

@nielx

Rust has internals to show the backtrace after a panic!. The symbols are not showing, unfortunately.

Update on 25-10-2018:
Preliminary investigation:

  • ​libpanic_unwind
  • libstd/sys_common/backtrace.rs
    ​- libstd/sys/unix/backtrace
    ​- libstd/sys_common/gnu/backtrace.rs
    The system for resolving symbols is quite elaborate, but it seems that on Haiku the ​libbacktrace is used. It would be good to start testing there.

Update on 24-06-2018:
Tested so far:

  • The combination on Haiku could be libunwind for getting the stack traces, and dladdr to get the symbols.
  • When I write my own little cpp to test these functions, everything works out great. Libunwind finds the proper stack trace, and dladdr finds the symbol names.
  • When I switch over to a rustc compiled program things go awry. All the symbol names are set to _init.
  • I checked rustc's libc: the definitions for Dl_info and dladdr are good.
  • I checked the ip-addresses of the stack trace: they match what I find in debugger, so libunwind seems to be working just fine.
  • These ip addresses are also being fed to dladdr, but there it goes awry: the only symbol name that is returned is _init.
  • Hypothesis: the output of rustc is different in such a way that the symbol names cannot be found by the method of dladdr.

Update on 24-06-2018:
I figured it out. The problem is exactly the issue about local symbol tables that is mentioned in the ​rust source. I have verified this by manually adding the -export-dynamic to the link flags. Then the symbol names are available.
Thus in short: we cannot use dladdr on Haiku to resolve symbols.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugupstreamTickets that track the upstreaming of patcheswaitingWaiting for an external action (like a PR approval)

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions