Opened 4 years ago

Last modified 9 months ago

#4 new defect

Show symbols of backtraces

Reported by: nielx Owned by: nielx
Priority: major Milestone:
Component: rustc Version: 1.2.0
Keywords: Cc:

Description

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

Change History (11)

comment:1 Changed 4 years ago by nielx

Component: component2rustc
Milestone: 1.0.0
Owner: changed from somebody to nielx

comment:2 Changed 4 years ago by nielx

Milestone: 1.0.01.1.0

Ticket retargeted after milestone closed

comment:3 Changed 4 years ago by nielx

Milestone: 1.1.01.2.0

Milestone renamed

comment:4 Changed 4 years ago by nielx

Milestone: 1.2.01.3.0

Ticket retargeted after milestone closed

comment:5 Changed 3 years ago by nielx

Milestone: 1.3.01.4.0

Ticket retargeted after milestone closed

comment:6 Changed 17 months ago by nielx

Version: 1.2.0

Preliminary investigation:

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.

comment:7 Changed 17 months ago by nielx

The issue might just be with libbacktrace. I have tried to run the make check on the source included with Rust, and the included btest did not seem to work right.

comment:8 Changed 11 months ago by nielx

Milestone: 1.4.0

Ticket retargeted after milestone deleted

comment:9 Changed 9 months ago by nielx

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.

comment:10 Changed 9 months ago by nielx

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.

comment:11 Changed 9 months ago by nielx

References:

Note: See TracTickets for help on using tickets.