Bug 253557 - lang/rust: unbreak RUST_BACKTRACE
Summary: lang/rust: unbreak RUST_BACKTRACE
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: FreeBSD Rust Team
URL: https://github.com/rust-lang/rust/iss...
Keywords: buildisok, patch
Depends on:
Blocks:
 
Reported: 2021-02-16 14:53 UTC by Jan Beich
Modified: 2021-03-23 06:44 UTC (History)
1 user (show)

See Also:
tobik: maintainer-feedback+


Attachments
v1 (25.69 KB, patch)
2021-02-16 14:53 UTC, Jan Beich
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jan Beich freebsd_committer freebsd_triage 2021-02-16 14:53:07 UTC
Created attachment 222489 [details]
v1

Let's backport upstream fixes to improve debugging experience outside of lldb/gdb. I didn't try hard to figure out which rust-libc copy (out of 3) is actually used by gimli.

$ rustc foo.rs
$ cat foo.rs
fn main() {
    panic!("test");
}

Before:

  $ RUST_BACKTRACE=1 ./foo
  thread 'main' panicked at 'test', foo.rs:2:5
  stack backtrace:
  note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

  $ RUST_BACKTRACE=full ./foo
  thread 'main' panicked at 'test', foo.rs:2:5
  stack backtrace:
     0:          0x103b88c - <unknown>
     1:          0x106482e - <unknown>
     2:          0x103e0d3 - <unknown>
     3:          0x105142d - <unknown>
     4:          0x1051109 - <unknown>
     5:          0x1051a55 - <unknown>
     6:          0x1037067 - <unknown>
     7:          0x1036c88 - <unknown>
     8:          0x1036faf - <unknown>
     9:          0x1036dac - <unknown>
    10:          0x1036e5a - <unknown>
    11:          0x1036cbd - <unknown>
    12:          0x1037810 - <unknown>
    13:          0x1053897 - <unknown>
    14:          0x10377e6 - <unknown>
    15:          0x1036dd2 - <unknown>
    16:          0x1036152 - <unknown>

After:

  $ RUST_BACKTRACE=1 ./foo
  thread 'main' panicked at 'test', foo.rs:2:5
  stack backtrace:
     0: std::panicking::begin_panic
     1: foo::main
     2: core::ops::function::FnOnce::call_once
  note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

  $ RUST_BACKTRACE=full ./foo
  thread 'main' panicked at 'test', foo.rs:2:5
  stack backtrace:
     0:          0x103922c - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hfae40981c683065e
     1:          0x106755e - core::fmt::write::h0001cddca5707f2f
     2:          0x103fc13 - std::io::Write::write_fmt::h5065311bc325393f
     3:          0x105388d - std::panicking::default_hook::{{closure}}::h46488dcc7f63ea2a
     4:          0x1053442 - std::panicking::default_hook::hab86e3010cd23dc8
     5:          0x1053f33 - std::panicking::rust_panic_with_hook::h7e1eec77b252f630
     6:          0x1036e77 - std::panicking::begin_panic::{{closure}}::h48d3e795edb17de3
     7:          0x1036a98 - std::sys_common::backtrace::__rust_end_short_backtrace::h037ac64f2211a0e4
     8:          0x1036dbf - std::panicking::begin_panic::h8dc7b9a5c0a89bc8
     9:          0x1036bbc - foo::main::h2db1313a64510850
    10:          0x1036c5a - core::ops::function::FnOnce::call_once::hdcf13a72d77bd803
    11:          0x1036acd - std::sys_common::backtrace::__rust_begin_short_backtrace::h2e16a820ba2cd26c
    12:          0x1037620 - std::rt::lang_start::{{closure}}::h0031a264716041f7
    13:          0x105431b - std::rt::lang_start_internal::h6b2b475d129f0fdf
    14:          0x10375f6 - std::rt::lang_start::h998db6b74ebc2b8f
    15:          0x1036be2 - main
    16:          0x1035fa2 - _start
				 at /usr/src/lib/csu/amd64/crt1.c:76:7
Comment 1 Automation User 2021-03-03 00:11:06 UTC
Build and package info is available at https://gitlab.com/swills/freebsd-ports/pipelines/264429218
Comment 2 Tobias Kortkamp freebsd_committer freebsd_triage 2021-03-22 17:43:55 UTC
This seems fine to me. I'll commit it probably tomorrow along with a fix for DOCS.
Comment 3 commit-hook freebsd_committer freebsd_triage 2021-03-23 06:40:28 UTC
A commit references this bug:

Author: tobik
Date: Tue Mar 23 06:39:48 UTC 2021
New revision: 569007
URL: https://svnweb.freebsd.org/changeset/ports/569007

Log:
  lang/rust: Fix DOCS build, unbreak RUST_BACKTRACE

  - Fix DOCS build by disabling deny-warnings (rustc equivalent to
    -Werror).  Let's not fail the entire build just because a handful
    of docs fail to build due to -D broken-intra-doc-links [0]
  - Only install the host target docs.  We otherwise waste time with
    a rust-docs install-uninstall-install cycle for each additional
    target during stage.
  - Backport FreeBSD support for gimli, unbreak RUST_BACKTRACE, and
    have useful stack traces with actual content again [1]
  - While here also strip binaries under libexec/ and ack reading of
    src/bootstrap/CHANGELOG.md (changelog-seen=2)

  [0] https://github.com/rust-lang/rust/issues/76526

  PR:		253557 [1]
  Submitted by:	jbeich [1]

Changes:
  head/lang/rust/Makefile
  head/lang/rust/files/patch-backtrace
  head/lang/rust/files/patch-src_bootstrap_install.rs
  head/lang/rust-bootstrap/Makefile
Comment 4 Tobias Kortkamp freebsd_committer freebsd_triage 2021-03-23 06:44:39 UTC
Thanks!