This class manages signal handling within an Arion emulation session.
More...
#include <signal_manager.hpp>
|
| std::weak_ptr< Arion > | arion |
| | The Arion instance associated with this instance.
|
| |
| std::map< int, std::shared_ptr< struct arion_lnx_type::ksigaction > > | sighandlers |
| | A map identifying a ksigaction structure given its associated signal number.
|
| |
| std::map< pid_t, pid_t > | sigwait_list |
| | A map identifying a process (ID) given the process (ID) it is waiting for.
|
| |
| std::unique_ptr< std::map< REG, RVAL > > | ucontext_regs |
| | A map identifying a saved register value to be restored, given the Unicorn register it is associated to.
|
| |
|
| static std::map< int, std::string > | signals |
| | A map identifying a signal description string given its signal number.
|
| |
This class manages signal handling within an Arion emulation session.
◆ SignalManager()
| arion::SignalManager::SignalManager |
( |
std::weak_ptr< Arion > |
arion | ) |
|
Builder for SignalManager instances.
- Parameters
-
| [in] | arion | The Arion instance associated with this instance. |
◆ get_sighandler()
Retrieves a sighandler from a given signal.
- Parameters
-
| [in] | signo | The signal number. |
- Returns
- The sighandler.
◆ handle_sigchld()
| void arion::SignalManager::handle_sigchld |
( |
pid_t |
source_pid | ) |
|
|
private |
Handles the specific case of SIGCHLD signals where a process waiting for another can be resumed.
- Parameters
-
| [in] | source_pid | The Process ID that generated the SIGCHLD signal. |
◆ handle_sighandler()
| bool arion::SignalManager::handle_sighandler |
( |
pid_t |
source_pid, |
|
|
int |
signo |
|
) |
| |
|
private |
If a sighandler is associated with a given signal for a given process, triggers its execution.
- Parameters
-
| [in] | source_pid | The Process ID that generated the signal. |
| [in] | signo | The signal number. |
- Returns
- True if a sighandler was found and executed for the given parameters.
◆ handle_signal()
| void arion::SignalManager::handle_signal |
( |
pid_t |
source_pid, |
|
|
int |
signo |
|
) |
| |
Processes a signal after it has been triggered by a given process.
- Parameters
-
| [in] | source_pid | The process that triggered the signal. |
| [in] | signo | The signal number. |
◆ has_sighandler()
| bool arion::SignalManager::has_sighandler |
( |
int |
signo | ) |
|
Checks whether a given signal has a sighandler being attached.
- Parameters
-
| [in] | signo | The signal number. |
- Returns
- True if the given signal has a sighandler being attached.
◆ initialize()
| static std::unique_ptr< SignalManager > arion::SignalManager::initialize |
( |
std::weak_ptr< Arion > |
arion | ) |
|
|
static |
Instanciates and initializes new SignalManager objects with some parameters.
- Parameters
-
| [in] | arion | The Arion instance associated with this instance. |
- Returns
- A new SignalManager instance.
◆ intr_hook()
| static void arion::SignalManager::intr_hook |
( |
std::shared_ptr< Arion > |
arion, |
|
|
uint32_t |
intno, |
|
|
void * |
user_data |
|
) |
| |
|
staticprivate |
A hook callback which is triggered when an interrupt occurs.
- Parameters
-
| [in] | arion | The Arion instance that triggered the hook. |
| [in] | intno | The interrupt number. |
| [in] | user_data | Optional user-defined data passed to the hook. |
◆ invalid_insn_hook()
| static bool arion::SignalManager::invalid_insn_hook |
( |
std::shared_ptr< Arion > |
arion, |
|
|
void * |
user_data |
|
) |
| |
|
staticprivate |
A hook callback which is triggered when an invalid instruction gets fetched.
- Parameters
-
| [in] | arion | The Arion instance that triggered the hook. |
| [in] | user_data | Optional user-defined data passed to the hook. |
- Returns
- True if the hook handled the access and default behavior should be suppressed.
◆ invalid_memory_hook()
| static bool arion::SignalManager::invalid_memory_hook |
( |
std::shared_ptr< Arion > |
arion, |
|
|
uc_mem_type |
access, |
|
|
uint64_t |
addr, |
|
|
int |
size, |
|
|
int64_t |
val, |
|
|
void * |
user_data |
|
) |
| |
|
staticprivate |
A hook callback which is triggered when a memory access violation occurs.
- Parameters
-
| [in] | arion | The Arion instance that triggered the hook. |
| [in] | access | Type of memory access (e.g., UC_MEM_READ, UC_MEM_WRITE, UC_MEM_FETCH). |
| [in] | addr | Memory address being accessed. |
| [in] | size | Size of the memory access. |
| [in] | val | Value attempted to be written. |
| [in] | user_data | Optional user-defined data passed to the hook. |
- Returns
- True if the hook handled the access and default behavior should be suppressed.
◆ print_signal()
| void arion::SignalManager::print_signal |
( |
std::shared_ptr< Arion > |
arion, |
|
|
std::string |
sig_name |
|
) |
| |
Logs a signal given its name.
- Parameters
-
| [in] | arion | The Arion instance which triggered the signal. |
| [in] | sig_name | Name of the signal. |
◆ set_sighandler()
Associates a sighandler to a given signal.
- Parameters
-
| [in] | signo | The signal number. |
| [in] | sighandler | The sighandler. |
◆ sigreturn()
| bool arion::SignalManager::sigreturn |
( |
| ) |
|
Returns from a sighandler by restoring context.
- Returns
- True if a context could be restored.
◆ wait_for_sig()
| void arion::SignalManager::wait_for_sig |
( |
pid_t |
target_tid, |
|
|
pid_t |
source_pid, |
|
|
ADDR |
wait_status_addr |
|
) |
| |
Sets a thread in a paused state, waiting for a given process to trigger a signal before resuming its execution.
- Parameters
-
| [in] | target_tid | The thread waiting for a given process. |
| [in] | source_pid | The process which must trigger a signal to resume the thread execution. |
| [in] | wait_status_addr | The address where to store the exit status of the signaled process. |
◆ arion
| std::weak_ptr<Arion> arion::SignalManager::arion |
|
private |
The Arion instance associated with this instance.
◆ sighandlers
A map identifying a ksigaction structure given its associated signal number.
◆ signals
| std::map<int, std::string> arion::SignalManager::signals |
|
staticprivate |
A map identifying a signal description string given its signal number.
◆ sigwait_list
| std::map<pid_t, pid_t> arion::SignalManager::sigwait_list |
|
private |
A map identifying a process (ID) given the process (ID) it is waiting for.
◆ ucontext_regs
| std::unique_ptr<std::map<REG, RVAL> > arion::SignalManager::ucontext_regs |
|
private |
A map identifying a saved register value to be restored, given the Unicorn register it is associated to.
The documentation for this class was generated from the following file: