ptrace.h 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. #ifndef _UAPI_LINUX_PTRACE_H
  2. #define _UAPI_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. #define PTRACE_SEIZE 0x4206
  44. #define PTRACE_INTERRUPT 0x4207
  45. #define PTRACE_LISTEN 0x4208
  46. /* Wait extended result codes for the above trace options. */
  47. #define PTRACE_EVENT_FORK 1
  48. #define PTRACE_EVENT_VFORK 2
  49. #define PTRACE_EVENT_CLONE 3
  50. #define PTRACE_EVENT_EXEC 4
  51. #define PTRACE_EVENT_VFORK_DONE 5
  52. #define PTRACE_EVENT_EXIT 6
  53. #define PTRACE_EVENT_SECCOMP 7
  54. /* Extended result codes which enabled by means other than options. */
  55. #define PTRACE_EVENT_STOP 128
  56. /* Options set using PTRACE_SETOPTIONS or using PTRACE_SEIZE @data param */
  57. #define PTRACE_O_TRACESYSGOOD 1
  58. #define PTRACE_O_TRACEFORK (1 << PTRACE_EVENT_FORK)
  59. #define PTRACE_O_TRACEVFORK (1 << PTRACE_EVENT_VFORK)
  60. #define PTRACE_O_TRACECLONE (1 << PTRACE_EVENT_CLONE)
  61. #define PTRACE_O_TRACEEXEC (1 << PTRACE_EVENT_EXEC)
  62. #define PTRACE_O_TRACEVFORKDONE (1 << PTRACE_EVENT_VFORK_DONE)
  63. #define PTRACE_O_TRACEEXIT (1 << PTRACE_EVENT_EXIT)
  64. #define PTRACE_O_TRACESECCOMP (1 << PTRACE_EVENT_SECCOMP)
  65. #define PTRACE_O_MASK 0x000000ff
  66. #include <asm/ptrace.h>
  67. #endif /* _UAPI_LINUX_PTRACE_H */