]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blob - gdbserver/debug.h
gdbsupport: constify some return values in print-utils.{h,cc}
[thirdparty/binutils-gdb.git] / gdbserver / debug.h
1 /* Debugging routines for the remote server for GDB.
2 Copyright (C) 2014-2024 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 /* Print a "remote" debug statement. */
26
27 #define remote_debug_printf(fmt, ...) \
28 debug_prefixed_printf_cond (remote_debug, \
29 "remote", fmt, ##__VA_ARGS__)
30
31 /* Switch all debug output to DEBUG_FILE. If DEBUG_FILE is nullptr or an
32 empty string, or if the file cannot be opened, then debug output is sent to
33 stderr. */
34 void debug_set_output (const char *debug_file);
35 #endif
36
37 extern int using_threads;
38
39 /* Enable miscellaneous debugging output. The name is historical - it
40 was originally used to debug LinuxThreads support. */
41
42 extern bool debug_threads;
43
44 /* Print a "threads" debug statement. */
45
46 #define threads_debug_printf(fmt, ...) \
47 debug_prefixed_printf_cond (debug_threads, \
48 "threads", fmt, ##__VA_ARGS__)
49
50 /* Print "threads" enter/exit debug statements. */
51
52 #define THREADS_SCOPED_DEBUG_ENTER_EXIT \
53 scoped_debug_enter_exit (debug_threads, "threads")
54
55 extern int debug_timestamp;
56
57 void debug_flush (void);
58
59 /* Async signal safe debug output function that calls write directly. */
60 ssize_t debug_write (const void *buf, size_t nbyte);
61
62 #endif /* GDBSERVER_DEBUG_H */