18dffb485Schristos /* Debugging routines for the remote server for GDB. 2*f1c2b495Schristos Copyright (C) 2014-2024 Free Software Foundation, Inc. 38dffb485Schristos 48dffb485Schristos This file is part of GDB. 58dffb485Schristos 68dffb485Schristos This program is free software; you can redistribute it and/or modify 78dffb485Schristos it under the terms of the GNU General Public License as published by 88dffb485Schristos the Free Software Foundation; either version 3 of the License, or 98dffb485Schristos (at your option) any later version. 108dffb485Schristos 118dffb485Schristos This program is distributed in the hope that it will be useful, 128dffb485Schristos but WITHOUT ANY WARRANTY; without even the implied warranty of 138dffb485Schristos MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 148dffb485Schristos GNU General Public License for more details. 158dffb485Schristos 168dffb485Schristos You should have received a copy of the GNU General Public License 178dffb485Schristos along with this program. If not, see <http://www.gnu.org/licenses/>. */ 188dffb485Schristos 198dffb485Schristos #ifndef GDBSERVER_DEBUG_H 208dffb485Schristos #define GDBSERVER_DEBUG_H 218dffb485Schristos 228dffb485Schristos #if !defined (IN_PROCESS_AGENT) 234b169a6bSchristos extern bool remote_debug; 244b169a6bSchristos 254b169a6bSchristos /* Print a "remote" debug statement. */ 264b169a6bSchristos 274b169a6bSchristos #define remote_debug_printf(fmt, ...) \ 284b169a6bSchristos debug_prefixed_printf_cond (remote_debug, \ 294b169a6bSchristos "remote", fmt, ##__VA_ARGS__) 308dffb485Schristos 318dffb485Schristos /* Switch all debug output to DEBUG_FILE. If DEBUG_FILE is nullptr or an 328dffb485Schristos empty string, or if the file cannot be opened, then debug output is sent to 338dffb485Schristos stderr. */ 348dffb485Schristos void debug_set_output (const char *debug_file); 358dffb485Schristos #endif 368dffb485Schristos 378dffb485Schristos extern int using_threads; 388dffb485Schristos 398dffb485Schristos /* Enable miscellaneous debugging output. The name is historical - it 408dffb485Schristos was originally used to debug LinuxThreads support. */ 418dffb485Schristos 424b169a6bSchristos extern bool debug_threads; 434b169a6bSchristos 444b169a6bSchristos /* Print a "threads" debug statement. */ 454b169a6bSchristos 464b169a6bSchristos #define threads_debug_printf(fmt, ...) \ 474b169a6bSchristos debug_prefixed_printf_cond (debug_threads, \ 484b169a6bSchristos "threads", fmt, ##__VA_ARGS__) 494b169a6bSchristos 504b169a6bSchristos /* Print "threads" enter/exit debug statements. */ 514b169a6bSchristos 524b169a6bSchristos #define THREADS_SCOPED_DEBUG_ENTER_EXIT \ 534b169a6bSchristos scoped_debug_enter_exit (debug_threads, "threads") 548dffb485Schristos 558dffb485Schristos extern int debug_timestamp; 568dffb485Schristos 578dffb485Schristos void debug_flush (void); 588dffb485Schristos 598dffb485Schristos /* Async signal safe debug output function that calls write directly. */ 608dffb485Schristos ssize_t debug_write (const void *buf, size_t nbyte); 618dffb485Schristos 628dffb485Schristos #endif /* GDBSERVER_DEBUG_H */ 63