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.

unwind.h 2.7KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. /*
  2. * Unwinder backends interface.
  3. *
  4. * Copyright (c) 2013 Luca Clementi <luca.clementi@gmail.com>
  5. * Copyright (c) 2013-2018 The strace developers.
  6. *
  7. * Redistribution and use in source and binary forms, with or without
  8. * modification, are permitted provided that the following conditions
  9. * are met:
  10. * 1. Redistributions of source code must retain the above copyright
  11. * notice, this list of conditions and the following disclaimer.
  12. * 2. Redistributions in binary form must reproduce the above copyright
  13. * notice, this list of conditions and the following disclaimer in the
  14. * documentation and/or other materials provided with the distribution.
  15. * 3. The name of the author may not be used to endorse or promote products
  16. * derived from this software without specific prior written permission.
  17. *
  18. * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
  19. * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
  20. * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
  21. * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
  22. * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
  23. * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  24. * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  25. * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  26. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  27. * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  28. */
  29. #ifndef STRACE_UNWIND_H
  30. #define STRACE_UNWIND_H
  31. #include "defs.h"
  32. /*
  33. * Type used in stacktrace walker.
  34. */
  35. /* This storage be enough large to store unw_word_t. */
  36. typedef unsigned long unwind_function_offset_t;
  37. typedef void (*unwind_call_action_fn)(void *data,
  38. const char *binary_filename,
  39. const char *symbol_name,
  40. unwind_function_offset_t function_offset,
  41. unsigned long true_offset);
  42. typedef void (*unwind_error_action_fn)(void *data,
  43. const char *error,
  44. unsigned long true_offset);
  45. struct unwind_unwinder_t {
  46. const char *name;
  47. /* Initialize the unwinder. */
  48. void (*init)(void);
  49. /* Make/destroy the context data attached to tcb. */
  50. void * (*tcb_init)(struct tcb *);
  51. void (*tcb_fin)(struct tcb *);
  52. /* Walk the stack. */
  53. void (*tcb_walk)(struct tcb *,
  54. unwind_call_action_fn,
  55. unwind_error_action_fn,
  56. void *);
  57. /*
  58. * Rebuild the unwinder internal cache. Called when mmap cache
  59. * subsystem detects a change of tracee memory mapping.
  60. */
  61. void (*tcb_flush_cache)(struct tcb *);
  62. };
  63. extern const struct unwind_unwinder_t unwinder;
  64. #endif /* !STRACE_UNWIND_H */