(sig: i32)
| 17 | |
| 18 | #[cfg(not(debug_assertions))] |
| 19 | extern "C" fn breakdown_signal_handler(sig: i32) { |
| 20 | let mut stack = vec![]; |
| 21 | backtrace::trace(|frame| { |
| 22 | backtrace::resolve_frame(frame, |symbol| { |
| 23 | if let Some(name) = symbol.name() { |
| 24 | stack.push(name.to_string()); |
| 25 | } |
| 26 | }); |
| 27 | true // keep going to the next frame |
| 28 | }); |
| 29 | let mut info = String::default(); |
| 30 | if stack.iter().any(|s| { |
| 31 | s.contains(&"nouveau_pushbuf_kick") |
| 32 | || s.to_lowercase().contains("nvidia") |
| 33 | || s.contains("gdk_window_end_draw_frame") |
| 34 | || s.contains("glGetString") |
| 35 | }) { |
| 36 | Config::set_option("allow-always-software-render".to_string(), "Y".to_string()); |
| 37 | info = "Always use software rendering will be set.".to_string(); |
| 38 | log::info!("{}", info); |
| 39 | } |
| 40 | if stack.iter().any(|s| { |
| 41 | s.to_lowercase().contains("nvidia") |
| 42 | || s.to_lowercase().contains("amf") |
| 43 | || s.to_lowercase().contains("mfx") |
| 44 | || s.contains("cuProfilerStop") |
| 45 | }) { |
| 46 | Config::set_option("enable-hwcodec".to_string(), "N".to_string()); |
| 47 | info = "Perhaps hwcodec causing the crash, disable it first".to_string(); |
| 48 | log::info!("{}", info); |
| 49 | } |
| 50 | log::error!( |
| 51 | "Got signal {} and exit. stack:\n{}", |
| 52 | sig, |
| 53 | stack.join("\n").to_string() |
| 54 | ); |
| 55 | if !info.is_empty() { |
| 56 | #[cfg(target_os = "linux")] |
| 57 | linux::system_message( |
| 58 | "RustDesk", |
| 59 | &format!("Got signal {} and exit.{}", sig, info), |
| 60 | true, |
| 61 | ) |
| 62 | .ok(); |
| 63 | } |
| 64 | unsafe { |
| 65 | if let Some(callback) = &GLOBAL_CALLBACK { |
| 66 | callback() |
| 67 | } |
| 68 | } |
| 69 | exit(0); |
| 70 | } |
| 71 | |
| 72 | #[cfg(not(debug_assertions))] |
| 73 | pub fn register_breakdown_handler<T>(callback: T) |
nothing calls this directly
no test coverage detected