Files
binutils-gdb/gdb/testsuite/gdb.rust/finish.rs
Tom Tromey debd0556e5 Fix crash with "finish" in Rust
PR rust/30090 points out that a certain "finish" in a Rust program
will cause gdb to crash.  This happens due to some confusion about
field indices in rust_language::print_enum.  The fix is to use
value_primitive_field so that the correct type can be passed; other
spots in rust-lang.c already do this.

Note that the enclosed test case comes with an xfail.  This is needed
because for this function, rustc doesn't follow the platform ABI.

Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=30090
2023-02-27 11:12:11 -07:00

31 lines
908 B
Rust

// Copyright (C) 2023 Free Software Foundation, Inc.
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#![allow(warnings)]
enum MyResult {
None,
Some(u32)
}
fn return_some() -> MyResult {
MyResult::Some(97) // BREAK
}
fn main() {
let dei = return_some();
let another = return_some();
}