ptrace.h 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. #ifndef _LINUX_PTRACE_H
  2. #define _LINUX_PTRACE_H
  3. /* ptrace.h */
  4. /* structs and defines to help the user use the ptrace system call. */
  5. /* has the defines to get at the registers. */
  6. #define PTRACE_TRACEME 0
  7. #define PTRACE_PEEKTEXT 1
  8. #define PTRACE_PEEKDATA 2
  9. #define PTRACE_PEEKUSR 3
  10. #define PTRACE_POKETEXT 4
  11. #define PTRACE_POKEDATA 5
  12. #define PTRACE_POKEUSR 6
  13. #define PTRACE_CONT 7
  14. #define PTRACE_KILL 8
  15. #define PTRACE_SINGLESTEP 9
  16. #define PTRACE_ATTACH 16
  17. #define PTRACE_DETACH 17
  18. #define PTRACE_SYSCALL 24
  19. /* 0x4200-0x4300 are reserved for architecture-independent additions. */
  20. #define PTRACE_SETOPTIONS 0x4200
  21. #define PTRACE_GETEVENTMSG 0x4201
  22. #define PTRACE_GETSIGINFO 0x4202
  23. #define PTRACE_SETSIGINFO 0x4203
  24. /*
  25. * Generic ptrace interface that exports the architecture specific regsets
  26. * using the corresponding NT_* types (which are also used in the core dump).
  27. * Please note that the NT_PRSTATUS note type in a core dump contains a full
  28. * 'struct elf_prstatus'. But the user_regset for NT_PRSTATUS contains just the
  29. * elf_gregset_t that is the pr_reg field of 'struct elf_prstatus'. For all the
  30. * other user_regset flavors, the user_regset layout and the ELF core dump note
  31. * payload are exactly the same layout.
  32. *
  33. * This interface usage is as follows:
  34. * struct iovec iov = { buf, len};
  35. *
  36. * ret = ptrace(PTRACE_GETREGSET/PTRACE_SETREGSET, pid, NT_XXX_TYPE, &iov);
  37. *
  38. * On the successful completion, iov.len will be updated by the kernel,
  39. * specifying how much the kernel has written/read to/from the user's iov.buf.
  40. */
  41. #define PTRACE_GETREGSET 0x4204
  42. #define PTRACE_SETREGSET 0x4205
  43. /* options set using PTRACE_SETOPTIONS */
  44. #define PTRACE_O_TRACESYSGOOD 0x00000001
  45. #define PTRACE_O_TRACEFORK 0x00000002
  46. #define PTRACE_O_TRACEVFORK 0x00000004
  47. #define PTRACE_O_TRACECLONE 0x00000008
  48. #define PTRACE_O_TRACEEXEC 0x00000010
  49. #define PTRACE_O_TRACEVFORKDONE 0x00000020
  50. #define PTRACE_O_TRACEEXIT 0x00000040
  51. #define PTRACE_O_MASK 0x0000007f
  52. /* Wait extended result codes for the above trace options. */
  53. #define PTRACE_EVENT_FORK 1
  54. #define PTRACE_EVENT_VFORK 2
  55. #define PTRACE_EVENT_CLONE 3
  56. #define PTRACE_EVENT_EXEC 4
  57. #define PTRACE_EVENT_VFORK_DONE 5
  58. #define PTRACE_EVENT_EXIT 6
  59. #include <asm/ptrace.h>
  60. #endif