mirror of
https://github.com/LSPosed/LSPlant.git
synced 2025-05-04 20:42:02 +08:00
Reformat code
This commit is contained in:
parent
fd8e2e4c17
commit
a3f95f050b
@ -8,7 +8,7 @@
|
||||
namespace lsplant::art {
|
||||
class DexFile {
|
||||
struct Header {
|
||||
uint8_t magic_[8];
|
||||
[[maybe_unused]] uint8_t magic_[8];
|
||||
uint32_t checksum_; // See also location_checksum_
|
||||
};
|
||||
CREATE_FUNC_SYMBOL_ENTRY(std::unique_ptr<DexFile>, OpenMemory, const uint8_t* dex_file,
|
||||
|
@ -24,17 +24,13 @@ class Thread {
|
||||
}
|
||||
|
||||
public:
|
||||
static Thread *Current() {
|
||||
return CurrentFromGdb();
|
||||
}
|
||||
static Thread *Current() { return CurrentFromGdb(); }
|
||||
|
||||
static bool Init(const HookHandler &handler) {
|
||||
if (!RETRIEVE_MEM_FUNC_SYMBOL(DecodeJObject,
|
||||
"_ZNK3art6Thread13DecodeJObjectEP8_jobject")) {
|
||||
if (!RETRIEVE_MEM_FUNC_SYMBOL(DecodeJObject, "_ZNK3art6Thread13DecodeJObjectEP8_jobject")) {
|
||||
return false;
|
||||
}
|
||||
if (!RETRIEVE_FUNC_SYMBOL(CurrentFromGdb,
|
||||
"_ZN3art6Thread14CurrentFromGdbEv")) {
|
||||
if (!RETRIEVE_FUNC_SYMBOL(CurrentFromGdb, "_ZN3art6Thread14CurrentFromGdbEv")) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
@ -47,4 +43,4 @@ public:
|
||||
return nullptr;
|
||||
}
|
||||
};
|
||||
}
|
||||
} // namespace lsplant::art
|
||||
|
@ -1,14 +1,16 @@
|
||||
#pragma once
|
||||
|
||||
#include <string_view>
|
||||
#include <shared_mutex>
|
||||
#include <unordered_set>
|
||||
#include <unordered_map>
|
||||
#include <list>
|
||||
#include <sys/system_properties.h>
|
||||
|
||||
#include <list>
|
||||
#include <shared_mutex>
|
||||
#include <string_view>
|
||||
#include <unordered_map>
|
||||
#include <unordered_set>
|
||||
|
||||
#include "logging.hpp"
|
||||
#include "utils/hook_helper.hpp"
|
||||
#include "lsplant.hpp"
|
||||
#include "utils/hook_helper.hpp"
|
||||
|
||||
namespace lsplant {
|
||||
|
||||
@ -19,7 +21,6 @@ enum class Arch {
|
||||
kX8664,
|
||||
};
|
||||
|
||||
|
||||
consteval inline Arch GetArch() {
|
||||
#if defined(__i386__)
|
||||
return Arch::kX86;
|
||||
@ -70,7 +71,7 @@ class ArtMethod;
|
||||
namespace dex {
|
||||
class ClassDef;
|
||||
}
|
||||
}
|
||||
} // namespace art
|
||||
|
||||
namespace {
|
||||
// target, backup
|
||||
@ -80,12 +81,15 @@ inline std::shared_mutex hooked_methods_lock_;
|
||||
inline std::list<std::pair<art::ArtMethod *, art::ArtMethod *>> jit_movements_;
|
||||
inline std::shared_mutex jit_movements_lock_;
|
||||
|
||||
inline std::unordered_map<const art::dex::ClassDef *, std::list<std::tuple<art::ArtMethod *, art::ArtMethod *, art::ArtMethod *>>> pending_classes_;
|
||||
inline std::unordered_map<
|
||||
const art::dex::ClassDef *,
|
||||
std::list<std::tuple<art::ArtMethod *, art::ArtMethod *, art::ArtMethod *>>>
|
||||
pending_classes_;
|
||||
inline std::shared_mutex pending_classes_lock_;
|
||||
|
||||
inline std::unordered_set<const art::ArtMethod *> pending_methods_;
|
||||
inline std::shared_mutex pending_methods_lock_;
|
||||
}
|
||||
} // namespace
|
||||
|
||||
inline bool IsHooked(art::ArtMethod *art_method) {
|
||||
std::shared_lock lk(hooked_methods_lock_);
|
||||
@ -117,9 +121,8 @@ inline void RecordJitMovement(art::ArtMethod *target, art::ArtMethod *backup) {
|
||||
jit_movements_.emplace_back(target, backup);
|
||||
}
|
||||
|
||||
inline void
|
||||
RecordPending(const art::dex::ClassDef *class_def, art::ArtMethod *target, art::ArtMethod *hook,
|
||||
art::ArtMethod *backup) {
|
||||
inline void RecordPending(const art::dex::ClassDef *class_def, art::ArtMethod *target,
|
||||
art::ArtMethod *hook, art::ArtMethod *backup) {
|
||||
{
|
||||
std::unique_lock lk(pending_methods_lock_);
|
||||
pending_methods_.emplace(target);
|
||||
@ -151,4 +154,4 @@ inline void OnPending(const art::dex::ClassDef *class_def) {
|
||||
OnPending(target, hook, backup);
|
||||
}
|
||||
}
|
||||
}
|
||||
} // namespace lsplant
|
||||
|
@ -2,8 +2,8 @@
|
||||
|
||||
#include <concepts>
|
||||
|
||||
#include "lsplant.hpp"
|
||||
#include "jni_helper.hpp"
|
||||
#include "lsplant.hpp"
|
||||
|
||||
#if defined(__LP64__)
|
||||
#define LP_SELECT(lp32, lp64) lp64
|
||||
|
@ -14,8 +14,16 @@
|
||||
#define LOGE(...)
|
||||
#else
|
||||
#ifndef NDEBUG
|
||||
#define LOGD(fmt, ...) __android_log_print(ANDROID_LOG_DEBUG, LOG_TAG, "%s:%d#%s" ": " fmt, __FILE_NAME__, __LINE__, __PRETTY_FUNCTION__ __VA_OPT__(,) __VA_ARGS__)
|
||||
#define LOGV(fmt, ...) __android_log_print(ANDROID_LOG_VERBOSE, LOG_TAG, "%s:%d#%s" ": " fmt, __FILE_NAME__, __LINE__, __PRETTY_FUNCTION__ __VA_OPT__(,) __VA_ARGS__)
|
||||
#define LOGD(fmt, ...) \
|
||||
__android_log_print(ANDROID_LOG_DEBUG, LOG_TAG, \
|
||||
"%s:%d#%s" \
|
||||
": " fmt, \
|
||||
__FILE_NAME__, __LINE__, __PRETTY_FUNCTION__ __VA_OPT__(, ) __VA_ARGS__)
|
||||
#define LOGV(fmt, ...) \
|
||||
__android_log_print(ANDROID_LOG_VERBOSE, LOG_TAG, \
|
||||
"%s:%d#%s" \
|
||||
": " fmt, \
|
||||
__FILE_NAME__, __LINE__, __PRETTY_FUNCTION__ __VA_OPT__(, ) __VA_ARGS__)
|
||||
#else
|
||||
#define LOGD(...)
|
||||
#define LOGV(...)
|
||||
|
Loading…
x
Reference in New Issue
Block a user