Module: Peep

Defined in:
lib/peep/peep.rb,
ext/ptrace.c

Defined Under Namespace

Classes: Analysis

Constant Summary collapse

SIZES =
sizes()
ITEM_OFFSETS =
item_offsets()
STATS_OFFSETS =
stats_offsets()
SETTINGS_OFFSETS =
settings_offsets()

Class Method Summary collapse

Class Method Details

.attachObject



100
101
102
103
104
105
106
# File 'ext/ptrace.c', line 100

static VALUE attach (VALUE self, VALUE pid_)
{
  pid_t pid = NUM2INT(pid_);
  if (ptrace (PTRACE_ATTACH, pid, 0, 0))
    fail(pid);
  return Qtrue;
}

.detachObject



108
109
110
111
112
113
114
# File 'ext/ptrace.c', line 108

static VALUE detach (VALUE self, VALUE pid_)
{
  pid_t pid = NUM2INT(pid_);
  if (ptrace (PTRACE_DETACH, pid, 0, 0))
    fail(pid);
  return Qtrue;
}

.peekObject



116
117
118
119
120
121
122
123
# File 'ext/ptrace.c', line 116

static VALUE peek (VALUE self, VALUE pid_, VALUE address)
{
  pid_t pid = NUM2INT(pid_);
  long byte = ptrace (PTRACE_PEEKDATA, pid, (void *) NUM2ULONG(address), 0);
  if (byte == -1 && errno)
    fail(pid);
  return ULONG2NUM((unsigned long) byte);
}