0002-linux-remove-explicit-uses-of-__ptrace_request.patch 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. From 3e662598e1d9ad682e470988764c3af5b1a78cb7 Mon Sep 17 00:00:00 2001
  2. From: Norbert Lange <nolange79@gmail.com>
  3. Date: Fri, 1 Dec 2017 13:15:50 +0100
  4. Subject: [PATCH] linux: remove explicit uses of __ptrace_request
  5. This type is not to be used directly, and with musl it wont build
  6. Signed-off-by: Norbert Lange <nolange79@gmail.com>
  7. ---
  8. agent/machine/arm/tcf/cpudefs-mdep.c | 4 ++--
  9. agent/machine/arm/tcf/regset-mdep.h | 4 ++--
  10. agent/system/GNU/Linux/tcf/context-linux.c | 18 +++++++++---------
  11. 3 files changed, 13 insertions(+), 13 deletions(-)
  12. diff --git a/agent/machine/arm/tcf/cpudefs-mdep.c b/agent/machine/arm/tcf/cpudefs-mdep.c
  13. index 27ab0129..0bc8b146 100644
  14. --- a/agent/machine/arm/tcf/cpudefs-mdep.c
  15. +++ b/agent/machine/arm/tcf/cpudefs-mdep.c
  16. @@ -89,10 +89,10 @@ static RegisterDefinition * lr_def = NULL;
  17. static RegisterDefinition * cpsr_def = NULL;
  18. #if !defined(PTRACE_GETHBPREGS)
  19. -#define PTRACE_GETHBPREGS (enum __ptrace_request)29
  20. +#define PTRACE_GETHBPREGS 29
  21. #endif
  22. #if !defined(PTRACE_SETHBPREGS)
  23. -#define PTRACE_SETHBPREGS (enum __ptrace_request)30
  24. +#define PTRACE_SETHBPREGS 30
  25. #endif
  26. #define ARM_DEBUG_ARCH_V6 1
  27. diff --git a/agent/machine/arm/tcf/regset-mdep.h b/agent/machine/arm/tcf/regset-mdep.h
  28. index e5516042..893ba64f 100644
  29. --- a/agent/machine/arm/tcf/regset-mdep.h
  30. +++ b/agent/machine/arm/tcf/regset-mdep.h
  31. @@ -28,11 +28,11 @@
  32. #endif
  33. #ifndef PTRACE_GETREGSET
  34. -#define PTRACE_GETREGSET (enum __ptrace_request)0x4204
  35. +#define PTRACE_GETREGSET 0x4204
  36. #endif
  37. #ifndef PTRACE_SETREGSET
  38. -#define PTRACE_SETREGSET (enum __ptrace_request)0x4205
  39. +#define PTRACE_SETREGSET 0x4205
  40. #endif
  41. struct regset_gp {
  42. diff --git a/agent/system/GNU/Linux/tcf/context-linux.c b/agent/system/GNU/Linux/tcf/context-linux.c
  43. index d4eb5e6b..4c86021e 100644
  44. --- a/agent/system/GNU/Linux/tcf/context-linux.c
  45. +++ b/agent/system/GNU/Linux/tcf/context-linux.c
  46. @@ -60,10 +60,10 @@
  47. #endif
  48. #if !defined(PTRACE_SETOPTIONS)
  49. -#define PTRACE_SETOPTIONS (enum __ptrace_request)0x4200
  50. -#define PTRACE_GETEVENTMSG (enum __ptrace_request)0x4201
  51. -#define PTRACE_GETSIGINFO (enum __ptrace_request)0x4202
  52. -#define PTRACE_SETSIGINFO (enum __ptrace_request)0x4203
  53. +#define PTRACE_SETOPTIONS 0x4200
  54. +#define PTRACE_GETEVENTMSG 0x4201
  55. +#define PTRACE_GETSIGINFO 0x4202
  56. +#define PTRACE_SETSIGINFO 0x4203
  57. #define PTRACE_O_TRACESYSGOOD 0x00000001
  58. #define PTRACE_O_TRACEFORK 0x00000002
  59. @@ -85,8 +85,8 @@
  60. #if defined(__arm__) || defined(__aarch64__)
  61. #if !defined(PTRACE_GETVFPREGS)
  62. -#define PTRACE_GETVFPREGS (enum __ptrace_request)27
  63. -#define PTRACE_SETVFPREGS (enum __ptrace_request)28
  64. +#define PTRACE_GETVFPREGS 27
  65. +#define PTRACE_SETVFPREGS 28
  66. #endif
  67. #endif
  68. @@ -483,7 +483,7 @@ static const char * get_ptrace_cmd_name(int cmd) {
  69. static int do_single_step(Context * ctx) {
  70. uint32_t is_cont = 0;
  71. ContextExtensionLinux * ext = EXT(ctx);
  72. - enum __ptrace_request cmd = PTRACE_SINGLESTEP;
  73. + int cmd = PTRACE_SINGLESTEP;
  74. assert(!ext->pending_step);
  75. @@ -540,9 +540,9 @@ int context_continue(Context * ctx) {
  76. int signal = 0;
  77. ContextExtensionLinux * ext = EXT(ctx);
  78. #if USE_PTRACE_SYSCALL
  79. - enum __ptrace_request cmd = PTRACE_SYSCALL;
  80. + int cmd = PTRACE_SYSCALL;
  81. #else
  82. - enum __ptrace_request cmd = PTRACE_CONT;
  83. + int cmd = PTRACE_CONT;
  84. #endif
  85. assert(is_dispatch_thread());
  86. --
  87. 2.15.1