ptrace.h 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. /*
  2. * Copyright (C) 2016 Andes Technology, Inc.
  3. * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
  4. */
  5. /* `ptrace' debugger support interface. Linux version.
  6. Copyright (C) 1996, 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
  7. The GNU C Library is free software; you can redistribute it and/or
  8. modify it under the terms of the GNU Lesser General Public
  9. License as published by the Free Software Foundation; either
  10. version 2.1 of the License, or (at your option) any later version.
  11. The GNU C Library is distributed in the hope that it will be useful,
  12. but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  14. Lesser General Public License for more details.
  15. You should have received a copy of the GNU Lesser General Public
  16. License along with the GNU C Library; if not, write to the Free
  17. Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
  18. 02111-1307 USA. */
  19. #ifndef _SYS_PTRACE_H
  20. #define _SYS_PTRACE_H 1
  21. #include <features.h>
  22. __BEGIN_DECLS
  23. /* Type of the REQUEST argument to `ptrace.' */
  24. enum __ptrace_request
  25. {
  26. /* Indicate that the process making this request should be traced.
  27. All signals received by this process can be intercepted by its
  28. parent, and its parent can use the other `ptrace' requests. */
  29. PTRACE_TRACEME = 0,
  30. #define PT_TRACE_ME PTRACE_TRACEME
  31. /* Return the word in the process's text space at address ADDR. */
  32. PTRACE_PEEKTEXT = 1,
  33. #define PT_READ_I PTRACE_PEEKTEXT
  34. /* Return the word in the process's data space at address ADDR. */
  35. PTRACE_PEEKDATA = 2,
  36. #define PT_READ_D PTRACE_PEEKDATA
  37. /* Return the word in the process's user area at offset ADDR. */
  38. PTRACE_PEEKUSER = 3,
  39. #define PT_READ_U PTRACE_PEEKUSER
  40. /* Write the word DATA into the process's text space at address ADDR. */
  41. PTRACE_POKETEXT = 4,
  42. #define PT_WRITE_I PTRACE_POKETEXT
  43. /* Write the word DATA into the process's data space at address ADDR. */
  44. PTRACE_POKEDATA = 5,
  45. #define PT_WRITE_D PTRACE_POKEDATA
  46. /* Write the word DATA into the process's user area at offset ADDR. */
  47. PTRACE_POKEUSER = 6,
  48. #define PT_WRITE_U PTRACE_POKEUSER
  49. /* Continue the process. */
  50. PTRACE_CONT = 7,
  51. #define PT_CONTINUE PTRACE_CONT
  52. /* Kill the process. */
  53. PTRACE_KILL = 8,
  54. #define PT_KILL PTRACE_KILL
  55. /* Single step the process.
  56. This is not supported on all machines. */
  57. PTRACE_SINGLESTEP = 9,
  58. #define PT_STEP PTRACE_SINGLESTEP
  59. /* Get all general purpose registers used by a processes.
  60. This is not supported on all machines. */
  61. PTRACE_GETREGS = 12,
  62. #define PT_GETREGS PTRACE_GETREGS
  63. /* Set all general purpose registers used by a processes.
  64. This is not supported on all machines. */
  65. PTRACE_SETREGS = 13,
  66. #define PT_SETREGS PTRACE_SETREGS
  67. /* Get all floating point registers used by a processes.
  68. This is not supported on all machines. */
  69. PTRACE_GETFPREGS = 14,
  70. #define PT_GETFPREGS PTRACE_GETFPREGS
  71. /* Set all floating point registers used by a processes.
  72. This is not supported on all machines. */
  73. PTRACE_SETFPREGS = 15,
  74. #define PT_SETFPREGS PTRACE_SETFPREGS
  75. /* Attach to a process that is already running. */
  76. PTRACE_ATTACH = 16,
  77. #define PT_ATTACH PTRACE_ATTACH
  78. /* Detach from a process attached to with PTRACE_ATTACH. */
  79. PTRACE_DETACH = 17,
  80. #define PT_DETACH PTRACE_DETACH
  81. /* Get all extended floating point registers used by a processes.
  82. This is not supported on all machines. */
  83. PTRACE_GETFPXREGS = 18,
  84. #define PT_GETFPXREGS PTRACE_GETFPXREGS
  85. /* Set all extended floating point registers used by a processes.
  86. This is not supported on all machines. */
  87. PTRACE_SETFPXREGS = 19,
  88. #define PT_SETFPXREGS PTRACE_SETFPXREGS
  89. /* Continue and stop at the next (return from) syscall. */
  90. PTRACE_SYSCALL = 24
  91. #define PT_SYSCALL PTRACE_SYSCALL
  92. };
  93. /* Perform process tracing functions. REQUEST is one of the values
  94. above, and determines the action to be taken.
  95. For all requests except PTRACE_TRACEME, PID specifies the process to be
  96. traced.
  97. PID and the other arguments described above for the various requests should
  98. appear (those that are used for the particular request) as:
  99. pid_t PID, void *ADDR, int DATA, void *ADDR2
  100. after REQUEST. */
  101. extern long int ptrace (enum __ptrace_request __request, ...) __THROW;
  102. __END_DECLS
  103. #endif /* _SYS_PTRACE_H */