libclues
Linux C++ Tracing Library
Loading...
Searching...
No Matches
clues::SystemCallDB Class Reference

Stores information about each system call number in form of SystemCall objects. More...

#include <SystemCallDB.hxx>

Public Member Functions

 SystemCallDB (const SystemCallDB &)=delete
 
SystemCallDBoperator= (const SystemCallDB &)=delete
 
 SystemCallDB (SystemCallDB &&other)
 
SystemCallDBoperator= (SystemCallDB &&other)
 
SystemCallget (const SystemCallNr nr)
 
const SystemCallget (const SystemCallNr nr) const
 

Protected Attributes

std::map< SystemCallNr, SystemCallPtr > m_map
 

Detailed Description

Stores information about each system call number in form of SystemCall objects.

This is a caching map object. It doesn't fill in all system calls at once, but fills in each system call as it comes up in a lazy manner.

Each Tracee uses its dedicated SystemCallDB to avoid different tracees meddling with each other's system call state.

Definition at line 19 of file SystemCallDB.hxx.

Constructor & Destructor Documentation

◆ SystemCallDB()

clues::SystemCallDB::SystemCallDB ( SystemCallDB && other)
inline

Definition at line 28 of file SystemCallDB.hxx.

28 {
29 *this = std::move(other);
30 }

Member Function Documentation

◆ get() [1/2]

SystemCall & clues::SystemCallDB::get ( const SystemCallNr nr)

Definition at line 6 of file SystemCallDB.cxx.

6 {
7 if (auto it = m_map.find(nr); it != m_map.end()) {
8 return *(it->second);
9 } else {
10 auto res = m_map.insert(std::make_pair(nr, create_syscall(nr)));
11
12 it = res.first;
13 return *(it->second);
14 }
15}
SystemCallPtr create_syscall(const SystemCallNr nr)
Creates a dynamically allocated SystemCall instance for the given system call number.

◆ get() [2/2]

const SystemCall & clues::SystemCallDB::get ( const SystemCallNr nr) const
inline

Definition at line 38 of file SystemCallDB.hxx.

38 {
39 return const_cast<SystemCallDB&>(*this).get(nr);
40 }

◆ operator=()

SystemCallDB & clues::SystemCallDB::operator= ( SystemCallDB && other)
inline

Definition at line 31 of file SystemCallDB.hxx.

31 {
32 m_map = std::move(other.m_map);
33 return *this;
34 }

Member Data Documentation

◆ m_map

std::map<SystemCallNr, SystemCallPtr> clues::SystemCallDB::m_map
protected

Definition at line 59 of file SystemCallDB.hxx.


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