patch-tmate-debug_c 866 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. $OpenBSD: patch-tmate-debug_c,v 1.2 2017/02/17 12:37:33 jasper Exp $
  2. Actually disable all debug handling when not requested.
  3. Fixes undefined references to backtrace{,_symbols}().
  4. --- tmate-debug.c.orig Tue Mar 29 05:30:07 2016
  5. +++ tmate-debug.c Fri Feb 17 13:36:30 2017
  6. @@ -1,4 +1,6 @@
  7. +#if DEBUG
  8. #include <execinfo.h>
  9. +#endif
  10. #include <stdio.h>
  11. #include <stdlib.h>
  12. #include <regex.h>
  13. @@ -55,6 +57,7 @@ static int print_resolved_stack_frame(const char *fram
  14. void tmate_print_stack_trace(void)
  15. {
  16. +#if DEBUG
  17. void *array[20];
  18. size_t size;
  19. char **strings;
  20. @@ -66,13 +69,12 @@ void tmate_print_stack_trace(void)
  21. tmate_info ("============ %zd stack frames ============", size);
  22. for (i = 1; i < size; i++) {
  23. -#if DEBUG
  24. if (print_resolved_stack_frame(strings[i]) < 0)
  25. -#endif
  26. tmate_info("%s", strings[i]);
  27. }
  28. free (strings);
  29. +#endif
  30. }