plugify 1.2.8
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Public Attributes | List of all members
plugify::JitCall Class Reference

Class encapsulates architecture-, OS- and compiler-specific function call semantics in a virtual "bind argument parameters from left to right and then call" interface allowing programmers to call C functions in a completely dynamic manner. In other words, instead of calling a function directly, class provides a mechanism to push the function parameters manually and to issue the call afterwards. More...

#include <call.hpp>

Public Types

enum class  WaitType { None , Breakpoint , Wait_Keypress }
 
using CallingFunc = void(*)(const uint64_t *params, const Return *)
 
using HiddenParam = bool(*)(ValueType)
 HiddenParam is a predicate function pointer to determine if a ValueType should be passed as a hidden parameter. Use for return structs on x86 and arm arch.
 

Public Member Functions

 JitCall ()
 Constructor.
 
 JitCall (const JitCall &other)=delete
 Copy constructor.
 
 JitCall (JitCall &&other) noexcept
 Move constructor.
 
 ~JitCall ()
 Destructor.
 
MemAddr GetJitFunc (const Signature &sig, MemAddr target, WaitType waitType, bool hidden)
 Get a dynamically created function based on the raw signature.
 
MemAddr GetJitFunc (const Method &method, MemAddr target, WaitType waitType=WaitType::None, HiddenParam hidden=&ValueUtils::IsHiddenParam)
 Get a dynamically created function based on the method reference.
 
MemAddr GetFunction () const noexcept
 Get a dynamically created function.
 
MemAddr GetTargetFunc () const noexcept
 Get the target associated with the object.
 
std::string_view GetError () noexcept
 Get the error message, if any.
 
JitCalloperator= (const JitCall &other)=delete
 Copy assignment operator for JitCall.
 
JitCalloperator= (JitCall &&other) noexcept
 Move assignment operator for JitCall.
 

Public Attributes

PLUGIFY_ACCESS : struct Impl
 

Detailed Description

Class encapsulates architecture-, OS- and compiler-specific function call semantics in a virtual "bind argument parameters from left to right and then call" interface allowing programmers to call C functions in a completely dynamic manner. In other words, instead of calling a function directly, class provides a mechanism to push the function parameters manually and to issue the call afterwards.

Definition at line 35 of file call.hpp.

Member Typedef Documentation

◆ CallingFunc

using plugify::JitCall::CallingFunc = void (*)(const uint64_t* params, const Return*)

Definition at line 62 of file call.hpp.

◆ HiddenParam

using plugify::JitCall::HiddenParam = bool (*)(ValueType)

HiddenParam is a predicate function pointer to determine if a ValueType should be passed as a hidden parameter. Use for return structs on x86 and arm arch.

Definition at line 68 of file call.hpp.

Member Enumeration Documentation

◆ WaitType

enum class plugify::JitCall::WaitType
strong

Definition at line 59 of file call.hpp.

Constructor & Destructor Documentation

◆ JitCall() [1/2]

plugify::JitCall::JitCall ( const JitCall other)
delete

Copy constructor.

Parameters
otherAnother instance of JitCall.

◆ JitCall() [2/2]

plugify::JitCall::JitCall ( JitCall &&  other)
noexcept

Move constructor.

Parameters
otherAnother instance of JitCall.

Member Function Documentation

◆ GetError()

std::string_view plugify::JitCall::GetError ( )
noexcept

Get the error message, if any.

Returns
Error message.

◆ GetFunction()

MemAddr plugify::JitCall::GetFunction ( ) const
noexcept

Get a dynamically created function.

Returns
Pointer to the already generated function.
Note
The returned pointer can be nullptr if function is not generate.

◆ GetJitFunc() [1/2]

MemAddr plugify::JitCall::GetJitFunc ( const Method method,
MemAddr  target,
WaitType  waitType = WaitType::None,
HiddenParam  hidden = &ValueUtils::IsHiddenParam 
)

Get a dynamically created function based on the method reference.

Parameters
methodReference to the method.
targetTarget function to call.
waitTypeOptionally insert a breakpoint before the call.
hiddenIf true, return will be pass as hidden argument.
Returns
Pointer to the generated function.

◆ GetJitFunc() [2/2]

MemAddr plugify::JitCall::GetJitFunc ( const Signature sig,
MemAddr  target,
WaitType  waitType,
bool  hidden 
)

Get a dynamically created function based on the raw signature.

Parameters
sigFunction signature.
targetTarget function to call.
waitTypeOptionally insert a breakpoint before the call.
hiddenIf true, return will be pass as hidden argument.
Returns
Pointer to the generated function.

◆ GetTargetFunc()

MemAddr plugify::JitCall::GetTargetFunc ( ) const
noexcept

Get the target associated with the object.

This function returns a pointer to the target function associated with the object.

Returns
A void pointer to the target function.
Note
The returned pointer can be nullptr if no target is set.

◆ operator=() [1/2]

JitCall & plugify::JitCall::operator= ( const JitCall other)
delete

Copy assignment operator for JitCall.

Parameters
otherThe other JitCall instance to copy from.
Returns
A reference to this instance after copying.

◆ operator=() [2/2]

JitCall & plugify::JitCall::operator= ( JitCall &&  other)
noexcept

Move assignment operator for JitCall.

Parameters
otherThe other JitCall instance to move from.
Returns
A reference to this instance after moving.
Note
This operator is marked noexcept to indicate it does not throw exceptions.

Member Data Documentation

◆ __pad0__

PLUGIFY_ACCESS plugify::JitCall::__pad0__

Definition at line 134 of file call.hpp.


The documentation for this class was generated from the following file: