From b76177c827a88e4452e0b78bbd5c57b06e6e96c9 Mon Sep 17 00:00:00 2001 From: Chris Denton Date: Sat, 23 Mar 2024 06:15:28 +0000 Subject: [PATCH 1/3] Test nightly and stable Windows --- .github/workflows/main.yml | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index ba83f75c..f8671dab 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -26,13 +26,18 @@ jobs: rust: stable - os: macos-latest rust: nightly - # HACK(jubilee): 1.77 broke backtraces on Windows lol - os: windows-latest - rust: 1.76.0-x86_64-msvc + rust: stable-x86_64-msvc - os: windows-latest - rust: 1.76.0-i686-msvc + rust: stable-i686-msvc - os: windows-latest - rust: 1.76.0-x86_64-gnu + rust: stable-x86_64-gnu + - os: windows-latest + rust: nightly-x86_64-msvc + - os: windows-latest + rust: nightly-i686-msvc + - os: windows-latest + rust: nightly-x86_64-gnu steps: - uses: actions/checkout@v3 with: From 8ff9b686672c803a61d824b1828e5efa1468bebe Mon Sep 17 00:00:00 2001 From: Chris Denton Date: Wed, 27 Mar 2024 06:21:54 +0000 Subject: [PATCH 2/3] Remove dead code --- src/symbolize/gimli.rs | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/symbolize/gimli.rs b/src/symbolize/gimli.rs index fa8e5972..51f1c803 100644 --- a/src/symbolize/gimli.rs +++ b/src/symbolize/gimli.rs @@ -472,10 +472,7 @@ pub unsafe fn resolve(what: ResolveWhat<'_>, cb: &mut dyn FnMut(&super::Symbol)) } if !any_frames { if let Some(name) = cx.object.search_symtab(addr as u64) { - call(Symbol::Symtab { - addr: addr as *mut c_void, - name, - }); + call(Symbol::Symtab { name }); } } }); @@ -491,7 +488,7 @@ pub enum Symbol<'a> { }, /// Couldn't find debug information, but we found it in the symbol table of /// the elf executable. - Symtab { addr: *mut c_void, name: &'a [u8] }, + Symtab { name: &'a [u8] }, } impl Symbol<'_> { From 6bc4fcabc01a3937ec12cf8e4b9e0101cfc08857 Mon Sep 17 00:00:00 2001 From: Chris Denton Date: Thu, 28 Mar 2024 13:02:58 +0000 Subject: [PATCH 3/3] Remove all traces of rustc-serialize --- .github/workflows/main.yml | 1 - Cargo.lock | 7 ------ Cargo.toml | 14 +++++------ src/capture.rs | 49 -------------------------------------- src/lib.rs | 2 -- tests/smoke.rs | 12 ---------- 6 files changed, 7 insertions(+), 78 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index f8671dab..b1dc816b 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -57,7 +57,6 @@ jobs: - run: cargo build - run: cargo test - - run: cargo test --features "serialize-rustc" - run: cargo test --features "serialize-serde" - run: cargo test --features "verify-winapi" - run: cargo test --features "cpp_demangle" diff --git a/Cargo.lock b/Cargo.lock index ba8c53f4..af2bbad8 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -44,7 +44,6 @@ dependencies = [ "miniz_oxide", "object", "rustc-demangle", - "rustc-serialize", "serde", "winapi", ] @@ -152,12 +151,6 @@ version = "0.1.23" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76" -[[package]] -name = "rustc-serialize" -version = "0.3.25" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fe834bc780604f4674073badbad26d7219cadfb4a2275802db12cbae17498401" - [[package]] name = "serde" version = "1.0.188" diff --git a/Cargo.toml b/Cargo.toml index e1ee1c37..9bd7b63c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -20,10 +20,10 @@ rust-version = "1.65.0" [workspace] members = ['crates/cpp_smoke_test', 'crates/as-if-std'] exclude = [ - 'crates/without_debuginfo', - 'crates/macos_frames_test', - 'crates/line-tables-only', - 'crates/debuglink', + 'crates/without_debuginfo', + 'crates/macos_frames_test', + 'crates/line-tables-only', + 'crates/debuglink', ] [dependencies] @@ -33,10 +33,11 @@ rustc-demangle = "0.1.4" # Optionally enable the ability to serialize a `Backtrace`, controlled through # the `serialize-*` features below. serde = { version = "1.0", optional = true, features = ['derive'] } -rustc-serialize = { version = "0.3", optional = true } # Optionally demangle C++ frames' symbols in backtraces. -cpp_demangle = { default-features = false, version = "0.4.0", optional = true, features = ["alloc"] } +cpp_demangle = { default-features = false, version = "0.4.0", optional = true, features = [ + "alloc", +] } [target.'cfg(not(all(windows, target_env = "msvc", not(target_vendor = "uwp"))))'.dependencies] miniz_oxide = { version = "0.7.0", default-features = false } @@ -71,7 +72,6 @@ std = [] # Methods of serialization # # Various features used for enabling rustc-serialize or syntex codegen. -serialize-rustc = ["rustc-serialize"] serialize-serde = ["serde"] #======================================= diff --git a/src/capture.rs b/src/capture.rs index 73d94dc4..d1691b89 100644 --- a/src/capture.rs +++ b/src/capture.rs @@ -21,7 +21,6 @@ use serde::{Deserialize, Serialize}; /// This function requires the `std` feature of the `backtrace` crate to be /// enabled, and the `std` feature is enabled by default. #[derive(Clone)] -#[cfg_attr(feature = "serialize-rustc", derive(RustcDecodable, RustcEncodable))] #[cfg_attr(feature = "serde", derive(Deserialize, Serialize))] pub struct Backtrace { // Frames here are listed from top-to-bottom of the stack @@ -116,7 +115,6 @@ impl Frame { /// This function requires the `std` feature of the `backtrace` crate to be /// enabled, and the `std` feature is enabled by default. #[derive(Clone)] -#[cfg_attr(feature = "serialize-rustc", derive(RustcDecodable, RustcEncodable))] #[cfg_attr(feature = "serde", derive(Deserialize, Serialize))] pub struct BacktraceSymbol { name: Option>, @@ -440,53 +438,6 @@ impl fmt::Debug for BacktraceSymbol { } } -#[cfg(feature = "serialize-rustc")] -mod rustc_serialize_impls { - use super::*; - use rustc_serialize::{Decodable, Decoder, Encodable, Encoder}; - - #[derive(RustcEncodable, RustcDecodable)] - struct SerializedFrame { - ip: usize, - symbol_address: usize, - module_base_address: Option, - symbols: Option>, - } - - impl Decodable for BacktraceFrame { - fn decode(d: &mut D) -> Result - where - D: Decoder, - { - let frame: SerializedFrame = SerializedFrame::decode(d)?; - Ok(BacktraceFrame { - frame: Frame::Deserialized { - ip: frame.ip, - symbol_address: frame.symbol_address, - module_base_address: frame.module_base_address, - }, - symbols: frame.symbols, - }) - } - } - - impl Encodable for BacktraceFrame { - fn encode(&self, e: &mut E) -> Result<(), E::Error> - where - E: Encoder, - { - let BacktraceFrame { frame, symbols } = self; - SerializedFrame { - ip: frame.ip() as usize, - symbol_address: frame.symbol_address() as usize, - module_base_address: frame.module_base_address().map(|addr| addr as usize), - symbols: symbols.clone(), - } - .encode(e) - } - } -} - #[cfg(feature = "serde")] mod serde_impls { use super::*; diff --git a/src/lib.rs b/src/lib.rs index 5b97281a..7b4bbc2e 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -97,8 +97,6 @@ // irrelevant as this crate is developed out-of-tree. #![cfg_attr(backtrace_in_libstd, allow(warnings))] #![cfg_attr(not(feature = "std"), allow(dead_code))] -// We know this is deprecated, it's only here for back-compat reasons. -#![cfg_attr(feature = "rustc-serialize", allow(deprecated))] #[cfg(feature = "std")] #[macro_use] diff --git a/tests/smoke.rs b/tests/smoke.rs index b47f0232..9c87f530 100644 --- a/tests/smoke.rs +++ b/tests/smoke.rs @@ -230,18 +230,6 @@ fn many_threads() { } } -#[test] -#[cfg(feature = "rustc-serialize")] -fn is_rustc_serialize() { - extern crate rustc_serialize; - - fn is_encode() {} - fn is_decode() {} - - is_encode::(); - is_decode::(); -} - #[test] #[cfg(feature = "serde")] fn is_serde() {