27 lines
592 B
C++
Raw Normal View History

2022-02-16 07:24:35 +08:00
#pragma once
#include "common.hpp"
namespace lsplant::art {
class Thread {
CREATE_FUNC_SYMBOL_ENTRY(Thread *, CurrentFromGdb) {
if (CurrentFromGdbSym) [[likely]]
return CurrentFromGdbSym();
else
return nullptr;
}
public:
2022-03-11 19:37:11 +08:00
static Thread *Current() { return CurrentFromGdb(); }
2022-02-16 07:24:35 +08:00
static bool Init(const HookHandler &handler) {
2022-03-12 16:10:55 +08:00
if (!RETRIEVE_FUNC_SYMBOL(CurrentFromGdb, "_ZN3art6Thread14CurrentFromGdbEv"))
[[unlikely]] {
2022-02-16 07:24:35 +08:00
return false;
}
return true;
}
};
2022-03-11 19:37:11 +08:00
} // namespace lsplant::art