[Bug 273056] devel/gdb: crashes when printing a Rust stack trace

From: <bugzilla-noreply_at_freebsd.org>
Date: Thu, 10 Aug 2023 21:37:32 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=273056

            Bug ID: 273056
           Summary: devel/gdb: crashes when printing a Rust stack trace
           Product: Ports & Packages
           Version: Latest
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: Individual Port(s)
          Assignee: pizzamig@freebsd.org
          Reporter: asomers@FreeBSD.org
             Flags: maintainer-feedback?(pizzamig@freebsd.org)
          Assignee: pizzamig@freebsd.org

The current version of gdb crashes when trying to print the stack trace of a
Rust program, if that program was built in debug mode.  Rust programs built in
release mode seem to be unaffected.  The crash message is:

internal-error: inside_main_func: Assertion `block != nullptr' failed

Affected gdb versions: 13.1 13.1_2, 13.1_3
Unaffected gdb versions: 12.1_2 12.1_3
Affected OS releases, 13.2-RELEASE, 14.0-CURRENT (today's build)
Affected Rust versions: 1.73.0-nightly, 1.68.0, 1.70.0, 1.63.0


Steps to Reproduce
==================
0) Install Rust, if you haven't already, from lang/rust or rustup.
1) git clone --depth=1 git@github.com:johalun/sysctl-rs.git
2) cd  sysctl-rs
3) cargo build --examples
4) rust-gdb target/debug/examples/value
  (gdb) b sysctlbyname
  Function "sysctlbyname" not defined.
  Make breakpoint pending on future shared library load? (y or [n]) y
  Breakpoint 1 (sysctlbyname) pending.
  (gdb) r
Starting program: /tmp/gdb-bug/sysctl-rs/target/debug/examples/value 

Breakpoint 1, sysctlbyname (
/wrkdirs/usr/home/somers/src/freebsd.org/ports/devel/gdb/work-py39/gdb-13.1/gdb/frame.c:2457:
internal-error: inside_main_func: Assertion `block != nullptr' failed.
A problem internal to GDB has been detected,
further debugging may prove unreliable.
----- Backtrace -----
0x130ff41 ???
0x17a9536 ???
0x17a9398 ???
0x1c3217e ???
0x1455aed ???
0x13d00a7 ???
0x13d3873 ???
0x13d214c ???
0x1709ce7 ???
0x17109c2 ???
0x1708666 ???
0x1706f05 ???
0x14cf527 ???
0x1345b85 ???
0x14dcae9 ???
0x14c85bf ???
0x14cbe36 ???
0x1c329f2 ???
0x1c32296 ???
0x152a259 ???
0x1527780 ???
0x121c4bd ???
0x8303fe629 __libc_start1
        /usr/home/somers/src/freebsd.org/src/lib/libc/csu/libc_start1.c:157
0x121c3bf ???
---------------------
/wrkdirs/usr/home/somers/src/freebsd.org/ports/devel/gdb/work-py39/gdb-13.1/gdb/frame.c:2457:
internal-error: inside_main_func: Assertion `block != nullptr' failed.
A problem internal to GDB has been detected,
further debugging may prove unreliable.


Note that sometimes you must type "bt" at the breakpoint to trigger the bug.

-- 
You are receiving this mail because:
You are the assignee for the bug.