From ef24de24a82fe681581cc130f342363c47c0969a Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Fri, 7 Jun 2024 07:48:48 +0200 Subject: Merging upstream version 1.75.0+dfsg1. Signed-off-by: Daniel Baumann --- tests/debuginfo/coroutine-locals.rs | 87 ++++++++++++++++++++++++++++++++ tests/debuginfo/coroutine-objects.rs | 98 ++++++++++++++++++++++++++++++++++++ tests/debuginfo/function-names.rs | 20 ++++---- tests/debuginfo/generator-locals.rs | 87 -------------------------------- tests/debuginfo/generator-objects.rs | 98 ------------------------------------ tests/debuginfo/issue-57822.rs | 10 ++-- tests/debuginfo/simple-struct.rs | 2 +- 7 files changed, 201 insertions(+), 201 deletions(-) create mode 100644 tests/debuginfo/coroutine-locals.rs create mode 100644 tests/debuginfo/coroutine-objects.rs delete mode 100644 tests/debuginfo/generator-locals.rs delete mode 100644 tests/debuginfo/generator-objects.rs (limited to 'tests/debuginfo') diff --git a/tests/debuginfo/coroutine-locals.rs b/tests/debuginfo/coroutine-locals.rs new file mode 100644 index 000000000..e5eb1022f --- /dev/null +++ b/tests/debuginfo/coroutine-locals.rs @@ -0,0 +1,87 @@ +// min-lldb-version: 310 + +// compile-flags:-g + +// === GDB TESTS =================================================================================== + +// gdb-command:run +// gdb-command:print a +// gdb-check:$1 = 5 +// gdb-command:print c +// gdb-check:$2 = 6 +// gdb-command:print d +// gdb-check:$3 = 7 +// gdb-command:continue +// gdb-command:print a +// gdb-check:$4 = 7 +// gdb-command:print c +// gdb-check:$5 = 6 +// gdb-command:print e +// gdb-check:$6 = 8 +// gdb-command:continue +// gdb-command:print a +// gdb-check:$7 = 8 +// gdb-command:print c +// gdb-check:$8 = 6 + +// === LLDB TESTS ================================================================================== + +// lldb-command:run +// lldb-command:print a +// lldbg-check:(int) $0 = 5 +// lldbr-check:(int) a = 5 +// lldb-command:print c +// lldbg-check:(int) $1 = 6 +// lldbr-check:(int) c = 6 +// lldb-command:print d +// lldbg-check:(int) $2 = 7 +// lldbr-check:(int) d = 7 +// lldb-command:continue +// lldb-command:print a +// lldbg-check:(int) $3 = 7 +// lldbr-check:(int) a = 7 +// lldb-command:print c +// lldbg-check:(int) $4 = 6 +// lldbr-check:(int) c = 6 +// lldb-command:print e +// lldbg-check:(int) $5 = 8 +// lldbr-check:(int) e = 8 +// lldb-command:continue +// lldb-command:print a +// lldbg-check:(int) $6 = 8 +// lldbr-check:(int) a = 8 +// lldb-command:print c +// lldbg-check:(int) $7 = 6 +// lldbr-check:(int) c = 6 + +#![feature(omit_gdb_pretty_printer_section, coroutines, coroutine_trait)] +#![omit_gdb_pretty_printer_section] + +use std::ops::Coroutine; +use std::pin::Pin; + +fn main() { + let mut a = 5; + let mut b = || { + let c = 6; // Live across multiple yield points + + let d = 7; // Live across only one yield point + yield; + _zzz(); // #break + a = d; + + let e = 8; // Live across zero yield points + _zzz(); // #break + a = e; + + yield; + _zzz(); // #break + a = c; + }; + Pin::new(&mut b).resume(()); + Pin::new(&mut b).resume(()); + Pin::new(&mut b).resume(()); + _zzz(); // #break +} + +fn _zzz() {()} diff --git a/tests/debuginfo/coroutine-objects.rs b/tests/debuginfo/coroutine-objects.rs new file mode 100644 index 000000000..3e658b213 --- /dev/null +++ b/tests/debuginfo/coroutine-objects.rs @@ -0,0 +1,98 @@ +// Require a gdb that can read DW_TAG_variant_part. +// min-gdb-version: 8.2 + +// LLDB without native Rust support cannot read DW_TAG_variant_part, +// so it prints nothing for coroutines. But those tests are kept to +// ensure that LLDB won't crash at least (like #57822). + +// compile-flags:-g + +// === GDB TESTS =================================================================================== + +// gdb-command:run +// gdb-command:print b +// gdb-check:$1 = coroutine_objects::main::{coroutine_env#0}::Unresumed{_ref__a: 0x[...]} +// gdb-command:continue +// gdb-command:print b +// gdb-check:$2 = coroutine_objects::main::{coroutine_env#0}::Suspend0{c: 6, d: 7, _ref__a: 0x[...]} +// gdb-command:continue +// gdb-command:print b +// gdb-check:$3 = coroutine_objects::main::{coroutine_env#0}::Suspend1{c: 7, d: 8, _ref__a: 0x[...]} +// gdb-command:continue +// gdb-command:print b +// gdb-check:$4 = coroutine_objects::main::{coroutine_env#0}::Returned{_ref__a: 0x[...]} + +// === LLDB TESTS ================================================================================== + +// lldb-command:run +// lldb-command:print b +// lldbg-check:(coroutine_objects::main::{coroutine_env#0}) $0 = +// lldb-command:continue +// lldb-command:print b +// lldbg-check:(coroutine_objects::main::{coroutine_env#0}) $1 = +// lldb-command:continue +// lldb-command:print b +// lldbg-check:(coroutine_objects::main::{coroutine_env#0}) $2 = +// lldb-command:continue +// lldb-command:print b +// lldbg-check:(coroutine_objects::main::{coroutine_env#0}) $3 = + +// === CDB TESTS =================================================================================== + +// cdb-command: g +// cdb-command: dx b +// cdb-check: b : Unresumed [Type: enum2$] +// cdb-check: [+0x[...]] _ref__a : 0x[...] : 5 [Type: int *] + +// cdb-command: g +// cdb-command: dx b +// cdb-check: b : Suspend0 [Type: enum2$] +// cdb-check: [+0x[...]] c : 6 [Type: int] +// cdb-check: [+0x[...]] d : 7 [Type: int] +// cdb-check: [+0x[...]] _ref__a : 0x[...] : 5 [Type: int *] + +// cdb-command: g +// cdb-command: dx b +// cdb-check: b : Suspend1 [Type: enum2$] +// cdb-check: [+0x[...]] c : 7 [Type: int] +// cdb-check: [+0x[...]] d : 8 [Type: int] +// cdb-check: [+0x[...]] _ref__a : 0x[...] : 6 [Type: int *] + +// cdb-command: g +// cdb-command: dx b +// cdb-check: b : Returned [Type: enum2$] +// cdb-check: [+0x[...]] _ref__a : 0x[...] : 6 [Type: int *] + +#![feature(omit_gdb_pretty_printer_section, coroutines, coroutine_trait)] +#![omit_gdb_pretty_printer_section] + +use std::ops::Coroutine; +use std::pin::Pin; + +fn main() { + let mut a = 5; + let mut b = || { + let mut c = 6; + let mut d = 7; + + yield; + a += 1; + c += 1; + d += 1; + + yield; + println!("{} {} {}", a, c, d); + }; + _zzz(); // #break + Pin::new(&mut b).resume(()); + _zzz(); // #break + Pin::new(&mut b).resume(()); + _zzz(); // #break + Pin::new(&mut b).resume(()); + _zzz(); // #break +} + +#[inline(never)] +fn _zzz() { + () +} diff --git a/tests/debuginfo/function-names.rs b/tests/debuginfo/function-names.rs index d9aa03fee..d29b3ea76 100644 --- a/tests/debuginfo/function-names.rs +++ b/tests/debuginfo/function-names.rs @@ -31,8 +31,8 @@ // gdb-check:[...]static fn function_names::main::{closure#0}(*mut function_names::main::{closure_env#0}); // gdb-check:[...]static fn function_names::{impl#2}::impl_function::{closure#0}(*mut function_names::{impl#2}::impl_function::{closure_env#0}); -// Generator -// Generators don't seem to appear in GDB's symbol table. +// Coroutine +// Coroutines don't seem to appear in GDB's symbol table. // Const generic parameter // gdb-command:info functions -q function_names::const_generic_fn.* @@ -69,9 +69,9 @@ // cdb-check:[...] a!function_names::main::closure$0 (void) // cdb-check:[...] a!function_names::generic_func::closure$0 (void) -// Generator -// cdb-command:x a!function_names::*::generator* -// cdb-check:[...] a!function_names::main::generator$1 (void) +// Coroutine +// cdb-command:x a!function_names::*::coroutine* +// cdb-check:[...] a!function_names::main::coroutine$1 (void) // Const generic parameter // cdb-command:x a!function_names::const_generic_fn* @@ -83,10 +83,10 @@ #![allow(unused_variables)] #![feature(omit_gdb_pretty_printer_section)] #![omit_gdb_pretty_printer_section] -#![feature(adt_const_params, generators, generator_trait)] +#![feature(adt_const_params, coroutines, coroutine_trait)] #![allow(incomplete_features)] -use std::ops::Generator; +use std::ops::Coroutine; use std::pin::Pin; use Mod1::TestTrait2; @@ -110,12 +110,12 @@ fn main() { let closure = || TestStruct1; closure(); - // Generator - let mut generator = || { + // Coroutine + let mut coroutine = || { yield; return; }; - Pin::new(&mut generator).resume(()); + Pin::new(&mut coroutine).resume(()); // Const generic functions const_generic_fn_bool::(); diff --git a/tests/debuginfo/generator-locals.rs b/tests/debuginfo/generator-locals.rs deleted file mode 100644 index fd46c1a8b..000000000 --- a/tests/debuginfo/generator-locals.rs +++ /dev/null @@ -1,87 +0,0 @@ -// min-lldb-version: 310 - -// compile-flags:-g - -// === GDB TESTS =================================================================================== - -// gdb-command:run -// gdb-command:print a -// gdb-check:$1 = 5 -// gdb-command:print c -// gdb-check:$2 = 6 -// gdb-command:print d -// gdb-check:$3 = 7 -// gdb-command:continue -// gdb-command:print a -// gdb-check:$4 = 7 -// gdb-command:print c -// gdb-check:$5 = 6 -// gdb-command:print e -// gdb-check:$6 = 8 -// gdb-command:continue -// gdb-command:print a -// gdb-check:$7 = 8 -// gdb-command:print c -// gdb-check:$8 = 6 - -// === LLDB TESTS ================================================================================== - -// lldb-command:run -// lldb-command:print a -// lldbg-check:(int) $0 = 5 -// lldbr-check:(int) a = 5 -// lldb-command:print c -// lldbg-check:(int) $1 = 6 -// lldbr-check:(int) c = 6 -// lldb-command:print d -// lldbg-check:(int) $2 = 7 -// lldbr-check:(int) d = 7 -// lldb-command:continue -// lldb-command:print a -// lldbg-check:(int) $3 = 7 -// lldbr-check:(int) a = 7 -// lldb-command:print c -// lldbg-check:(int) $4 = 6 -// lldbr-check:(int) c = 6 -// lldb-command:print e -// lldbg-check:(int) $5 = 8 -// lldbr-check:(int) e = 8 -// lldb-command:continue -// lldb-command:print a -// lldbg-check:(int) $6 = 8 -// lldbr-check:(int) a = 8 -// lldb-command:print c -// lldbg-check:(int) $7 = 6 -// lldbr-check:(int) c = 6 - -#![feature(omit_gdb_pretty_printer_section, generators, generator_trait)] -#![omit_gdb_pretty_printer_section] - -use std::ops::Generator; -use std::pin::Pin; - -fn main() { - let mut a = 5; - let mut b = || { - let c = 6; // Live across multiple yield points - - let d = 7; // Live across only one yield point - yield; - _zzz(); // #break - a = d; - - let e = 8; // Live across zero yield points - _zzz(); // #break - a = e; - - yield; - _zzz(); // #break - a = c; - }; - Pin::new(&mut b).resume(()); - Pin::new(&mut b).resume(()); - Pin::new(&mut b).resume(()); - _zzz(); // #break -} - -fn _zzz() {()} diff --git a/tests/debuginfo/generator-objects.rs b/tests/debuginfo/generator-objects.rs deleted file mode 100644 index 11c4ae2f6..000000000 --- a/tests/debuginfo/generator-objects.rs +++ /dev/null @@ -1,98 +0,0 @@ -// Require a gdb that can read DW_TAG_variant_part. -// min-gdb-version: 8.2 - -// LLDB without native Rust support cannot read DW_TAG_variant_part, -// so it prints nothing for generators. But those tests are kept to -// ensure that LLDB won't crash at least (like #57822). - -// compile-flags:-g - -// === GDB TESTS =================================================================================== - -// gdb-command:run -// gdb-command:print b -// gdb-check:$1 = generator_objects::main::{generator_env#0}::Unresumed{_ref__a: 0x[...]} -// gdb-command:continue -// gdb-command:print b -// gdb-check:$2 = generator_objects::main::{generator_env#0}::Suspend0{c: 6, d: 7, _ref__a: 0x[...]} -// gdb-command:continue -// gdb-command:print b -// gdb-check:$3 = generator_objects::main::{generator_env#0}::Suspend1{c: 7, d: 8, _ref__a: 0x[...]} -// gdb-command:continue -// gdb-command:print b -// gdb-check:$4 = generator_objects::main::{generator_env#0}::Returned{_ref__a: 0x[...]} - -// === LLDB TESTS ================================================================================== - -// lldb-command:run -// lldb-command:print b -// lldbg-check:(generator_objects::main::{generator_env#0}) $0 = -// lldb-command:continue -// lldb-command:print b -// lldbg-check:(generator_objects::main::{generator_env#0}) $1 = -// lldb-command:continue -// lldb-command:print b -// lldbg-check:(generator_objects::main::{generator_env#0}) $2 = -// lldb-command:continue -// lldb-command:print b -// lldbg-check:(generator_objects::main::{generator_env#0}) $3 = - -// === CDB TESTS =================================================================================== - -// cdb-command: g -// cdb-command: dx b -// cdb-check: b : Unresumed [Type: enum2$] -// cdb-check: [+0x[...]] _ref__a : 0x[...] : 5 [Type: int *] - -// cdb-command: g -// cdb-command: dx b -// cdb-check: b : Suspend0 [Type: enum2$] -// cdb-check: [+0x[...]] c : 6 [Type: int] -// cdb-check: [+0x[...]] d : 7 [Type: int] -// cdb-check: [+0x[...]] _ref__a : 0x[...] : 5 [Type: int *] - -// cdb-command: g -// cdb-command: dx b -// cdb-check: b : Suspend1 [Type: enum2$] -// cdb-check: [+0x[...]] c : 7 [Type: int] -// cdb-check: [+0x[...]] d : 8 [Type: int] -// cdb-check: [+0x[...]] _ref__a : 0x[...] : 6 [Type: int *] - -// cdb-command: g -// cdb-command: dx b -// cdb-check: b : Returned [Type: enum2$] -// cdb-check: [+0x[...]] _ref__a : 0x[...] : 6 [Type: int *] - -#![feature(omit_gdb_pretty_printer_section, generators, generator_trait)] -#![omit_gdb_pretty_printer_section] - -use std::ops::Generator; -use std::pin::Pin; - -fn main() { - let mut a = 5; - let mut b = || { - let mut c = 6; - let mut d = 7; - - yield; - a += 1; - c += 1; - d += 1; - - yield; - println!("{} {} {}", a, c, d); - }; - _zzz(); // #break - Pin::new(&mut b).resume(()); - _zzz(); // #break - Pin::new(&mut b).resume(()); - _zzz(); // #break - Pin::new(&mut b).resume(()); - _zzz(); // #break -} - -#[inline(never)] -fn _zzz() { - () -} diff --git a/tests/debuginfo/issue-57822.rs b/tests/debuginfo/issue-57822.rs index 62e7eb13c..a12a562a0 100644 --- a/tests/debuginfo/issue-57822.rs +++ b/tests/debuginfo/issue-57822.rs @@ -1,5 +1,5 @@ // This test makes sure that the LLDB pretty printer does not throw an exception -// for nested closures and generators. +// for nested closures and coroutines. // Require a gdb that can read DW_TAG_variant_part. // min-gdb-version: 8.2 @@ -14,7 +14,7 @@ // gdb-check:$1 = issue_57822::main::{closure_env#1} {f: issue_57822::main::{closure_env#0} {x: 1}} // gdb-command:print b -// gdb-check:$2 = issue_57822::main::{generator_env#3}::Unresumed{a: issue_57822::main::{generator_env#2}::Unresumed{y: 2}} +// gdb-check:$2 = issue_57822::main::{coroutine_env#3}::Unresumed{a: issue_57822::main::{coroutine_env#2}::Unresumed{y: 2}} // === LLDB TESTS ================================================================================== @@ -24,12 +24,12 @@ // lldbg-check:(issue_57822::main::{closure_env#1}) $0 = { f = { x = 1 } } // lldb-command:print b -// lldbg-check:(issue_57822::main::{generator_env#3}) $1 = +// lldbg-check:(issue_57822::main::{coroutine_env#3}) $1 = -#![feature(omit_gdb_pretty_printer_section, generators, generator_trait)] +#![feature(omit_gdb_pretty_printer_section, coroutines, coroutine_trait)] #![omit_gdb_pretty_printer_section] -use std::ops::Generator; +use std::ops::Coroutine; use std::pin::Pin; fn main() { diff --git a/tests/debuginfo/simple-struct.rs b/tests/debuginfo/simple-struct.rs index aa3cf023a..fea810922 100644 --- a/tests/debuginfo/simple-struct.rs +++ b/tests/debuginfo/simple-struct.rs @@ -1,7 +1,7 @@ // min-lldb-version: 310 // ignore-gdb // Test temporarily ignored due to debuginfo tests being disabled, see PR 47155 -// compile-flags:-g +// compile-flags: -g -Zmir-enable-passes=-CheckAlignment // === GDB TESTS =================================================================================== -- cgit v1.2.3