ptrace.h 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182
  1. /* `ptrace' debugger support interface. Linux/SPARC version.
  2. Copyright (C) 1996, 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
  3. This file is part of the GNU C Library.
  4. The GNU C Library is free software; you can redistribute it and/or
  5. modify it under the terms of the GNU Lesser General Public
  6. License as published by the Free Software Foundation; either
  7. version 2.1 of the License, or (at your option) any later version.
  8. The GNU C Library is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  11. Lesser General Public License for more details.
  12. You should have received a copy of the GNU Lesser General Public
  13. License along with the GNU C Library; if not, see
  14. <http://www.gnu.org/licenses/>. */
  15. #ifndef _SYS_PTRACE_H
  16. #define _SYS_PTRACE_H 1
  17. #include <features.h>
  18. #include <bits/wordsize.h>
  19. /* Linux/SPARC kernels up to 2.3.18 do not care much
  20. about what namespace polution, so use a kludge now. */
  21. #undef PTRACE_GETREGS
  22. #undef PTRACE_SETREGS
  23. #undef PTRACE_GETFPREGS
  24. #undef PTRACE_SETFPREGS
  25. #undef PTRACE_READDATA
  26. #undef PTRACE_WRITEDATA
  27. #undef PTRACE_READTEXT
  28. #undef PTRACE_WRITETEXT
  29. #undef PTRACE_SUNDETACH
  30. __BEGIN_DECLS
  31. /* Type of the REQUEST argument to `ptrace.' */
  32. enum __ptrace_request
  33. {
  34. /* Indicate that the process making this request should be traced.
  35. All signals received by this process can be intercepted by its
  36. parent, and its parent can use the other `ptrace' requests. */
  37. PTRACE_TRACEME = 0,
  38. #define PT_TRACE_ME PTRACE_TRACEME
  39. /* Return the word in the process's text space at address ADDR. */
  40. PTRACE_PEEKTEXT = 1,
  41. #define PT_READ_I PTRACE_PEEKTEXT
  42. /* Return the word in the process's data space at address ADDR. */
  43. PTRACE_PEEKDATA = 2,
  44. #define PT_READ_D PTRACE_PEEKDATA
  45. /* Return the word in the process's user area at offset ADDR. */
  46. PTRACE_PEEKUSER = 3,
  47. #define PT_READ_U PTRACE_PEEKUSER
  48. /* Write the word DATA into the process's text space at address ADDR. */
  49. PTRACE_POKETEXT = 4,
  50. #define PT_WRITE_I PTRACE_POKETEXT
  51. /* Write the word DATA into the process's data space at address ADDR. */
  52. PTRACE_POKEDATA = 5,
  53. #define PT_WRITE_D PTRACE_POKEDATA
  54. /* Write the word DATA into the process's user area at offset ADDR. */
  55. PTRACE_POKEUSER = 6,
  56. #define PT_WRITE_U PTRACE_POKEUSER
  57. /* Continue the process. */
  58. PTRACE_CONT = 7,
  59. #define PT_CONTINUE PTRACE_CONT
  60. /* Kill the process. */
  61. PTRACE_KILL = 8,
  62. #define PT_KILL PTRACE_KILL
  63. /* Single step the process.
  64. This is not supported on all machines. */
  65. PTRACE_SINGLESTEP = 9,
  66. #define PT_STEP PTRACE_SINGLESTEP
  67. /* Detach from a process attached to with PTRACE_ATTACH. */
  68. PTRACE_DETACH = 11,
  69. #define PT_DETACH PTRACE_DETACH
  70. /* This define is needed for older programs which were
  71. trying to work around sparc-linux ptrace nastiness. */
  72. #define PTRACE_SUNDETACH PTRACE_DETACH
  73. #if __WORDSIZE == 32
  74. /* Get all general purpose registers used by a processes.
  75. This is not supported on all machines. */
  76. PTRACE_GETREGS = 12,
  77. #define PT_GETREGS PTRACE_GETREGS
  78. /* Set all general purpose registers used by a processes.
  79. This is not supported on all machines. */
  80. PTRACE_SETREGS = 13,
  81. #define PT_SETREGS PTRACE_SETREGS
  82. /* Get all floating point registers used by a processes.
  83. This is not supported on all machines. */
  84. PTRACE_GETFPREGS = 14,
  85. #define PT_GETFPREGS PTRACE_GETFPREGS
  86. /* Set all floating point registers used by a processes.
  87. This is not supported on all machines. */
  88. PTRACE_SETFPREGS = 15,
  89. #define PT_SETFPREGS PTRACE_SETFPREGS
  90. #endif
  91. /* Attach to a process that is already running. */
  92. PTRACE_ATTACH = 16,
  93. #define PT_ATTACH PTRACE_ATTACH
  94. /* Write several bytes at a time. */
  95. PTRACE_WRITEDATA = 17,
  96. #define PTRACE_WRITEDATA PTRACE_WRITEDATA
  97. /* Read several bytes at a time. */
  98. PTRACE_READTEXT = 18,
  99. #define PTRACE_READTEXT PTRACE_READTEXT
  100. #define PTRACE_READDATA PTRACE_READTEXT
  101. /* Write several bytes at a time. */
  102. PTRACE_WRITETEXT = 19,
  103. #define PTRACE_WRITETEXT PTRACE_WRITETEXT
  104. #if __WORDSIZE == 64
  105. /* Get all general purpose registers used by a processes.
  106. This is not supported on all machines. */
  107. PTRACE_GETREGS = 22,
  108. #define PT_GETREGS PTRACE_GETREGS
  109. /* Set all general purpose registers used by a processes.
  110. This is not supported on all machines. */
  111. PTRACE_SETREGS = 23,
  112. #define PT_SETREGS PTRACE_SETREGS
  113. #endif
  114. /* Continue and stop at the next (return from) syscall. */
  115. PTRACE_SYSCALL = 24
  116. #define PTRACE_SYSCALL PTRACE_SYSCALL
  117. #if __WORDSIZE == 64
  118. ,
  119. /* Get all floating point registers used by a processes.
  120. This is not supported on all machines. */
  121. PTRACE_GETFPREGS = 25,
  122. #define PT_GETFPREGS PTRACE_GETFPREGS
  123. /* Set all floating point registers used by a processes.
  124. This is not supported on all machines. */
  125. PTRACE_SETFPREGS = 26
  126. #define PT_SETFPREGS PTRACE_SETFPREGS
  127. #endif
  128. };
  129. /* Perform process tracing functions. REQUEST is one of the values
  130. above, and determines the action to be taken.
  131. For all requests except PTRACE_TRACEME, PID specifies the process to be
  132. traced.
  133. PID and the other arguments described above for the various requests should
  134. appear (those that are used for the particular request) as:
  135. pid_t PID, void *ADDR, int DATA, void *ADDR2
  136. after REQUEST. */
  137. extern long int ptrace (enum __ptrace_request __request, ...) __THROW;
  138. __END_DECLS
  139. #endif /* _SYS_PTRACE_H */