Skip to content

Commit

Permalink
update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
ba0f3 committed Sep 16, 2015
1 parent e16cfef commit 2bffdd4
Showing 1 changed file with 34 additions and 1 deletion.
35 changes: 34 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,35 @@
# ptrace.nim
ptrace wrapper for Nim
ptrace wrapper and helpers for Nim


## Installation

$ nimble install ptrace

## Example

```nim
import ptrace/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 = getRegs(child)
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, nil)
```

0 comments on commit 2bffdd4

Please sign in to comment.