2015-04-10 15:39:51 -05:00
|
|
|
// This test case checks if function arguments already have the correct value
|
|
|
|
// when breaking at the first line of the function, that is if the function
|
|
|
|
// prologue has already been executed at the first line. Note that because of
|
|
|
|
// the __morestack part of the prologue GDB incorrectly breaks at before the
|
|
|
|
// arguments have been properly loaded when setting the breakpoint via the
|
|
|
|
// function name.
|
2013-12-13 10:47:03 -06:00
|
|
|
|
2024-08-09 21:33:40 -05:00
|
|
|
//@ min-lldb-version: 1800
|
|
|
|
//@ compile-flags:-g -Zmir-enable-passes=-SingleUseConsts
|
|
|
|
// SingleUseConsts shouldn't need to be disabled, see #128945
|
2014-07-09 07:46:09 -05:00
|
|
|
|
|
|
|
// === GDB TESTS ===================================================================================
|
2014-04-24 04:35:48 -05:00
|
|
|
|
|
|
|
// gdb-command:run
|
2013-12-13 10:47:03 -06:00
|
|
|
|
|
|
|
// IMMEDIATE ARGS
|
2014-04-24 04:35:48 -05:00
|
|
|
// gdb-command:print a
|
|
|
|
// gdb-check:$1 = 1
|
|
|
|
// gdb-command:print b
|
|
|
|
// gdb-check:$2 = true
|
|
|
|
// gdb-command:print c
|
|
|
|
// gdb-check:$3 = 2.5
|
|
|
|
// gdb-command:continue
|
2013-12-13 10:47:03 -06:00
|
|
|
|
|
|
|
// NON IMMEDIATE ARGS
|
2014-04-24 04:35:48 -05:00
|
|
|
// gdb-command:print a
|
2016-10-25 16:32:04 -05:00
|
|
|
// gdbt-check:$4 = function_arg_initialization::BigStruct {a: 3, b: 4, c: 5, d: 6, e: 7, f: 8, g: 9, h: 10}
|
2014-04-24 04:35:48 -05:00
|
|
|
// gdb-command:print b
|
2016-10-25 16:32:04 -05:00
|
|
|
// gdbt-check:$5 = function_arg_initialization::BigStruct {a: 11, b: 12, c: 13, d: 14, e: 15, f: 16, g: 17, h: 18}
|
2014-04-24 04:35:48 -05:00
|
|
|
// gdb-command:continue
|
2013-12-13 10:47:03 -06:00
|
|
|
|
|
|
|
// BINDING
|
2014-04-24 04:35:48 -05:00
|
|
|
// gdb-command:print a
|
|
|
|
// gdb-check:$6 = 19
|
|
|
|
// gdb-command:print b
|
|
|
|
// gdb-check:$7 = 20
|
|
|
|
// gdb-command:print c
|
|
|
|
// gdb-check:$8 = 21.5
|
|
|
|
// gdb-command:continue
|
2013-12-13 10:47:03 -06:00
|
|
|
|
|
|
|
// ASSIGNMENT
|
2014-04-24 04:35:48 -05:00
|
|
|
// gdb-command:print a
|
|
|
|
// gdb-check:$9 = 22
|
|
|
|
// gdb-command:print b
|
|
|
|
// gdb-check:$10 = 23
|
|
|
|
// gdb-command:print c
|
|
|
|
// gdb-check:$11 = 24.5
|
|
|
|
// gdb-command:continue
|
2013-12-13 10:47:03 -06:00
|
|
|
|
|
|
|
// FUNCTION CALL
|
2014-04-24 04:35:48 -05:00
|
|
|
// gdb-command:print x
|
|
|
|
// gdb-check:$12 = 25
|
|
|
|
// gdb-command:print y
|
|
|
|
// gdb-check:$13 = 26
|
|
|
|
// gdb-command:print z
|
|
|
|
// gdb-check:$14 = 27.5
|
|
|
|
// gdb-command:continue
|
2013-12-13 10:47:03 -06:00
|
|
|
|
|
|
|
// EXPR
|
2014-04-24 04:35:48 -05:00
|
|
|
// gdb-command:print x
|
|
|
|
// gdb-check:$15 = 28
|
|
|
|
// gdb-command:print y
|
|
|
|
// gdb-check:$16 = 29
|
|
|
|
// gdb-command:print z
|
|
|
|
// gdb-check:$17 = 30.5
|
|
|
|
// gdb-command:continue
|
2013-12-13 10:47:03 -06:00
|
|
|
|
|
|
|
// RETURN EXPR
|
2014-04-24 04:35:48 -05:00
|
|
|
// gdb-command:print x
|
|
|
|
// gdb-check:$18 = 31
|
|
|
|
// gdb-command:print y
|
|
|
|
// gdb-check:$19 = 32
|
|
|
|
// gdb-command:print z
|
|
|
|
// gdb-check:$20 = 33.5
|
|
|
|
// gdb-command:continue
|
2013-12-13 10:47:03 -06:00
|
|
|
|
|
|
|
// ARITHMETIC EXPR
|
2014-04-24 04:35:48 -05:00
|
|
|
// gdb-command:print x
|
|
|
|
// gdb-check:$21 = 34
|
|
|
|
// gdb-command:print y
|
|
|
|
// gdb-check:$22 = 35
|
|
|
|
// gdb-command:print z
|
|
|
|
// gdb-check:$23 = 36.5
|
|
|
|
// gdb-command:continue
|
2013-12-13 10:47:03 -06:00
|
|
|
|
|
|
|
// IF EXPR
|
2014-04-24 04:35:48 -05:00
|
|
|
// gdb-command:print x
|
|
|
|
// gdb-check:$24 = 37
|
|
|
|
// gdb-command:print y
|
|
|
|
// gdb-check:$25 = 38
|
|
|
|
// gdb-command:print z
|
|
|
|
// gdb-check:$26 = 39.5
|
|
|
|
// gdb-command:continue
|
2013-12-13 10:47:03 -06:00
|
|
|
|
|
|
|
// WHILE EXPR
|
2014-04-24 04:35:48 -05:00
|
|
|
// gdb-command:print x
|
|
|
|
// gdb-check:$27 = 40
|
|
|
|
// gdb-command:print y
|
|
|
|
// gdb-check:$28 = 41
|
|
|
|
// gdb-command:print z
|
|
|
|
// gdb-check:$29 = 42
|
|
|
|
// gdb-command:continue
|
2013-12-13 10:47:03 -06:00
|
|
|
|
|
|
|
// LOOP EXPR
|
2014-04-24 04:35:48 -05:00
|
|
|
// gdb-command:print x
|
|
|
|
// gdb-check:$30 = 43
|
|
|
|
// gdb-command:print y
|
|
|
|
// gdb-check:$31 = 44
|
|
|
|
// gdb-command:print z
|
|
|
|
// gdb-check:$32 = 45
|
|
|
|
// gdb-command:continue
|
2013-12-13 10:47:03 -06:00
|
|
|
|
|
|
|
|
2014-07-09 07:46:09 -05:00
|
|
|
// === LLDB TESTS ==================================================================================
|
|
|
|
|
|
|
|
// lldb-command:run
|
|
|
|
|
|
|
|
// IMMEDIATE ARGS
|
2024-03-15 09:05:57 -05:00
|
|
|
// lldb-command:v a
|
2024-03-10 08:55:58 -05:00
|
|
|
// lldb-check:[...] 1
|
2024-03-15 09:05:57 -05:00
|
|
|
// lldb-command:v b
|
2024-03-10 08:55:58 -05:00
|
|
|
// lldb-check:[...] true
|
2024-03-15 09:05:57 -05:00
|
|
|
// lldb-command:v c
|
2024-03-10 08:55:58 -05:00
|
|
|
// lldb-check:[...] 2.5
|
2014-07-09 07:46:09 -05:00
|
|
|
// lldb-command:continue
|
|
|
|
|
|
|
|
// NON IMMEDIATE ARGS
|
2024-03-15 09:05:57 -05:00
|
|
|
// lldb-command:v a
|
2024-03-10 08:55:58 -05:00
|
|
|
// lldb-check:[...] BigStruct { a: 3, b: 4, c: 5, d: 6, e: 7, f: 8, g: 9, h: 10 }
|
2024-03-15 09:05:57 -05:00
|
|
|
// lldb-command:v b
|
2024-03-10 08:55:58 -05:00
|
|
|
// lldb-check:[...] BigStruct { a: 11, b: 12, c: 13, d: 14, e: 15, f: 16, g: 17, h: 18 }
|
2014-07-09 07:46:09 -05:00
|
|
|
// lldb-command:continue
|
|
|
|
|
|
|
|
// BINDING
|
2024-03-15 09:05:57 -05:00
|
|
|
// lldb-command:v a
|
2024-03-10 08:55:58 -05:00
|
|
|
// lldb-check:[...] 19
|
2024-03-15 09:05:57 -05:00
|
|
|
// lldb-command:v b
|
2024-03-10 08:55:58 -05:00
|
|
|
// lldb-check:[...] 20
|
2024-03-15 09:05:57 -05:00
|
|
|
// lldb-command:v c
|
2024-03-10 08:55:58 -05:00
|
|
|
// lldb-check:[...] 21.5
|
2014-07-09 07:46:09 -05:00
|
|
|
// lldb-command:continue
|
|
|
|
|
|
|
|
// ASSIGNMENT
|
2024-03-15 09:05:57 -05:00
|
|
|
// lldb-command:v a
|
2024-03-10 08:55:58 -05:00
|
|
|
// lldb-check:[...] 22
|
2024-03-15 09:05:57 -05:00
|
|
|
// lldb-command:v b
|
2024-03-10 08:55:58 -05:00
|
|
|
// lldb-check:[...] 23
|
2024-03-15 09:05:57 -05:00
|
|
|
// lldb-command:v c
|
2024-03-10 08:55:58 -05:00
|
|
|
// lldb-check:[...] 24.5
|
2014-07-09 07:46:09 -05:00
|
|
|
// lldb-command:continue
|
|
|
|
|
|
|
|
// FUNCTION CALL
|
2024-03-15 09:05:57 -05:00
|
|
|
// lldb-command:v x
|
2024-03-10 08:55:58 -05:00
|
|
|
// lldb-check:[...] 25
|
2024-03-15 09:05:57 -05:00
|
|
|
// lldb-command:v y
|
2024-03-10 08:55:58 -05:00
|
|
|
// lldb-check:[...] 26
|
2024-03-15 09:05:57 -05:00
|
|
|
// lldb-command:v z
|
2024-03-10 08:55:58 -05:00
|
|
|
// lldb-check:[...] 27.5
|
2014-07-09 07:46:09 -05:00
|
|
|
// lldb-command:continue
|
|
|
|
|
|
|
|
// EXPR
|
2024-03-15 09:05:57 -05:00
|
|
|
// lldb-command:v x
|
2024-03-10 08:55:58 -05:00
|
|
|
// lldb-check:[...] 28
|
2024-03-15 09:05:57 -05:00
|
|
|
// lldb-command:v y
|
2024-03-10 08:55:58 -05:00
|
|
|
// lldb-check:[...] 29
|
2024-03-15 09:05:57 -05:00
|
|
|
// lldb-command:v z
|
2024-03-10 08:55:58 -05:00
|
|
|
// lldb-check:[...] 30.5
|
2014-07-09 07:46:09 -05:00
|
|
|
// lldb-command:continue
|
|
|
|
|
|
|
|
// RETURN EXPR
|
2024-03-15 09:05:57 -05:00
|
|
|
// lldb-command:v x
|
2024-03-10 08:55:58 -05:00
|
|
|
// lldb-check:[...] 31
|
2024-03-15 09:05:57 -05:00
|
|
|
// lldb-command:v y
|
2024-03-10 08:55:58 -05:00
|
|
|
// lldb-check:[...] 32
|
2024-03-15 09:05:57 -05:00
|
|
|
// lldb-command:v z
|
2024-03-10 08:55:58 -05:00
|
|
|
// lldb-check:[...] 33.5
|
2014-07-09 07:46:09 -05:00
|
|
|
// lldb-command:continue
|
|
|
|
|
|
|
|
// ARITHMETIC EXPR
|
2024-03-15 09:05:57 -05:00
|
|
|
// lldb-command:v x
|
2024-03-10 08:55:58 -05:00
|
|
|
// lldb-check:[...] 34
|
2024-03-15 09:05:57 -05:00
|
|
|
// lldb-command:v y
|
2024-03-10 08:55:58 -05:00
|
|
|
// lldb-check:[...] 35
|
2024-03-15 09:05:57 -05:00
|
|
|
// lldb-command:v z
|
2024-03-10 08:55:58 -05:00
|
|
|
// lldb-check:[...] 36.5
|
2014-07-09 07:46:09 -05:00
|
|
|
// lldb-command:continue
|
|
|
|
|
|
|
|
// IF EXPR
|
2024-03-15 09:05:57 -05:00
|
|
|
// lldb-command:v x
|
2024-03-10 08:55:58 -05:00
|
|
|
// lldb-check:[...] 37
|
2024-03-15 09:05:57 -05:00
|
|
|
// lldb-command:v y
|
2024-03-10 08:55:58 -05:00
|
|
|
// lldb-check:[...] 38
|
2024-03-15 09:05:57 -05:00
|
|
|
// lldb-command:v z
|
2024-03-10 08:55:58 -05:00
|
|
|
// lldb-check:[...] 39.5
|
2014-07-09 07:46:09 -05:00
|
|
|
// lldb-command:continue
|
|
|
|
|
|
|
|
// WHILE EXPR
|
2024-03-15 09:05:57 -05:00
|
|
|
// lldb-command:v x
|
2024-03-10 08:55:58 -05:00
|
|
|
// lldb-check:[...] 40
|
2024-03-15 09:05:57 -05:00
|
|
|
// lldb-command:v y
|
2024-03-10 08:55:58 -05:00
|
|
|
// lldb-check:[...] 41
|
2024-03-15 09:05:57 -05:00
|
|
|
// lldb-command:v z
|
2024-03-10 08:55:58 -05:00
|
|
|
// lldb-check:[...] 42
|
2014-07-09 07:46:09 -05:00
|
|
|
// lldb-command:continue
|
|
|
|
|
|
|
|
// LOOP EXPR
|
2024-03-15 09:05:57 -05:00
|
|
|
// lldb-command:v x
|
2024-03-10 08:55:58 -05:00
|
|
|
// lldb-check:[...] 43
|
2024-03-15 09:05:57 -05:00
|
|
|
// lldb-command:v y
|
2024-03-10 08:55:58 -05:00
|
|
|
// lldb-check:[...] 44
|
2024-03-15 09:05:57 -05:00
|
|
|
// lldb-command:v z
|
2024-03-10 08:55:58 -05:00
|
|
|
// lldb-check:[...] 45
|
2014-07-09 07:46:09 -05:00
|
|
|
// lldb-command:continue
|
|
|
|
|
|
|
|
|
2014-10-27 17:37:07 -05:00
|
|
|
#![allow(unused_variables)]
|
2015-09-19 15:33:47 -05:00
|
|
|
#![feature(omit_gdb_pretty_printer_section)]
|
2014-12-03 16:48:18 -06:00
|
|
|
#![omit_gdb_pretty_printer_section]
|
2013-12-13 10:47:03 -06:00
|
|
|
|
2015-03-25 19:06:52 -05:00
|
|
|
fn immediate_args(a: isize, b: bool, c: f64) {
|
2016-05-28 03:30:08 -05:00
|
|
|
zzz(); // #break
|
2013-12-13 10:47:03 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
struct BigStruct {
|
|
|
|
a: u64,
|
|
|
|
b: u64,
|
|
|
|
c: u64,
|
|
|
|
d: u64,
|
|
|
|
e: u64,
|
|
|
|
f: u64,
|
|
|
|
g: u64,
|
|
|
|
h: u64
|
|
|
|
}
|
|
|
|
|
|
|
|
fn non_immediate_args(a: BigStruct, b: BigStruct) {
|
2016-05-28 03:30:08 -05:00
|
|
|
zzz(); // #break
|
2013-12-13 10:47:03 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
fn binding(a: i64, b: u64, c: f64) {
|
2015-01-25 15:05:03 -06:00
|
|
|
let x = 0; // #break
|
2019-09-13 04:36:35 -05:00
|
|
|
println!()
|
2013-12-13 10:47:03 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
fn assignment(mut a: u64, b: u64, c: f64) {
|
2014-07-09 07:46:09 -05:00
|
|
|
a = b; // #break
|
2019-09-13 04:36:35 -05:00
|
|
|
println!()
|
2013-12-13 10:47:03 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
fn function_call(x: u64, y: u64, z: f64) {
|
2016-05-28 03:30:08 -05:00
|
|
|
zzz(); // #break
|
2013-12-13 10:47:03 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
fn identifier(x: u64, y: u64, z: f64) -> u64 {
|
2014-07-09 07:46:09 -05:00
|
|
|
x // #break
|
2013-12-13 10:47:03 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
fn return_expr(x: u64, y: u64, z: f64) -> u64 {
|
2014-07-09 07:46:09 -05:00
|
|
|
return x; // #break
|
2013-12-13 10:47:03 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
fn arithmetic_expr(x: u64, y: u64, z: f64) -> u64 {
|
2014-07-09 07:46:09 -05:00
|
|
|
x + y // #break
|
2013-12-13 10:47:03 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
fn if_expr(x: u64, y: u64, z: f64) -> u64 {
|
2014-07-09 07:46:09 -05:00
|
|
|
if x + y < 1000 { // #break
|
2013-12-13 10:47:03 -06:00
|
|
|
x
|
|
|
|
} else {
|
|
|
|
y
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
fn while_expr(mut x: u64, y: u64, z: u64) -> u64 {
|
2014-07-09 07:46:09 -05:00
|
|
|
while x + y > 1000 { // #break
|
2013-12-13 10:47:03 -06:00
|
|
|
x += z
|
|
|
|
}
|
|
|
|
return x;
|
|
|
|
}
|
|
|
|
|
|
|
|
fn loop_expr(mut x: u64, y: u64, z: u64) -> u64 {
|
2016-08-13 22:34:14 -05:00
|
|
|
loop {
|
|
|
|
x += z; // #break
|
2013-12-13 10:47:03 -06:00
|
|
|
|
|
|
|
if x + y > 1000 {
|
|
|
|
return x;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
immediate_args(1, true, 2.5);
|
|
|
|
|
|
|
|
non_immediate_args(
|
|
|
|
BigStruct {
|
|
|
|
a: 3,
|
|
|
|
b: 4,
|
|
|
|
c: 5,
|
|
|
|
d: 6,
|
|
|
|
e: 7,
|
|
|
|
f: 8,
|
|
|
|
g: 9,
|
|
|
|
h: 10
|
|
|
|
},
|
|
|
|
BigStruct {
|
|
|
|
a: 11,
|
|
|
|
b: 12,
|
|
|
|
c: 13,
|
|
|
|
d: 14,
|
|
|
|
e: 15,
|
|
|
|
f: 16,
|
|
|
|
g: 17,
|
|
|
|
h: 18
|
|
|
|
}
|
|
|
|
);
|
|
|
|
|
|
|
|
binding(19, 20, 21.5);
|
|
|
|
assignment(22, 23, 24.5);
|
|
|
|
function_call(25, 26, 27.5);
|
|
|
|
identifier(28, 29, 30.5);
|
|
|
|
return_expr(31, 32, 33.5);
|
|
|
|
arithmetic_expr(34, 35, 36.5);
|
|
|
|
if_expr(37, 38, 39.5);
|
|
|
|
while_expr(40, 41, 42);
|
|
|
|
loop_expr(43, 44, 45);
|
|
|
|
}
|
2016-05-28 03:30:08 -05:00
|
|
|
|
|
|
|
fn zzz() {()}
|