CACAO
|
Public Member Functions | |
Patcher () | |
virtual | ~Patcher () |
bool | patch () |
This a wrapper to set the done flag. More... | |
virtual uintptr_t | get_mpc () const =0 |
get the absolute position in code segment More... | |
virtual void | emit ()=0 |
Generates the code for the patcher traps. More... | |
virtual void | reposition (intptr_t base)=0 |
reposition to another base More... | |
bool | is_patched () const |
Check already patched. More... | |
virtual bool | check_is_patched () const =0 |
Check if the patcher is already patched. More... | |
virtual const char * | get_name () const |
print patcher information More... | |
virtual OStream & | print (OStream &OS) const |
print patcher information More... | |
Private Member Functions | |
virtual bool | patch_impl ()=0 |
This function performs the patching. More... | |
Private Attributes | |
bool | done |
Patcher super class.
This class is intended to replace the patchref_t patcher references. The goal is to replace function pointers by virtual functions and void pointers by member variables. Although we need a vtbl_ptr for virtual functions and a smart pointer for list storage this might even reduce the overall memory consumption because not all fields of patchref_t are needed by all patchers. But the main focus is on encapsulation and usability.
Definition at line 49 of file PatcherNew.hpp.
cacao::Patcher::Patcher | ( | ) |
Definition at line 37 of file PatcherNew.cpp.
|
virtual |
Definition at line 41 of file PatcherNew.cpp.
|
pure virtual |
Check if the patcher is already patched.
This is done by comparing the machine instruction.
Implemented in cacao::InitializeClassPatcher, and cacao::LegacyPatcher.
|
pure virtual |
Generates the code for the patcher traps.
Implemented in cacao::InitializeClassPatcher, and cacao::LegacyPatcher.
|
pure virtual |
get the absolute position in code segment
Implemented in cacao::PatcherBase, and cacao::LegacyPatcher.
|
virtual |
print patcher information
Reimplemented in cacao::InitializeClassPatcher, cacao::PatcherBase, and cacao::LegacyPatcher.
Definition at line 45 of file PatcherNew.cpp.
|
inline |
Check already patched.
In contrast to check_is_patched this method simply queries a boolean variable whereas check_is_patched inspects to machine code.
Definition at line 93 of file PatcherNew.hpp.
|
inline |
This a wrapper to set the done flag.
Definition at line 63 of file PatcherNew.hpp.
|
privatepure virtual |
This function performs the patching.
Implemented in cacao::InitializeClassPatcher, and cacao::LegacyPatcher.
print patcher information
Reimplemented in cacao::LegacyPatcher.
Definition at line 49 of file PatcherNew.cpp.
|
pure virtual |
reposition to another base
Implemented in cacao::PatcherBase, and cacao::LegacyPatcher.
|
private |
Definition at line 51 of file PatcherNew.hpp.