ptrace.h 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  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. #include <linux/types.h>
  7. #define PTRACE_TRACEME 0
  8. #define PTRACE_PEEKTEXT 1
  9. #define PTRACE_PEEKDATA 2
  10. #define PTRACE_PEEKUSR 3
  11. #define PTRACE_POKETEXT 4
  12. #define PTRACE_POKEDATA 5
  13. #define PTRACE_POKEUSR 6
  14. #define PTRACE_CONT 7
  15. #define PTRACE_KILL 8
  16. #define PTRACE_SINGLESTEP 9
  17. #define PTRACE_ATTACH 16
  18. #define PTRACE_DETACH 17
  19. #define PTRACE_SYSCALL 24
  20. /* 0x4200-0x4300 are reserved for architecture-independent additions. */
  21. #define PTRACE_SETOPTIONS 0x4200
  22. #define PTRACE_GETEVENTMSG 0x4201
  23. #define PTRACE_GETSIGINFO 0x4202
  24. #define PTRACE_SETSIGINFO 0x4203
  25. /*
  26. * Generic ptrace interface that exports the architecture specific regsets
  27. * using the corresponding NT_* types (which are also used in the core dump).
  28. * Please note that the NT_PRSTATUS note type in a core dump contains a full
  29. * 'struct elf_prstatus'. But the user_regset for NT_PRSTATUS contains just the
  30. * elf_gregset_t that is the pr_reg field of 'struct elf_prstatus'. For all the
  31. * other user_regset flavors, the user_regset layout and the ELF core dump note
  32. * payload are exactly the same layout.
  33. *
  34. * This interface usage is as follows:
  35. * struct iovec iov = { buf, len};
  36. *
  37. * ret = ptrace(PTRACE_GETREGSET/PTRACE_SETREGSET, pid, NT_XXX_TYPE, &iov);
  38. *
  39. * On the successful completion, iov.len will be updated by the kernel,
  40. * specifying how much the kernel has written/read to/from the user's iov.buf.
  41. */
  42. #define PTRACE_GETREGSET 0x4204
  43. #define PTRACE_SETREGSET 0x4205
  44. #define PTRACE_SEIZE 0x4206
  45. #define PTRACE_INTERRUPT 0x4207
  46. #define PTRACE_LISTEN 0x4208
  47. #define PTRACE_PEEKSIGINFO 0x4209
  48. struct ptrace_peeksiginfo_args {
  49. __u64 off; /* from which siginfo to start */
  50. __u32 flags;
  51. __s32 nr; /* how may siginfos to take */
  52. };
  53. #define PTRACE_GETSIGMASK 0x420a
  54. #define PTRACE_SETSIGMASK 0x420b
  55. #define PTRACE_SECCOMP_GET_FILTER 0x420c
  56. /* Read signals from a shared (process wide) queue */
  57. #define PTRACE_PEEKSIGINFO_SHARED (1 << 0)
  58. /* Wait extended result codes for the above trace options. */
  59. #define PTRACE_EVENT_FORK 1
  60. #define PTRACE_EVENT_VFORK 2
  61. #define PTRACE_EVENT_CLONE 3
  62. #define PTRACE_EVENT_EXEC 4
  63. #define PTRACE_EVENT_VFORK_DONE 5
  64. #define PTRACE_EVENT_EXIT 6
  65. #define PTRACE_EVENT_SECCOMP 7
  66. /* Extended result codes which enabled by means other than options. */
  67. #define PTRACE_EVENT_STOP 128
  68. /* Options set using PTRACE_SETOPTIONS or using PTRACE_SEIZE @data param */
  69. #define PTRACE_O_TRACESYSGOOD 1
  70. #define PTRACE_O_TRACEFORK (1 << PTRACE_EVENT_FORK)
  71. #define PTRACE_O_TRACEVFORK (1 << PTRACE_EVENT_VFORK)
  72. #define PTRACE_O_TRACECLONE (1 << PTRACE_EVENT_CLONE)
  73. #define PTRACE_O_TRACEEXEC (1 << PTRACE_EVENT_EXEC)
  74. #define PTRACE_O_TRACEVFORKDONE (1 << PTRACE_EVENT_VFORK_DONE)
  75. #define PTRACE_O_TRACEEXIT (1 << PTRACE_EVENT_EXIT)
  76. #define PTRACE_O_TRACESECCOMP (1 << PTRACE_EVENT_SECCOMP)
  77. /* eventless options */
  78. #define PTRACE_O_EXITKILL (1 << 20)
  79. #define PTRACE_O_SUSPEND_SECCOMP (1 << 21)
  80. #define PTRACE_O_MASK (\
  81. 0x000000ff | PTRACE_O_EXITKILL | PTRACE_O_SUSPEND_SECCOMP)
  82. #include <asm/ptrace.h>
  83. #endif /* _LINUX_PTRACE_H */