]> git.lizzy.rs Git - rust.git/blob - src/test/debuginfo/extern-c-fn.rs
Auto merge of #28816 - petrochenkov:unistruct, r=nrc
[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 // gdb-check:$1 = [...]"abcd"
20 // gdb-command:print len
21 // gdb-check:$2 = 20
22 // gdb-command:print local0
23 // gdb-check:$3 = 19
24 // gdb-command:print local1
25 // gdb-check:$4 = true
26 // gdb-command:print local2
27 // gdb-check:$5 = 20.5
28
29 // gdb-command:continue
30
31 // === LLDB TESTS ==================================================================================
32 // lldb-command:run
33
34 // lldb-command:print len
35 // lldb-check:[...]$0 = 20
36 // lldb-command:print local0
37 // lldb-check:[...]$1 = 19
38 // lldb-command:print local1
39 // lldb-check:[...]$2 = true
40 // lldb-command:print local2
41 // lldb-check:[...]$3 = 20.5
42
43 // lldb-command:continue
44
45 #![allow(unused_variables)]
46 #![allow(dead_code)]
47 #![feature(omit_gdb_pretty_printer_section)]
48 #![omit_gdb_pretty_printer_section]
49
50
51 #[no_mangle]
52 pub unsafe extern "C" fn fn_with_c_abi(s: *const u8, len: i32) -> i32 {
53     let local0 = len - 1;
54     let local1 = len > 2;
55     let local2 = (len as f64) + 0.5;
56
57     zzz(); // #break
58
59     return 0;
60 }
61
62 fn main() {
63     unsafe {
64         fn_with_c_abi(b"abcd\0".as_ptr(), 20);
65     }
66 }
67
68 #[inline(never)]
69 fn zzz() {()}