diff --git a/crashtracker/build.rs b/crashtracker/build.rs index 1c48fa938..fdb4138a9 100644 --- a/crashtracker/build.rs +++ b/crashtracker/build.rs @@ -10,24 +10,18 @@ fn main() { "x86_64-unknown-linux-gnu"| "x86_64-unknown-linux-musl" => "x86_64", "i686-unknown-linux-gnu"|"i586-unknown-linux-gnu" => "x86", "arm-unknown-linux-gnueabihf" => "arm", + "aarch64-unknown-linux-gnu" => "aarch64", _ => "" }; if link_lib_arch.is_empty() { println!("cargo:warning=target {} is unsupported",target); return; } - + println!("cargo:rustc-link-search=native=/usr/local/lib"); println!("cargo:rustc-link-search=native=/usr/lib"); #[cfg(target_arch = "x86_64")] println!("cargo:rustc-link-search=native=/usr/lib/x86_64-linux-gnu"); - if target.contains("musl") { - // possibly lzma compressed symbol tables. Do we really need it ? - println!("cargo:rustc-link-lib=static=lzma"); - println!("cargo:rustc-link-lib=static=unwind"); - } - else { - println!("cargo:rustc-link-lib=static=unwind-{}", link_lib_arch); - println!("cargo:rustc-link-lib=static=unwind"); - } -} + println!("cargo:rustc-link-lib=static=unwind-{}", link_lib_arch); + println!("cargo:rustc-link-lib=static=unwind"); +} \ No newline at end of file diff --git a/crashtracker/src/collector/emitters.rs b/crashtracker/src/collector/emitters.rs index 2491e9074..ef451caf1 100644 --- a/crashtracker/src/collector/emitters.rs +++ b/crashtracker/src/collector/emitters.rs @@ -20,7 +20,7 @@ use std::ffi::CStr; #[cfg(target_arch = "x86_64")] use crate::collector::libunwind_x86_64 as libunwind; -#[cfg(target_arch = "arm")] +#[cfg(target_arch = "aarch64")] use crate::collector::libunwind_arm as libunwind; use libunwind::{UnwCursor, UnwContext, unw_init_local, unw_step, unw_get_reg, unw_get_proc_name, UNW_REG_IP, UNW_REG_SP}; @@ -107,7 +107,7 @@ fn emit_backtrace_libuwnind( if unw_init_local(&mut cursor, context) != 0 { writeln!(w, "{{ \"error\": \"Failed to initialize cursor from context\" }}")?; writeln!(w, "{DD_CRASHTRACK_END_STACKTRACE}")?; - w.flush()?; + w.flush()?; return Err(anyhow::anyhow!("Failed to initialize cursor from context")); } @@ -134,7 +134,7 @@ fn emit_backtrace_libuwnind( symbol_address = ip - offset; } // we could also retrieve the elf offsets using the libunwind APIs if needed. - writeln!(w, "{{ \"ip\": \"{:#x}\", \"sp\": \"{:#x}\", \"symbol_address\": \"{:#x}\", \"function\": \"{}\", \"offset\": \"0x{:x}\" }}", + writeln!(w, "{{ \"ip\": \"{:#x}\", \"sp\": \"{:#x}\", \"symbol_address\": \"{:#x}\", \"function\": \"{}\", \"offset\": \"0x{:x}\" }}", ip, sp, symbol_address, func_name, offset)?; } else { writeln!(w, "{{ \"ip\": \"{:#x}\", \"sp\": \"{:#x}\" }}", ip, sp)?; @@ -148,7 +148,7 @@ fn emit_backtrace_libuwnind( writeln!(w, "{DD_CRASHTRACK_END_STACKTRACE}")?; } - w.flush()?; + w.flush()?; Ok(()) } @@ -180,7 +180,7 @@ pub(crate) fn emit_crashreport( // https://doc.rust-lang.org/src/std/backtrace.rs.html#332 // Do this last, so even if it crashes, we still get the other info. if config.resolve_frames != StacktraceCollection::Disabled { - if config.stacktrace_unwinding == StackTraceUnwinding::Backtrace { + if config.stacktrace_unwinding == StackTraceUnwinding::Backtrace { unsafe { emit_backtrace_by_frames(pipe, config.resolve_frames)? }; } else { emit_backtrace_libuwnind(pipe, ucontext, config.resolve_frames == StacktraceCollection::EnabledWithInprocessSymbols)?; @@ -343,4 +343,4 @@ fn emit_text_file(w: &mut impl Write, path: &str) -> anyhow::Result<()> { writeln!(w, "\n{DD_CRASHTRACK_END_FILE} \"{path}\"")?; w.flush()?; Ok(()) -} +} \ No newline at end of file diff --git a/crashtracker/src/collector/mod.rs b/crashtracker/src/collector/mod.rs index 2fc1f8762..3cc38840c 100644 --- a/crashtracker/src/collector/mod.rs +++ b/crashtracker/src/collector/mod.rs @@ -18,10 +18,10 @@ pub use additional_tags::{ #[cfg(target_arch = "x86_64")] pub mod libunwind_x86_64; -#[cfg(target_arch = "arm")] +#[cfg(target_arch = "aarch64")] pub mod libunwind_arm; pub use api::*; pub use counters::{begin_op, end_op, reset_counters, OpTypes}; pub use crash_handler::{update_config, update_metadata}; -pub use spans::{clear_spans, clear_traces, insert_span, insert_trace, remove_span, remove_trace}; +pub use spans::{clear_spans, clear_traces, insert_span, insert_trace, remove_span, remove_trace}; \ No newline at end of file