From f59496b01e28ce23accb2a82529e3dbba1d6a6dd Mon Sep 17 00:00:00 2001 From: matbrik <6418737+matbrik@users.noreply.github.com> Date: Thu, 11 Jul 2024 16:26:56 +0000 Subject: [PATCH] fix --- lib/android.js | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/lib/android.js b/lib/android.js index e60bce6..a9772c9 100644 --- a/lib/android.js +++ b/lib/android.js @@ -225,7 +225,7 @@ function _getApi () { getInstances(instance, scope, hClass, useIsAssignableFrom, maxCount, instances); }; }, - + _ZN3art12StackVisitorC2EPNS_6ThreadEPNS_7ContextENS0_13StackWalkKindEjb: ['art::StackVisitor::StackVisitor', 'void', ['pointer', 'pointer', 'pointer', 'uint', 'uint', 'bool']], _ZN3art12StackVisitorC2EPNS_6ThreadEPNS_7ContextENS0_13StackWalkKindEmb: ['art::StackVisitor::StackVisitor', 'void', ['pointer', 'pointer', 'pointer', 'uint', 'size_t', 'bool']], _ZN3art12StackVisitor9WalkStackILNS0_16CountTransitionsE0EEEvb: ['art::StackVisitor::WalkStack', 'void', ['pointer', 'bool']], @@ -1672,7 +1672,7 @@ find_replacement_method_from_quick_code (gpointer method, gpointer top_quick_frame; gpointer link_managed_stack; gpointer * link_top_quick_frame; - + replacement_method = get_replacement_method (method); if (replacement_method == NULL) return NULL; @@ -1886,18 +1886,17 @@ function ensureArtKnowsHowToHandleReplacementMethods (vm) { let exportName = null; - const api = getApi(); - const kCollectorTypeCMC = 3; - let mayUseCollector = new NativeFunction(Module.findExportByName('libart.so', "_ZNK3art2gc4Heap15MayUseCollectorENS0_13CollectorTypeE"), "int", ["pointer", "int"]) - if (mayUseCollector(api.artHeap, kCollectorTypeCMC)){ - exportName = '_ZN3art2gc9collector11MarkCompact15CompactionPhaseEv'; - } else if (apiLevel > 28) { + if (apiLevel > 28) { exportName = '_ZN3art2gc9collector17ConcurrentCopying12CopyingPhaseEv'; } else if (apiLevel > 22) { exportName = '_ZN3art2gc9collector17ConcurrentCopying12MarkingPhaseEv'; } if (exportName !== null) { + let collectorCMC = Module.getExportByName('libart.so', '_ZN3art2gc9collector11MarkCompact15CompactionPhaseEv'); + if(collectorCMC !== null){ + Interceptor.attach(collectorCMC, artController.hooks.Gc.copyingPhase); + } Interceptor.attach(Module.getExportByName('libart.so', exportName), artController.hooks.Gc.copyingPhase); } } @@ -3619,7 +3618,7 @@ function computeDalvikJniArgInfo (methodId) { function cloneArtMethod (method, vm) { const api = getApi(); - + if (getAndroidApiLevel() < 23) { const thread = api['art::Thread::CurrentFromGdb'](); return api['art::mirror::Object::Clone'](method, thread);