Skip to content

Fix CI and remove rustc-serialize #596

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Mar 28, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -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:
@@ -52,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"
7 changes: 0 additions & 7 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 7 additions & 7 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -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"]

#=======================================
49 changes: 0 additions & 49 deletions src/capture.rs
Original file line number Diff line number Diff line change
@@ -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<Vec<u8>>,
@@ -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<usize>,
symbols: Option<Vec<BacktraceSymbol>>,
}

impl Decodable for BacktraceFrame {
fn decode<D>(d: &mut D) -> Result<Self, D::Error>
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<E>(&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::*;
2 changes: 0 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
@@ -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]
7 changes: 2 additions & 5 deletions src/symbolize/gimli.rs
Original file line number Diff line number Diff line change
@@ -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<'_> {
12 changes: 0 additions & 12 deletions tests/smoke.rs
Original file line number Diff line number Diff line change
@@ -230,18 +230,6 @@ fn many_threads() {
}
}

#[test]
#[cfg(feature = "rustc-serialize")]
fn is_rustc_serialize() {
extern crate rustc_serialize;

fn is_encode<T: rustc_serialize::Encodable>() {}
fn is_decode<T: rustc_serialize::Decodable>() {}

is_encode::<backtrace::Backtrace>();
is_decode::<backtrace::Backtrace>();
}

#[test]
#[cfg(feature = "serde")]
fn is_serde() {