]> git.lizzy.rs Git - rust.git/blob - tests/debuginfo/thread-names.rs
Merge commit '7d53619064ab7045c383644cb445052d2a3d46db' into sync_cg_clif-2023-02-09
[rust.git] / tests / debuginfo / thread-names.rs
1 // compile-flags:-g
2 // We can't set the main thread name on Linux because it renames the process (#97191)
3 // ignore-linux
4 // ignore-android
5 // ignore-dragonfly
6 // ignore-emscripten
7 // ignore-freebsd
8 // ignore-haiku
9 // ignore-ios
10 // ignore-netbsd
11 // ignore-openbsd
12 // ignore-solaris
13 // ignore-sgx
14 // ignore-windows-gnu
15
16 // === GDB TESTS ==================================================================================
17 //
18 // gdb-command:run
19 //
20 // gdb-command:info threads
21 // gdb-check:  1    Thread [...] [...] "main" [...]
22 // gdb-check:* 2    Thread [...] [...] "my new thread" [...]
23
24 // === LLDB TESTS =================================================================================
25 //
26 // lldb-command:run
27 //
28 // lldb-command:thread info 1
29 // lldb-check:thread #1:[...]name = 'main'[...]
30 // lldb-command:thread info 2
31 // lldb-check:thread #2:[...]name = 'my new thread'[...]
32
33 // === CDB TESTS ==================================================================================
34 //
35 // cdb-command:g
36 //
37 // cdb-command:~
38 // cdb-check:   0  Id: [...] Suspend: 1 Teb: [...] Unfrozen "main"
39 // cdb-check:.  [...]  Id: [...] Suspend: 1 Teb: [...] Unfrozen "my new thread"
40
41 use std::thread;
42
43 fn main() {
44     let handle = thread::Builder::new().name("my new thread".into()).spawn(|| {
45         zzz(); // #break
46     }).unwrap();
47
48     handle.join().unwrap();
49 }
50
51 fn zzz() {}