pub struct ProguardCache<'data> { /* private fields */ }Expand description
The serialized ProguardCache binary format.
Implementations§
Source§impl<'data> ProguardCache<'data>
impl<'data> ProguardCache<'data>
Sourcepub fn debug_classes<'r>(
&'r self,
) -> impl Iterator<Item = ClassDebug<'r, 'data>>
pub fn debug_classes<'r>( &'r self, ) -> impl Iterator<Item = ClassDebug<'r, 'data>>
Returns an iterator over class entries in this cache file that can be debug printed.
Sourcepub fn debug_members<'r>(
&'r self,
) -> impl Iterator<Item = MemberDebug<'r, 'data>>
pub fn debug_members<'r>( &'r self, ) -> impl Iterator<Item = MemberDebug<'r, 'data>>
Returns an iterator over member entries in this cache file that can be debug printed.
Sourcepub fn debug_members_by_params<'r>(
&'r self,
) -> impl Iterator<Item = MemberDebug<'r, 'data>>
pub fn debug_members_by_params<'r>( &'r self, ) -> impl Iterator<Item = MemberDebug<'r, 'data>>
Returns an iterator over by-params member entries in this cache file that can be debug printed.
Source§impl<'data> ProguardCache<'data>
impl<'data> ProguardCache<'data>
Sourcepub fn parse(buf: &'data [u8]) -> Result<Self, CacheError>
pub fn parse(buf: &'data [u8]) -> Result<Self, CacheError>
Parses a ProguardCache out of bytes.
Sourcepub fn write<W: Write>(
mapping: &ProguardMapping<'_>,
writer: &mut W,
) -> Result<()>
pub fn write<W: Write>( mapping: &ProguardMapping<'_>, writer: &mut W, ) -> Result<()>
Writes a ProguardMapping into a writer in the proguard cache format.
Source§impl<'data> ProguardCache<'data>
impl<'data> ProguardCache<'data>
Sourcepub fn remap_class(&self, class: &str) -> Option<&'data str>
pub fn remap_class(&self, class: &str) -> Option<&'data str>
Remaps an obfuscated Class.
This works on the fully-qualified name of the class, with its complete module prefix.
§Examples
use proguard::{ProguardMapping, ProguardCache};
let mapping = ProguardMapping::new(br#"android.arch.core.executor.ArchTaskExecutor -> a.a.a.a.c:"#);
let mut cache = Vec::new();
ProguardCache::write(&mapping, &mut cache).unwrap();
let cache = ProguardCache::parse(&cache).unwrap();
let mapped = cache.remap_class("a.a.a.a.c");
assert_eq!(mapped, Some("android.arch.core.executor.ArchTaskExecutor"));Sourcepub fn remap_method(
&self,
class: &str,
method: &str,
) -> Option<(&'data str, &'data str)>
pub fn remap_method( &self, class: &str, method: &str, ) -> Option<(&'data str, &'data str)>
Remaps an obfuscated Class Method.
The class argument has to be the fully-qualified obfuscated name of the
class, with its complete module prefix.
If the method can be resolved unambiguously, it will be returned
alongside the remapped class, otherwise None is being returned.
Sourcepub fn remap_frame<'r: 'data>(
&'r self,
frame: &StackFrame<'data>,
) -> RemappedFrameIter<'r, 'data>
pub fn remap_frame<'r: 'data>( &'r self, frame: &StackFrame<'data>, ) -> RemappedFrameIter<'r, 'data>
Remaps a single Stackframe.
Returns zero or more StackFrames, based on the information in
the proguard mapping. This can return more than one frame in the case
of inlined functions. In that case, frames are sorted top to bottom.
Sourcepub fn remap_frame_with_context<'r>(
&'r self,
frame: &StackFrame<'data>,
exception_descriptor: Option<&str>,
apply_rewrite: bool,
carried_outline_pos: &mut Option<usize>,
) -> Option<RemappedFrameIter<'r, 'data>>where
'r: 'data,
pub fn remap_frame_with_context<'r>(
&'r self,
frame: &StackFrame<'data>,
exception_descriptor: Option<&str>,
apply_rewrite: bool,
carried_outline_pos: &mut Option<usize>,
) -> Option<RemappedFrameIter<'r, 'data>>where
'r: 'data,
Remaps a single stack frame through the complete processing pipeline.
This method combines:
- Outline frame detection via
is_outline_frame - Frame preparation via
prepare_frame_for_mapping - Lazy frame remapping with rewrite rules applied via skip_count
§Arguments
frame- The frame to remapexception_descriptor- Optional exception descriptor for rewrite rules (e.g.,Ljava/lang/NullPointerException;)apply_rewrite- Whether to apply rewrite rules (typically true only for the first frame after an exception)carried_outline_pos- Mutable reference to track outline position across frames
§Returns
Noneif this is an outline frame (caller should skip,carried_outline_posis updated internally)Some(iterator)with remapped frames. Use [RemappedFrameIter::had_mappings] after collecting to detect if rewrite rules cleared all frames (skip ifhad_mappings() && collected.is_empty())
Sourcepub fn remap_throwable<'a>(
&'a self,
throwable: &Throwable<'a>,
) -> Option<Throwable<'a>>
pub fn remap_throwable<'a>( &'a self, throwable: &Throwable<'a>, ) -> Option<Throwable<'a>>
Remaps a throwable which is the first line of a full stacktrace.
§Example
use proguard::{ProguardMapping, ProguardCache, Throwable};
let mapping = ProguardMapping::new(b"com.example.Mapper -> a.b:");
let mut cache = Vec::new();
ProguardCache::write(&mapping, &mut cache).unwrap();
let cache = ProguardCache::parse(&cache).unwrap();
let throwable = Throwable::try_parse(b"a.b: Crash").unwrap();
let mapped = cache.remap_throwable(&throwable);
assert_eq!(
Some(Throwable::with_message("com.example.Mapper", "Crash")),
mapped
);Sourcepub fn is_outline_frame(&self, class: &str, method: &str) -> bool
pub fn is_outline_frame(&self, class: &str, method: &str) -> bool
Determines if a frame refers to an outline method via the method-level flag. Outline metadata is consistent across all mapping entries for a method, so we only need to inspect the method metadata instead of individual lines.
Sourcepub fn prepare_frame_for_mapping<'a>(
&self,
frame: &StackFrame<'a>,
carried_outline_pos: &mut Option<usize>,
) -> StackFrame<'a>
pub fn prepare_frame_for_mapping<'a>( &self, frame: &StackFrame<'a>, carried_outline_pos: &mut Option<usize>, ) -> StackFrame<'a>
Applies any carried outline position to the frame line and returns the adjusted frame.
Sourcepub fn remap_stacktrace(&self, input: &str) -> Result<String, Error>
pub fn remap_stacktrace(&self, input: &str) -> Result<String, Error>
Remaps a complete Java StackTrace, similar to Self::remap_stacktrace_typed but instead works on
strings as input and output.
Sourcepub fn remap_stacktrace_typed<'a>(
&'a self,
trace: &StackTrace<'a>,
) -> StackTrace<'a>
pub fn remap_stacktrace_typed<'a>( &'a self, trace: &StackTrace<'a>, ) -> StackTrace<'a>
Remaps a complete Java StackTrace.
Sourcepub fn deobfuscate_signature(
&self,
signature: &str,
) -> Option<DeobfuscatedSignature>
pub fn deobfuscate_signature( &self, signature: &str, ) -> Option<DeobfuscatedSignature>
returns a tuple where the first element is the list of the function parameters and the second one is the return type
Trait Implementations§
Source§impl<'data> Clone for ProguardCache<'data>
impl<'data> Clone for ProguardCache<'data>
Source§fn clone(&self) -> ProguardCache<'data>
fn clone(&self) -> ProguardCache<'data>
1.0.0§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ProguardCache<'_>
impl Debug for ProguardCache<'_>
Source§impl<'data> PartialEq for ProguardCache<'data>
impl<'data> PartialEq for ProguardCache<'data>
impl<'data> Eq for ProguardCache<'data>
impl<'data> StructuralPartialEq for ProguardCache<'data>
Auto Trait Implementations§
impl<'data> Freeze for ProguardCache<'data>
impl<'data> RefUnwindSafe for ProguardCache<'data>
impl<'data> Send for ProguardCache<'data>
impl<'data> Sync for ProguardCache<'data>
impl<'data> Unpin for ProguardCache<'data>
impl<'data> UnwindSafe for ProguardCache<'data>
Blanket Implementations§
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
clone_to_uninit)Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.