Mirror of strace – the linux syscall tracer
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

ptrace_backend.h 2.1KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. /*
  2. * ptrace(2)-based backend interface.
  3. *
  4. * Copyright (c) 2017-2019 The strace developers.
  5. * All rights reserved.
  6. *
  7. * SPDX-License-Identifier: LGPL-2.1-or-later
  8. */
  9. #ifndef STRACE_PTRACE_BACKEND_H
  10. #define STRACE_PTRACE_BACKEND_H
  11. #include "defs.h"
  12. #include "trace_event.h"
  13. extern bool ptrace_init(int argc, char *argv[]);
  14. extern void ptrace_startup_child(char **argv, char **env);
  15. extern void ptrace_attach_tcb(struct tcb *const tcp);
  16. extern void ptrace_detach(struct tcb *tcp);
  17. extern struct tcb_wait_data *ptrace_init_trace_wait_data(void *p);
  18. extern struct tcb_wait_data *ptrace_copy_trace_wait_data(struct
  19. tcb_wait_data *wd);
  20. extern void ptrace_free_trace_wait_data(struct tcb_wait_data *wd);
  21. extern struct tcb_wait_data *ptrace_next_event(void);
  22. extern void ptrace_handle_exec(struct tcb **current_tcp,
  23. struct tcb_wait_data *wd);
  24. extern bool ptrace_restart_process(struct tcb *current_tcp,
  25. struct tcb_wait_data *wd);
  26. extern void ptrace_clear_regs(struct tcb *tcp);
  27. extern long ptrace_get_regs(struct tcb * const tcp);
  28. extern int ptrace_get_scno(struct tcb *tcp);
  29. extern int ptrace_set_scno(struct tcb *tcp, kernel_ulong_t scno);
  30. extern void ptrace_set_error(struct tcb *tcp, unsigned long new_error);
  31. extern void ptrace_set_success(struct tcb *tcp, kernel_long_t new_rval);
  32. extern bool ptrace_get_instruction_pointer(struct tcb *tcp, kernel_ulong_t *ip);
  33. extern bool ptrace_get_stack_pointer(struct tcb *tcp, kernel_ulong_t *sp);
  34. extern int ptrace_get_syscall_args(struct tcb *tcp);
  35. extern int ptrace_get_syscall_result(struct tcb *tcp);
  36. extern int ptrace_umoven(struct tcb *const tcp, kernel_ulong_t addr,
  37. unsigned int len, void *const our_addr);
  38. extern int ptrace_umovestr(struct tcb *const tcp, kernel_ulong_t addr,
  39. unsigned int len, char *laddr);
  40. extern int ptrace_upeek(struct tcb *tcp, unsigned long off,
  41. kernel_ulong_t *res);
  42. extern int ptrace_upoke(struct tcb *tcp, unsigned long off, kernel_ulong_t val);
  43. #if ADDITIONAL_TRACING_BACKENDS
  44. extern const struct tracing_backend ptrace_backend;
  45. #endif /* ADDITIONAL_TRACING_BACKENDS */
  46. #endif /* !STRACE_PTRACE_BACKEND_H */