gdb, testsuite: Fix return value in gdb.base/foll-fork.exp
[binutils-gdb.git] / gdb / maint.h
blobc1860d8cd59288a1de571d6190282c3f30ac848f
1 /* Support for GDB maintenance commands.
2 Copyright (C) 2013-2024 Free Software Foundation, Inc.
4 This file is part of GDB.
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.
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.
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/>. */
19 #ifndef MAINT_H
20 #define MAINT_H
22 #include "gdbsupport/run-time-clock.h"
23 #include <chrono>
25 extern void set_per_command_time (int);
27 extern void set_per_command_space (int);
29 /* Update the thread pool for the desired number of threads. */
31 extern void update_thread_pool_size ();
33 /* Records a run time and space usage to be used as a base for
34 reporting elapsed time or change in space. */
36 class scoped_command_stats
38 public:
40 explicit scoped_command_stats (bool msg_type);
41 ~scoped_command_stats ();
43 private:
45 DISABLE_COPY_AND_ASSIGN (scoped_command_stats);
47 /* Print the time, along with a string. */
48 void print_time (const char *msg);
50 /* Zero if the saved time is from the beginning of GDB execution.
51 One if from the beginning of an individual command execution. */
52 bool m_msg_type;
53 /* Track whether the stat was enabled at the start of the command
54 so that we can avoid printing anything if it gets turned on by
55 the current command. */
56 bool m_time_enabled : 1;
57 bool m_space_enabled : 1;
58 bool m_symtab_enabled : 1;
59 run_time_clock::time_point m_start_cpu_time;
60 std::chrono::steady_clock::time_point m_start_wall_time;
61 long m_start_space;
62 /* Total number of symtabs (over all objfiles). */
63 int m_start_nr_symtabs;
64 /* A count of the compunits. */
65 int m_start_nr_compunit_symtabs;
66 /* Total number of blocks. */
67 int m_start_nr_blocks;
70 extern obj_section *maint_obj_section_from_bfd_section (bfd *abfd,
71 asection *asection,
72 objfile *ofile);
73 #endif /* MAINT_H */