From a4fa954daeb603d1eda4478f336e100a13236768 Mon Sep 17 00:00:00 2001 From: Sebastian Zivota Date: Fri, 23 Feb 2024 14:54:15 +0100 Subject: [PATCH] Integrate frame remapping into symbolicate_jvm --- crates/symbolicator-proguard/src/interface.rs | 2 ++ .../src/symbolication.rs | 19 ++++++++++++++++++- .../tests/integration/proguard.rs | 2 +- 3 files changed, 21 insertions(+), 2 deletions(-) diff --git a/crates/symbolicator-proguard/src/interface.rs b/crates/symbolicator-proguard/src/interface.rs index dee164bfa..19f0799e0 100644 --- a/crates/symbolicator-proguard/src/interface.rs +++ b/crates/symbolicator-proguard/src/interface.rs @@ -95,4 +95,6 @@ pub struct JvmModule { pub struct CompletedJvmSymbolicationResponse { /// The exceptions after remapping. pub exceptions: Vec, + /// The stacktraces after remapping. + pub stacktraces: Vec, } diff --git a/crates/symbolicator-proguard/src/symbolication.rs b/crates/symbolicator-proguard/src/symbolication.rs index f6e3baa01..c54085316 100644 --- a/crates/symbolicator-proguard/src/symbolication.rs +++ b/crates/symbolicator-proguard/src/symbolication.rs @@ -1,5 +1,6 @@ use crate::interface::{ - CompletedJvmSymbolicationResponse, JvmException, JvmFrame, SymbolicateJvmStacktraces, + CompletedJvmSymbolicationResponse, JvmException, JvmFrame, JvmStacktrace, + SymbolicateJvmStacktraces, }; use crate::ProguardService; @@ -14,6 +15,7 @@ impl ProguardService { scope, sources, exceptions, + stacktraces, modules, .. } = request; @@ -40,8 +42,23 @@ impl ProguardService { .push(Self::map_exception(&mappers, &raw_exception).unwrap_or(raw_exception)); } + let mut remapped_stacktraces = Vec::with_capacity(stacktraces.len()); + + for raw_stacktrace in stacktraces { + let remapped_frames = raw_stacktrace + .frames + .iter() + .flat_map(|frame| Self::map_frame(&mappers, frame).into_iter()) + .collect(); + + remapped_stacktraces.push(JvmStacktrace { + frames: remapped_frames, + }); + } + CompletedJvmSymbolicationResponse { exceptions: remapped_exceptions, + stacktraces: remapped_stacktraces, } } diff --git a/crates/symbolicator-proguard/tests/integration/proguard.rs b/crates/symbolicator-proguard/tests/integration/proguard.rs index eb9f73f97..3c0922130 100644 --- a/crates/symbolicator-proguard/tests/integration/proguard.rs +++ b/crates/symbolicator-proguard/tests/integration/proguard.rs @@ -98,7 +98,7 @@ async fn test_remap_exception() { apply_source_context: false, }; - let CompletedJvmSymbolicationResponse { exceptions } = + let CompletedJvmSymbolicationResponse { exceptions, .. } = symbolication.symbolicate_jvm(request).await; let remapped_exception = JvmException {