Skip to content

Commit

Permalink
Add common/MachSyscall.C
Browse files Browse the repository at this point in the history
  • Loading branch information
hainest committed Apr 3, 2024
1 parent b5b66ad commit 69acddb
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 10 deletions.
9 changes: 1 addition & 8 deletions common/h/MachSyscall.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,26 +42,19 @@ class COMMON_EXPORT MachSyscall
{
public:
typedef unsigned long SyscallIDPlatform;
typedef unsigned long SyscallIDIndependent; // e.g., Dyninst::Syscall::dyn_getpid
typedef unsigned long SyscallIDIndependent;
typedef const char * SyscallName;

// Factory methods
// Allows ProcControlAPI to construct a MachSyscall for an event
friend MachSyscall ProcControlAPI::makeFromEvent(const ProcControlAPI::EventSyscall *);

// Allows users to construct a MachSyscall
friend MachSyscall ProcControlAPI::makeFromID(boost::shared_ptr<ProcControlAPI::Process>, SyscallIDIndependent);

static MachSyscall makeFromPlatform(Platform, SyscallIDIndependent);

// Accessors
// Returns the platform-specific number for this system call
SyscallIDPlatform num() const;

// Returns the name for this system call (e.g., "getpid")
SyscallName name() const;

// Strict equality-based matching on Platforms and IDs
bool operator==(const MachSyscall &) const;

private:
Expand Down
1 change: 0 additions & 1 deletion common/src/MachSyscall.C
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,6 @@ MachSyscall::SyscallIDPlatform SyscallInformation::findIDPlatform(Platform plat,
/* This file is auto-generated from syscalls/generateSyscallInformation.py */
#include "SyscallInformation.C"

/* Lookup the system call string name based on platform-specific ID */
MachSyscall::SyscallName MachSyscall::nameLookup(Platform plat, SyscallIDPlatform id)
{
return SyscallInformation::getInstance()->findName(plat, id);
Expand Down
1 change: 1 addition & 0 deletions docs/common/developer/API.rst
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ Classes and features shared among many parts of Dyninst.
linuxKludges.h
lprintf.h
lru_cache.h
MachSyscall.h
MappedFile.h
NodeIterator.h
ntHeaders.h
Expand Down
13 changes: 13 additions & 0 deletions docs/common/developer/MachSyscall.h.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
.. _`sec-dev:MachSyscall.h`:

MachSyscall.h
#############

.. cpp:namespace:: Dyninst::dev

.. cpp:class:: MachSyscall

.. cpp:function:: private static SyscallName nameLookup(Platform plat, SyscallIDPlatform id)

Lookup the system call string name based on platform-specific ID

8 changes: 7 additions & 1 deletion docs/common/public/MachSyscall.h.rst
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@ MachSyscall.h

.. cpp:function:: SyscallIDPlatform num() const

The platform-specific number for this system call
Returns the platform-specific number for this system call

.. cpp:function:: SyscallName name() const

Returns the name for this system call (e.g., "getpid")

.. cpp:function:: bool operator==(const MachSyscall &) const

Strict equality-based matching on Platforms and IDs

0 comments on commit 69acddb

Please sign in to comment.