Back to index

glibc  2.9
Functions
ptrace.c File Reference
#include <errno.h>
#include <sys/ptrace.h>
#include <sys/types.h>
#include <stdarg.h>
#include <stub-tag.h>

Go to the source code of this file.

Functions

int ptrace (enum __ptrace_request request)

Function Documentation

int ptrace ( enum __ptrace_request  request)

Definition at line 34 of file ptrace.c.

{
  pid_t pid;
  void *addr;
  void *addr2;
  int data;
  va_list ap;

  switch (request)
    {
    case PTRACE_TRACEME:
    case PTRACE_CONT:
    case PTRACE_KILL:
    case PTRACE_SINGLESTEP:
    case PTRACE_ATTACH:
    case PTRACE_DETACH:
      break;

    case PTRACE_PEEKTEXT:
    case PTRACE_PEEKDATA:
    case PTRACE_PEEKUSER:
    case PTRACE_GETREGS:
    case PTRACE_SETREGS:
#ifdef PTRACE_GETFPREGS
    case PTRACE_GETFPGEGS:
#endif
    case PTRACE_SETFPREGS:
    case PTRACE_GETFPAREGS:
    case PTRACE_SETFPAREGS:
      va_start(ap, request);
      pid = va_arg(ap, pid_t);
      addr = va_arg(ap, void *);
      va_end(ap);
      break;

    case PTRACE_POKETEXT:
    case PTRACE_POKEDATA:
    case PTRACE_POKEUSER:
      va_start(ap, request);
      pid = va_arg(ap, pid_t);
      addr = va_arg(ap, void *);
      data = va_arg(ap, int);
      va_end(ap);
      break;

    case PTRACE_READDATA:
    case PTRACE_WRITEDATA:
    case PTRACE_READTEXT:
    case PTRACE_WRITETEXT:
      va_start(ap, request);
      pid = va_arg(ap, pid_t);
      addr = va_arg(ap, void *);
      data = va_arg(ap, int);
      addr2 = va_arg(ap, void *);
      va_end(ap);
      break;

    default:
      __set_errno (EINVAL);
      return -1;
    }

  __set_errno (ENOSYS);
  return -1;
}

Here is the caller graph for this function: