]> git.lizzy.rs Git - rust.git/blob - src/test/debuginfo/extern-c-fn.rs
Rollup merge of #54933 - ljedrz:cleanup_codegen_llvm/misc, r=varkor
[rust.git] / src / test / debuginfo / extern-c-fn.rs
1 // Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
4 //
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
10
11 // min-lldb-version: 310
12
13 // compile-flags:-g
14
15 // === GDB TESTS ===================================================================================
16 // gdb-command:run
17
18 // gdb-command:print s
19 // gdbg-check:$1 = [...]"abcd"
20 // gdbr-check:$1 = [...]"abcd\000"
21 // gdb-command:print len
22 // gdb-check:$2 = 20
23 // gdb-command:print local0
24 // gdb-check:$3 = 19
25 // gdb-command:print local1
26 // gdb-check:$4 = true
27 // gdb-command:print local2
28 // gdb-check:$5 = 20.5
29
30 // gdb-command:continue
31
32 // === LLDB TESTS ==================================================================================
33 // lldb-command:run
34
35 // lldb-command:print len
36 // lldbg-check:[...]$0 = 20
37 // lldbr-check:(i32) len = 20
38 // lldb-command:print local0
39 // lldbg-check:[...]$1 = 19
40 // lldbr-check:(i32) local0 = 19
41 // lldb-command:print local1
42 // lldbg-check:[...]$2 = true
43 // lldbr-check:(bool) local1 = true
44 // lldb-command:print local2
45 // lldbg-check:[...]$3 = 20.5
46 // lldbr-check:(f64) local2 = 20.5
47
48 // lldb-command:continue
49
50 #![allow(unused_variables)]
51 #![allow(dead_code)]
52 #![feature(omit_gdb_pretty_printer_section)]
53 #![omit_gdb_pretty_printer_section]
54
55
56 #[no_mangle]
57 pub unsafe extern "C" fn fn_with_c_abi(s: *const u8, len: i32) -> i32 {
58     let local0 = len - 1;
59     let local1 = len > 2;
60     let local2 = (len as f64) + 0.5;
61
62     zzz(); // #break
63
64     return 0;
65 }
66
67 fn main() {
68     unsafe {
69         fn_with_c_abi(b"abcd\0".as_ptr(), 20);
70     }
71 }
72
73 #[inline(never)]
74 fn zzz() {()}