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

Extended ptrace system call state information. More...

#include <SystemCallInfo.hxx>

+ Inheritance diagram for clues::SystemCallInfo:

Public Member Functions

auto sysNr () const
 
AnySystemCallNr nativeSysNr () const
 
void updateSysNr ()
 Update m_generic and m_native based on the raw system call nr.
 
ABI abi () const
 

Protected Attributes

SystemCallNr m_generic
 
AnySystemCallNr m_native
 
ABI m_abi = ABI::UNKNOWN
 

Detailed Description

Extended ptrace system call state information.

This type additionally contains the type safe generic SystemCallNr and SystemCallnrVariant denoting the ABI-specific system call nr.

Furthermore the exact ABI the system call is for is determined and available via abi().

Definition at line 20 of file SystemCallInfo.hxx.

Constructor & Destructor Documentation

◆ SystemCallInfo()

clues::SystemCallInfo::SystemCallInfo ( )

Definition at line 10 of file SystemCallInfo.cxx.

10 :
11 m_generic{SystemCallNr::UNKNOWN} {
12}

Member Function Documentation

◆ abi()

ABI clues::SystemCallInfo::abi ( ) const
inline

Definition at line 41 of file SystemCallInfo.hxx.

41 {
42 return m_abi;
43 }

◆ nativeSysNr()

AnySystemCallNr clues::SystemCallInfo::nativeSysNr ( ) const
inline

Definition at line 30 of file SystemCallInfo.hxx.

30 {
31 return m_native;
32 }

◆ sysNr()

auto clues::SystemCallInfo::sysNr ( ) const
inline

Definition at line 26 of file SystemCallInfo.hxx.

26 {
27 return m_generic;
28 }

◆ updateSysNr()

void clues::SystemCallInfo::updateSysNr ( )

Update m_generic and m_native based on the raw system call nr.

This call is only valid upon system call entry. The raw system call number will be translated into m_generic and m_native.

Definition at line 14 of file SystemCallInfo.cxx.

14 {
15 if (!isEntry()) {
16 throw cosmos::RuntimeError{"bad SysCallInfo state"};
17 }
18
19 using Arch = cosmos::ptrace::Arch;
20 const auto native = entryInfo()->syscallNr();
21
22 switch (arch()) {
23 case Arch::X86_64: {
24 if (isX32()) {
25 m_abi = ABI::X32;
26 const auto x32_syscall = SystemCallNrX32{native};
27 m_native = x32_syscall;
28 m_generic = to_generic(x32_syscall);
29 } else {
30 m_abi = ABI::X86_64;
31 const auto x64_syscall = SystemCallNrX64{native};
32 m_native = x64_syscall;
33 m_generic = to_generic(x64_syscall);
34 }
35 break;
36 }
37 case Arch::I386: {
38 const auto i386_syscall = SystemCallNrI386{native};
39 m_native = i386_syscall;
40 m_generic = to_generic(i386_syscall);
41 m_abi = ABI::I386;
42 break;
43 }
44 case Arch::AARCH64: {
45 const auto aarch64_syscall = SystemCallNrAARCH64{native};
46 m_native = aarch64_syscall;
47 m_generic = to_generic(aarch64_syscall);
48 m_abi = ABI::AARCH64;
49 break;
50 }
51 default:
52 throw cosmos::RuntimeError("unsupported ARCH");
53 break;
54 }
55}
@ X32
X86_64 with 32-bit pointers.
Definition types.hxx:66
SystemCallNrAARCH64
Native system call numbers as used by Linux on the aarch64 ABI.
Definition aarch64.hxx:31
SystemCallNrX64
Native system call numbers as used by Linux on the x64 ABI.
Definition x64.hxx:31
clues::SystemCallNr to_generic(const SystemCallNrAARCH64 nr)
Convert the native system call nr. into its generic representation.
Definition aarch64.cxx:21
SystemCallNrI386
Native system call numbers as used by Linux on the i386 ABI.
Definition i386.hxx:32

Member Data Documentation

◆ m_abi

ABI clues::SystemCallInfo::m_abi = ABI::UNKNOWN
protected

Definition at line 49 of file SystemCallInfo.hxx.

◆ m_generic

SystemCallNr clues::SystemCallInfo::m_generic
protected

Definition at line 47 of file SystemCallInfo.hxx.

◆ m_native

AnySystemCallNr clues::SystemCallInfo::m_native
protected

Definition at line 48 of file SystemCallInfo.hxx.


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