Remove runtime

This commit is contained in:
LoveSy 2022-02-18 02:38:53 +08:00
parent d4696cd46b
commit ec8cee26ee
2 changed files with 1 additions and 47 deletions

View File

@ -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<Runtime **>(instance);
LOGD("_ZN3art7Runtime9instance_E = %p", instance_);
if (!RETRIEVE_MEM_FUNC_SYMBOL(SetJavaDebuggable, "_ZN3art7Runtime17SetJavaDebuggableEb")) {
return false;
}
return true;
}
};
}

View File

@ -7,7 +7,6 @@
#include <sys/system_properties.h>
#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)) {