debug.h 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. /* Debugging routines for the remote server for GDB.
  2. Copyright (C) 2014-2022 Free Software Foundation, Inc.
  3. This file is part of GDB.
  4. This program is free software; you can redistribute it and/or modify
  5. it under the terms of the GNU General Public License as published by
  6. the Free Software Foundation; either version 3 of the License, or
  7. (at your option) any later version.
  8. This program 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
  11. GNU General Public License for more details.
  12. You should have received a copy of the GNU General Public License
  13. along with this program. If not, see <http://www.gnu.org/licenses/>. */
  14. #ifndef GDBSERVER_DEBUG_H
  15. #define GDBSERVER_DEBUG_H
  16. #if !defined (IN_PROCESS_AGENT)
  17. extern bool remote_debug;
  18. /* Print a "remote" debug statement. */
  19. #define remote_debug_printf(fmt, ...) \
  20. debug_prefixed_printf_cond (remote_debug, \
  21. "remote", fmt, ##__VA_ARGS__)
  22. /* Switch all debug output to DEBUG_FILE. If DEBUG_FILE is nullptr or an
  23. empty string, or if the file cannot be opened, then debug output is sent to
  24. stderr. */
  25. void debug_set_output (const char *debug_file);
  26. #endif
  27. extern int using_threads;
  28. /* Enable miscellaneous debugging output. The name is historical - it
  29. was originally used to debug LinuxThreads support. */
  30. extern bool debug_threads;
  31. /* Print a "threads" debug statement. */
  32. #define threads_debug_printf(fmt, ...) \
  33. debug_prefixed_printf_cond (debug_threads, \
  34. "threads", fmt, ##__VA_ARGS__)
  35. /* Print "threads" enter/exit debug statements. */
  36. #define THREADS_SCOPED_DEBUG_ENTER_EXIT \
  37. scoped_debug_enter_exit (debug_threads, "threads")
  38. extern int debug_timestamp;
  39. void debug_flush (void);
  40. /* Async signal safe debug output function that calls write directly. */
  41. ssize_t debug_write (const void *buf, size_t nbyte);
  42. #endif /* GDBSERVER_DEBUG_H */