]> git.lizzy.rs Git - rust.git/blob - tests/debuginfo/extern-c-fn.rs
Rollup merge of #107807 - GuillaumeGomez:fix-small-debug-typo, r=notriddle
[rust.git] / tests / debuginfo / extern-c-fn.rs
1 // min-lldb-version: 310
2
3 // compile-flags:-g
4
5 // === GDB TESTS ===================================================================================
6 // gdb-command:run
7
8 // gdb-command:printf "s = \"%s\"\n", s
9 // gdb-check:s = "abcd"
10 // gdb-command:print len
11 // gdb-check:$1 = 20
12 // gdb-command:print local0
13 // gdb-check:$2 = 19
14 // gdb-command:print local1
15 // gdb-check:$3 = true
16 // gdb-command:print local2
17 // gdb-check:$4 = 20.5
18
19 // gdb-command:continue
20
21 // === LLDB TESTS ==================================================================================
22 // lldb-command:run
23
24 // lldb-command:print len
25 // lldbg-check:[...]$0 = 20
26 // lldbr-check:(i32) len = 20
27 // lldb-command:print local0
28 // lldbg-check:[...]$1 = 19
29 // lldbr-check:(i32) local0 = 19
30 // lldb-command:print local1
31 // lldbg-check:[...]$2 = true
32 // lldbr-check:(bool) local1 = true
33 // lldb-command:print local2
34 // lldbg-check:[...]$3 = 20.5
35 // lldbr-check:(f64) local2 = 20.5
36
37 // lldb-command:continue
38
39 #![allow(unused_variables)]
40 #![allow(dead_code)]
41 #![feature(omit_gdb_pretty_printer_section)]
42 #![omit_gdb_pretty_printer_section]
43
44
45 #[no_mangle]
46 pub unsafe extern "C" fn fn_with_c_abi(s: *const u8, len: i32) -> i32 {
47     let local0 = len - 1;
48     let local1 = len > 2;
49     let local2 = (len as f64) + 0.5;
50
51     zzz(); // #break
52
53     return 0;
54 }
55
56 fn main() {
57     unsafe {
58         fn_with_c_abi(b"abcd\0".as_ptr(), 20);
59     }
60 }
61
62 #[inline(never)]
63 fn zzz() {()}