2014-07-09 07:46:09 -05:00
|
|
|
// This test case checks if function arguments already have the correct value when breaking at the
|
|
|
|
// beginning of a function.
|
|
|
|
|
2024-08-09 21:33:40 -05:00
|
|
|
//@ min-lldb-version: 1800
|
2014-07-09 07:46:09 -05:00
|
|
|
//@ ignore-gdb
|
|
|
|
//@ compile-flags:-g
|
|
|
|
|
|
|
|
// lldb-command:breakpoint set --name immediate_args
|
|
|
|
// lldb-command:breakpoint set --name non_immediate_args
|
|
|
|
// lldb-command:breakpoint set --name binding
|
|
|
|
// lldb-command:breakpoint set --name assignment
|
|
|
|
// lldb-command:breakpoint set --name function_call
|
|
|
|
// lldb-command:breakpoint set --name identifier
|
|
|
|
// lldb-command:breakpoint set --name return_expr
|
|
|
|
// lldb-command:breakpoint set --name arithmetic_expr
|
|
|
|
// lldb-command:breakpoint set --name if_expr
|
|
|
|
// lldb-command:breakpoint set --name while_expr
|
|
|
|
// lldb-command:breakpoint set --name loop_expr
|
|
|
|
// 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:[...] { 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:[...] { 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]
|
2014-07-09 07:46:09 -05:00
|
|
|
|
2015-03-25 19:06:52 -05:00
|
|
|
fn immediate_args(a: isize, b: bool, c: f64) {
|
2014-07-09 07:46:09 -05: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) {
|
|
|
|
()
|
|
|
|
}
|
|
|
|
|
|
|
|
fn binding(a: i64, b: u64, c: f64) {
|
2015-01-25 15:05:03 -06:00
|
|
|
let x = 0;
|
2014-07-09 07:46:09 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
fn assignment(mut a: u64, b: u64, c: f64) {
|
|
|
|
a = b;
|
|
|
|
}
|
|
|
|
|
|
|
|
fn function_call(x: u64, y: u64, z: f64) {
|
2015-04-14 16:37:14 -05:00
|
|
|
println!("Hi!")
|
2014-07-09 07:46:09 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
fn identifier(x: u64, y: u64, z: f64) -> u64 {
|
|
|
|
x
|
|
|
|
}
|
|
|
|
|
|
|
|
fn return_expr(x: u64, y: u64, z: f64) -> u64 {
|
|
|
|
return x;
|
|
|
|
}
|
|
|
|
|
|
|
|
fn arithmetic_expr(x: u64, y: u64, z: f64) -> u64 {
|
|
|
|
x + y
|
|
|
|
}
|
|
|
|
|
|
|
|
fn if_expr(x: u64, y: u64, z: f64) -> u64 {
|
|
|
|
if x + y < 1000 {
|
|
|
|
x
|
|
|
|
} else {
|
|
|
|
y
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
fn while_expr(mut x: u64, y: u64, z: u64) -> u64 {
|
|
|
|
while x + y < 1000 {
|
|
|
|
x += z
|
|
|
|
}
|
|
|
|
return x;
|
|
|
|
}
|
|
|
|
|
|
|
|
fn loop_expr(mut x: u64, y: u64, z: u64) -> u64 {
|
|
|
|
loop {
|
|
|
|
x += z;
|
|
|
|
|
|
|
|
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);
|
|
|
|
}
|