Skip to content

NetBSD: backtrace support broken #96914

Closed
@0-wiz-0

Description

@0-wiz-0

I tried this code:

fn main() { panic!("explode!") }                                                                                                                

I expected to see this happen:

$ rustc t.rs
$ ./t
thread 'main' panicked at 'explode!', t.rs:1:13
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
$ RUST_BACKTRACE=1 ./t
thread 'main' panicked at 'explode!', t.rs:1:13
stack backtrace:
   0: std::panicking::begin_panic
   1: t::main
   2: core::ops::function::FnOnce::call_once
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

(provided by a friendly Linux user)

Instead, this happened (on NetBSD)

I see this instead:

$ ./t    
thread 'main' panicked at 'explode!', t.rs:1:13
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
$ RUST_BACKTRACE=1 ./t
thread 'main' panicked at 'explode!', t.rs:1:13
stack backtrace:
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
$ RUST_BACKTRACE=full ./t
thread 'main' panicked at 'explode!', t.rs:1:13
stack backtrace:
   0:         0x6dc13726 - <unknown>
   1:         0x6dc3790c - <unknown>
   2:         0x6dc25ea5 - <unknown>
   3:         0x6dc0c981 - <unknown>
   4:         0x6dc0c581 - <unknown>
   5:         0x6dc0ced1 - <unknown>
   6:         0x6dc07a9e - <unknown>
   7:         0x6dc07d85 - <unknown>
   8:         0x6dc07a22 - <unknown>
   9:         0x6dc07e79 - <unknown>
  10:         0x6dc07f63 - <unknown>
  11:         0x6dc07d29 - <unknown>
  12:         0x6dc08749 - <unknown>
  13:         0x6dc209a1 - <unknown>
  14:         0x6dc08731 - <unknown>
  15:         0x6dc07f03 - <unknown>
  16:         0x6dc05b7d - <unknown>

Meta

rustc --version --verbose:

rustc 1.59.0
binary: rustc
commit-hash: unknown
commit-date: unknown
host: x86_64-unknown-netbsd
release: 1.59.0
LLVM version: 13.0.1
Backtrace

Yes, exactly that's the problem.

On the C level, I know that Linux provides the backtrace() family of functions in libc.
NetBSD provides all the functions too, but you need to link against libexecinfo, see
https://man.netbsd.org/backtrace.3

So I guess it's probably not too hard to add, I hope someone can take this on.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-runtimeArea: std's runtime and "pre-main" init for handling backtraces, unwinds, stack overflowsC-bugCategory: This is a bug.O-netbsdOperating system: NetBSD

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions