ptrace

ptrace wrapper for Nim

Pure Nim score 15/100 · tests present · no docs generated

Summary

Latest Version Unknown
License MIT
CI Status Failing
Downloads 0
Last Indexed 2026-07-21 05:24

Installation

nimble install ptrace
choosenim install ptrace
git clone https://github.com/ba0f3/ptrace.nim

OS Compatibility

Platform Linux macOS Windows FreeBSD OpenBSD NetBSD Android iOS WASM Embedded
ptrace - - - - - - -

Source

Repository https://github.com/ba0f3/ptrace.nim
Homepage https://github.com/ba0f3/ptrace.nim
Registry Source nimble_official

README

ptrace.nim

ptrace wrapper and helpers for Nim

Installation

$ nimble install ptrace

Example

import posix, ptrace

var child: Pid;
var syscallNum: clong;

child = fork()
if child == 0:
  traceMe()
  discard execl("/bin/ls", "ls")
else:
  var a: cint
  wait(nil)

  var regs: Registers
  getRegs(child, addr regs)
  echo "Syscall number: ", regs.orig_rax
  if errno != 0:
    echo errno, " ", strerror(errno)

  syscallNum = peekUser(child, SYSCALL_NUM)
  if errno != 0:
    echo errno, " ", strerror(errno)
  echo "The child made a system call: ", syscallNum
  cont(child)