Skip to content

Commit

Permalink
staticmethods to get syscall info
Browse files Browse the repository at this point in the history
  • Loading branch information
ekilmer committed Apr 30, 2021
1 parent 101596e commit ba5597c
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
15 changes: 15 additions & 0 deletions manticore/platforms/linux.py
Original file line number Diff line number Diff line change
Expand Up @@ -3329,6 +3329,21 @@ def _interp_total_size(interp):
last = load_segs[-1]
return last.header.p_vaddr + last.header.p_memsz

@staticmethod
def implemented_syscalls() -> Iterable[str]:
import inspect

return (
x[0].split("sys_", 1)[1]
for x in inspect.getmembers(Linux, predicate=inspect.isfunction)
if x[0].startswith("sys_")
)

@staticmethod
def print_implemented_syscalls() -> None:
for syscall in Linux.implemented_syscalls():
print(syscall)


############################################################################
# Symbolic versions follows
Expand Down
17 changes: 17 additions & 0 deletions manticore/platforms/linux_syscall_stubs.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from typing import Iterable

from ..platforms.platform import SyscallNotImplemented, unimplemented
from .linux_syscalls import amd64

Expand Down Expand Up @@ -1187,3 +1189,18 @@ def sys_wait4(self, upid, stat_addr, options, ru) -> int:
def sys_waitid(self, which, upid, infop, options, ru) -> int:
""" AUTOGENERATED UNIMPLEMENTED STUB """
return self.simple_returns()

@staticmethod
def unimplemented_syscalls() -> Iterable[str]:
import inspect

return (
x[0].split("sys_", 1)[1]
for x in inspect.getmembers(SyscallStubs, predicate=inspect.isfunction)
if x[0].startswith("sys_")
)

@staticmethod
def print_unimplemented_syscalls() -> None:
for syscall in SyscallStubs.unimplemented_syscalls():
print(syscall)

0 comments on commit ba5597c

Please sign in to comment.