Struct proguard::ProguardMapper
source · pub struct ProguardMapper<'s> { /* private fields */ }
Expand description
A Proguard Remapper.
This can remap class names, stack frames one at a time, or the complete raw stacktrace.
Implementations§
source§impl<'s> ProguardMapper<'s>
impl<'s> ProguardMapper<'s>
sourcepub fn new(mapping: ProguardMapping<'s>) -> Self
pub fn new(mapping: ProguardMapping<'s>) -> Self
Create a new ProguardMapper.
sourcepub fn new_with_param_mapping(
mapping: ProguardMapping<'s>,
initialize_param_mapping: bool
) -> Self
pub fn new_with_param_mapping( mapping: ProguardMapping<'s>, initialize_param_mapping: bool ) -> Self
Create a new ProguardMapper with the extra mappings_by_params. This is useful when we want to deobfuscate frames with missing line information
sourcepub fn remap_class(&'s self, class: &str) -> Option<&'s str>
pub fn remap_class(&'s self, class: &str) -> Option<&'s str>
Remaps an obfuscated Class.
This works on the fully-qualified name of the class, with its complete module prefix.
§Examples
let mapping = r#"android.arch.core.executor.ArchTaskExecutor -> a.a.a.a.c:"#;
let mapper = proguard::ProguardMapper::from(mapping);
let mapped = mapper.remap_class("a.a.a.a.c");
assert_eq!(mapped, Some("android.arch.core.executor.ArchTaskExecutor"));
sourcepub fn deobfuscate_signature(
&'s self,
signature: &str
) -> Option<DeobfuscatedSignature>
pub fn deobfuscate_signature( &'s 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
sourcepub fn remap_method(
&'s self,
class: &str,
method: &str
) -> Option<(&'s str, &'s str)>
pub fn remap_method( &'s self, class: &str, method: &str ) -> Option<(&'s str, &'s 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(&'s self, frame: &StackFrame<'s>) -> RemappedFrameIter<'s> ⓘ
pub fn remap_frame(&'s self, frame: &StackFrame<'s>) -> RemappedFrameIter<'s> ⓘ
Remaps a single Stackframe.
Returns zero or more StackFrame
s, 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_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::{ProguardMapper, Throwable};
let mapping = "com.example.Mapper -> a.b:";
let mapper = ProguardMapper::from(mapping);
let throwable = Throwable::try_parse(b"a.b: Crash").unwrap();
let mapped = mapper.remap_throwable(&throwable);
assert_eq!(
Some(Throwable::with_message("com.example.Mapper", "Crash")),
mapped
);
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.
Trait Implementations§
source§impl<'s> Clone for ProguardMapper<'s>
impl<'s> Clone for ProguardMapper<'s>
source§fn clone(&self) -> ProguardMapper<'s>
fn clone(&self) -> ProguardMapper<'s>
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more