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

fix EvilMethodTracer lose stack #844

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ class AgpCompat {
@JvmStatic
val asmApi: Int
get() = when {
VersionsCompat.greatThanOrEqual(AGPVersion.AGP_7_3_1) -> Opcodes.ASM7
VersionsCompat.greatThanOrEqual(AGPVersion.AGP_7_0_0) -> Opcodes.ASM6
else -> Opcodes.ASM5
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ enum class AGPVersion(
AGP_3_6_0("3.6.0"),
AGP_4_0_0("4.0.0"),
AGP_4_1_0("4.1.0"),
AGP_7_0_0("7.0.0")
AGP_7_0_0("7.0.0"),
AGP_7_3_1("7.3.1")
}

class VersionsCompat {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,16 @@ public boolean isValid() {
@Override
public void onDispatchBegin(String log) {
indexRecord = AppMethodBeat.getInstance().maskIndex("EvilMethodTracer#dispatchBegin");
if (config.isAppMethodBeatEnable()) {
AppMethodBeat.i(AppMethodBeat.METHOD_ID_DISPATCH);
}
}

@Override
public void onDispatchEnd(String log, long beginNs, long endNs) {
if (config.isAppMethodBeatEnable()) {
AppMethodBeat.o(AppMethodBeat.METHOD_ID_DISPATCH);
}
long dispatchCost = (endNs - beginNs) / Constants.TIME_MILLIS_TO_NANO;
try {
if (dispatchCost >= evilThresholdMs) {
Expand Down