From ec8cee26ee0297fc5106351094be1ddbb0c07428 Mon Sep 17 00:00:00 2001 From: LoveSy Date: Fri, 18 Feb 2022 02:38:53 +0800 Subject: [PATCH] Remove runtime --- library/jni/art/runtime.hpp | 40 ------------------------------------- library/jni/lsplant.cc | 8 +------- 2 files changed, 1 insertion(+), 47 deletions(-) delete mode 100644 library/jni/art/runtime.hpp diff --git a/library/jni/art/runtime.hpp b/library/jni/art/runtime.hpp deleted file mode 100644 index 403f75f..0000000 --- a/library/jni/art/runtime.hpp +++ /dev/null @@ -1,40 +0,0 @@ -#pragma once - -#include "common.hpp" - -namespace lsplant::art { - -class Runtime { -private: - inline static Runtime *instance_; - - CREATE_MEM_FUNC_SYMBOL_ENTRY(void, SetJavaDebuggable, Runtime *thiz, bool value) { - if (SetJavaDebuggableSym) [[likely]] { - SetJavaDebuggableSym(thiz, value); - } - } - -public: - inline static Runtime *Current() { - return instance_; - } - - void SetJavaDebuggable(bool value) { - SetJavaDebuggable(this, value); - } - - static bool Init(const HookHandler &handler) { - Runtime *instance = nullptr; - if (!RETRIEVE_FIELD_SYMBOL(instance, "_ZN3art7Runtime9instance_E")) { - return false; - } - instance_ = *reinterpret_cast(instance); - LOGD("_ZN3art7Runtime9instance_E = %p", instance_); - if (!RETRIEVE_MEM_FUNC_SYMBOL(SetJavaDebuggable, "_ZN3art7Runtime17SetJavaDebuggableEb")) { - return false; - } - return true; - } -}; - -} diff --git a/library/jni/lsplant.cc b/library/jni/lsplant.cc index 3ac674a..32e88a6 100644 --- a/library/jni/lsplant.cc +++ b/library/jni/lsplant.cc @@ -7,7 +7,6 @@ #include #include "utils/jni_helper.hpp" #include "art/runtime/gc/scoped_gc_critical_section.hpp" -#include "art/runtime.hpp" #include "art/thread.hpp" #include "art/instrumentation.hpp" #include "art/runtime/jit/jit_code_cache.hpp" @@ -28,7 +27,6 @@ using art::ArtMethod; using art::thread_list::ScopedSuspendAll; using art::ClassLinker; using art::mirror::Class; -using art::Runtime; using art::Thread; using art::Instrumentation; using art::gc::ScopedGCCriticalSection; @@ -143,10 +141,6 @@ bool InitNative(JNIEnv *env, const HookHandler &handler) { if (!handler.inline_hooker || !handler.inline_unhooker || !handler.art_symbol_resolver) { return false; } - if (!Runtime::Init(handler)) { - LOGE("Failed to init runtime"); - return false; - } if (!ArtMethod::Init(env, handler)) { LOGE("Failed to init art method"); return false; @@ -165,7 +159,7 @@ bool InitNative(JNIEnv *env, const HookHandler &handler) { return false; } if (!Instrumentation::Init(handler)) { - LOGE("failed to init intrumentation"); + LOGE("failed to init instrumentation"); return false; } if (!ScopedSuspendAll::Init(handler)) {