Skip to content
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

Add deobfuscated signature unconditionally #1427

Merged
Show file tree
Hide file tree
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
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
- proguard: Added a mandatory `index` field to `JvmFrame` (#1411) by @loewenheim
- proguard: Support for source contex (#1414) by @loewenheim
- proguard: Field `lineno` on `JvmFrame` is now optional (#1417) by @loewenheim
- proguard: add support for frame signature (#1425 )by @viglia
- proguard: add support for frame signature (#1425 ) by @viglia
- proguard: add the translated and deobfuscated signature even in the case that the the whole frame could not be remapped (#1427) by @viglia

### Dependencies

Expand Down
24 changes: 23 additions & 1 deletion crates/symbolicator-proguard/src/symbolication.rs
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,11 @@ impl ProguardService {
}
}

// if there is a signature that has been deobfuscated,
// add it to the mapped frame
if let Some(signature) = &deobfuscated_signature {
mapped_frame.signature = Some(signature.format_signature());
}
return vec![mapped_frame];
}

Expand Down Expand Up @@ -439,6 +444,17 @@ io.sentry.sample.MainActivity -> io.sentry.sample.MainActivity:
index: 2,
..Default::default()
},
JvmFrame {
// this function map is onClickHandler(android.view.View):40 -> t
// not onClickHandler(android.view.View):40 -> onClickHandler
// hence the whole frame remapping should fail,
// but the signature should still be properly translated to java type
function: "onClickHandler".to_owned(),
module: "io.sentry.sample.MainActivity".to_owned(),
signature: Some("(Landroid/view/View;)V".to_owned()),
index: 3,
..Default::default()
},
];

let mapping = ProguardMapping::new(proguard_source);
Expand All @@ -449,7 +465,7 @@ io.sentry.sample.MainActivity -> io.sentry.sample.MainActivity:
.flat_map(|frame| ProguardService::map_frame(&[&mapper], frame, None).into_iter())
.collect();

assert_eq!(mapped_frames.len(), 5);
assert_eq!(mapped_frames.len(), 6);

assert_eq!(mapped_frames[0].function, "onClick");
assert_eq!(
Expand Down Expand Up @@ -485,6 +501,12 @@ io.sentry.sample.MainActivity -> io.sentry.sample.MainActivity:
mapped_frames[4].signature.as_ref().unwrap(),
"(android.view.View)"
);

assert_eq!(mapped_frames[5].function, "onClickHandler");
assert_eq!(
mapped_frames[5].signature.as_ref().unwrap(),
"(android.view.View)"
);
}

// based on the Python test `test_sets_inapp_after_resolving`.
Expand Down
Loading