| 1 |
/* Debugging routines for the remote server for GDB. |
| 2 |
Copyright (C) 2014-2025 Free Software Foundation, Inc. |
| 3 |
|
| 4 |
This file is part of GDB. |
| 5 |
|
| 6 |
This program is free software; you can redistribute it and/or modify |
| 7 |
it under the terms of the GNU General Public License as published by |
| 8 |
the Free Software Foundation; either version 3 of the License, or |
| 9 |
(at your option) any later version. |
| 10 |
|
| 11 |
This program is distributed in the hope that it will be useful, |
| 12 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 |
GNU General Public License for more details. |
| 15 |
|
| 16 |
You should have received a copy of the GNU General Public License |
| 17 |
along with this program. If not, see <http://www.gnu.org/licenses/>. */ |
| 18 |
|
| 19 |
#ifndef GDBSERVER_DEBUG_H |
| 20 |
#define GDBSERVER_DEBUG_H |
| 21 |
|
| 22 |
#if !defined (IN_PROCESS_AGENT) |
| 23 |
extern bool remote_debug; |
| 24 |
|
| 25 |
/* If true, do not print the packet content sent with the next putpkt. |
| 26 |
This flag is reset to false after each putpkt logging. Useful to |
| 27 |
omit printing binary packet contents. */ |
| 28 |
extern bool suppressed_remote_debug; |
| 29 |
|
| 30 |
/* Print a "remote" debug statement. */ |
| 31 |
|
| 32 |
#define remote_debug_printf(fmt, ...) \ |
| 33 |
debug_prefixed_printf_cond (remote_debug, \ |
| 34 |
"remote", fmt, ##__VA_ARGS__) |
| 35 |
|
| 36 |
/* Switch all debug output to DEBUG_FILE. If DEBUG_FILE is nullptr or an |
| 37 |
empty string, or if the file cannot be opened, then debug output is sent to |
| 38 |
stderr. */ |
| 39 |
void debug_set_output (const char *debug_file); |
| 40 |
#endif |
| 41 |
|
| 42 |
extern int using_threads; |
| 43 |
|
| 44 |
/* Enable miscellaneous debugging output. The name is historical - it |
| 45 |
was originally used to debug LinuxThreads support. */ |
| 46 |
|
| 47 |
extern bool debug_threads; |
| 48 |
|
| 49 |
/* Print a "threads" debug statement. */ |
| 50 |
|
| 51 |
#define threads_debug_printf(fmt, ...) \ |
| 52 |
debug_prefixed_printf_cond (debug_threads, \ |
| 53 |
"threads", fmt, ##__VA_ARGS__) |
| 54 |
|
| 55 |
/* Print "threads" enter/exit debug statements. */ |
| 56 |
|
| 57 |
#define THREADS_SCOPED_DEBUG_ENTER_EXIT \ |
| 58 |
scoped_debug_enter_exit (debug_threads, "threads") |
| 59 |
|
| 60 |
extern int debug_timestamp; |
| 61 |
|
| 62 |
void debug_flush (void); |
| 63 |
|
| 64 |
/* Async signal safe debug output function that calls write directly. */ |
| 65 |
ssize_t debug_write (const void *buf, size_t nbyte); |
| 66 |
|
| 67 |
/* Suppress the next putpkt debug log by omitting the packet contents. |
| 68 |
Useful to reduce the logs when sending binary packets. */ |
| 69 |
|
| 70 |
void suppress_next_putpkt_log (); |
| 71 |
|
| 72 |
#endif /* GDBSERVER_DEBUG_H */ |