X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=gdb%2Fmaint.c;h=b4890c34cab9bc1694bf7a14e0d27547026116d8;hb=refs%2Fheads%2Fconcurrent-displaced-stepping-2020-04-01;hp=ce59ef6cca4926168a2f16ae18bb26bf1766e358;hpb=c9d95fa3d034ae614e33b631e0bc019015c444e9;p=deliverable%2Fbinutils-gdb.git diff --git a/gdb/maint.c b/gdb/maint.c index ce59ef6cca..b4890c34ca 100644 --- a/gdb/maint.c +++ b/gdb/maint.c @@ -1,6 +1,6 @@ /* Support for GDB maintenance commands. - Copyright (C) 1992-2019 Free Software Foundation, Inc. + Copyright (C) 1992-2020 Free Software Foundation, Inc. Written by Fred Fish at Cygnus Support. @@ -46,17 +46,11 @@ #include "cli/cli-setshow.h" #include "cli/cli-cmds.h" -static void maintenance_do_deprecate (const char *, int); - -/* Access the maintenance subcommands. */ +#if CXX_STD_THREAD +#include "gdbsupport/thread-pool.h" +#endif -static void -maintenance_command (const char *args, int from_tty) -{ - printf_unfiltered (_("\"maintenance\" must be followed by " - "the name of a maintenance command.\n")); - help_list (maintenancelist, "maintenance ", all_commands, gdb_stdout); -} +static void maintenance_do_deprecate (const char *, int); #ifndef _WIN32 static void @@ -135,32 +129,6 @@ maintenance_space_display (const char *args, int from_tty) set_per_command_space (strtol (args, NULL, 10)); } -/* The "maintenance info" command is defined as a prefix, with - allow_unknown 0. Therefore, its own definition is called only for - "maintenance info" with no args. */ - -static void -maintenance_info_command (const char *arg, int from_tty) -{ - printf_unfiltered (_("\"maintenance info\" must be followed " - "by the name of an info command.\n")); - help_list (maintenanceinfolist, "maintenance info ", all_commands, - gdb_stdout); -} - -/* The "maintenance check" command is defined as a prefix, with - allow_unknown 0. Therefore, its own definition is called only for - "maintenance check" with no args. */ - -static void -maintenance_check_command (const char *arg, int from_tty) -{ - printf_unfiltered (_("\"maintenance check\" must be followed " - "by the name of a check command.\n")); - help_list (maintenancechecklist, "maintenance check ", all_commands, - gdb_stdout); -} - /* Mini tokenizing lexer for 'maint info sections' command. */ static int @@ -507,19 +475,6 @@ maintenance_print_architecture (const char *args, int from_tty) } } -/* The "maintenance print" command is defined as a prefix, with - allow_unknown 0. Therefore, its own definition is called only for - "maintenance print" with no args. */ - -static void -maintenance_print_command (const char *arg, int from_tty) -{ - printf_unfiltered (_("\"maintenance print\" must be followed " - "by the name of a print command.\n")); - help_list (maintenanceprintlist, "maintenance print ", all_commands, - gdb_stdout); -} - /* The "maintenance translate-address" command converts a section and address to a symbol. This can be called in two ways: maintenance translate-address @@ -585,7 +540,7 @@ maintenance_translate_address (const char *arg, int from_tty) gdb_assert (sect->objfile && objfile_name (sect->objfile)); obj_name = objfile_name (sect->objfile); - if (MULTI_OBJFILE_P ()) + if (current_program_space->multi_objfile_p ()) printf_filtered (_("%s + %s in section %s of %s\n"), symbol_name, symbol_offset, section_name, obj_name); @@ -735,21 +690,6 @@ maintenance_do_deprecate (const char *text, int deprecate) struct cmd_list_element *maintenance_set_cmdlist; struct cmd_list_element *maintenance_show_cmdlist; -static void -maintenance_set_cmd (const char *args, int from_tty) -{ - printf_unfiltered (_("\"maintenance set\" must be followed " - "by the name of a set command.\n")); - help_list (maintenance_set_cmdlist, "maintenance set ", all_commands, - gdb_stdout); -} - -static void -maintenance_show_cmd (const char *args, int from_tty) -{ - cmd_show_list (maintenance_show_cmdlist, from_tty, ""); -} - /* "maintenance with" command. */ static void @@ -840,6 +780,30 @@ maintenance_set_profile_cmd (const char *args, int from_tty, error (_("Profiling support is not available on this system.")); } #endif + +static int n_worker_threads = -1; + +/* Update the thread pool for the desired number of threads. */ +static void +update_thread_pool_size () +{ +#if CXX_STD_THREAD + int n_threads = n_worker_threads; + + if (n_threads < 0) + n_threads = std::thread::hardware_concurrency (); + + gdb::thread_pool::g_thread_pool->set_thread_count (n_threads); +#endif +} + +static void +maintenance_set_worker_threads (const char *args, int from_tty, + struct cmd_list_element *c) +{ + update_thread_pool_size (); +} + /* If true, display time usage both at startup and for each command. */ @@ -1069,14 +1033,6 @@ set_per_command_cmd (const char *args, int from_tty) } } -/* Command "show per-command" displays summary of all the current - "show per-command " settings. */ - -static void -show_per_command_cmd (const char *args, int from_tty) -{ - cmd_show_list (per_command_showlist, from_tty, ""); -} /* The "maintenance selftest" command. */ @@ -1107,24 +1063,25 @@ Selftests have been disabled for this build.\n")); } +void _initialize_maint_cmds (); void -_initialize_maint_cmds (void) +_initialize_maint_cmds () { struct cmd_list_element *cmd; - add_prefix_cmd ("maintenance", class_maintenance, maintenance_command, _("\ + add_basic_prefix_cmd ("maintenance", class_maintenance, _("\ Commands for use by GDB maintainers.\n\ Includes commands to dump specific internal GDB structures in\n\ a human readable form, to cause GDB to deliberately dump core, etc."), - &maintenancelist, "maintenance ", 0, - &cmdlist); + &maintenancelist, "maintenance ", 0, + &cmdlist); add_com_alias ("mt", "maintenance", class_maintenance, 1); - add_prefix_cmd ("info", class_maintenance, maintenance_info_command, _("\ + add_basic_prefix_cmd ("info", class_maintenance, _("\ Commands for showing internal info about the program being debugged."), - &maintenanceinfolist, "maintenance info ", 0, - &maintenancelist); + &maintenanceinfolist, "maintenance info ", 0, + &maintenancelist); add_alias_cmd ("i", "info", class_maintenance, 1, &maintenancelist); add_cmd ("sections", class_maintenance, maintenance_info_sections, _("\ @@ -1139,24 +1096,24 @@ implies all sections). In addition, the special argument\n\ lists all sections from all object files, including shared libraries."), &maintenanceinfolist); - add_prefix_cmd ("print", class_maintenance, maintenance_print_command, - _("Maintenance command for printing GDB internal state."), - &maintenanceprintlist, "maintenance print ", 0, - &maintenancelist); + add_basic_prefix_cmd ("print", class_maintenance, + _("Maintenance command for printing GDB internal state."), + &maintenanceprintlist, "maintenance print ", 0, + &maintenancelist); - add_prefix_cmd ("set", class_maintenance, maintenance_set_cmd, _("\ + add_basic_prefix_cmd ("set", class_maintenance, _("\ Set GDB internal variables used by the GDB maintainer.\n\ Configure variables internal to GDB that aid in GDB's maintenance"), - &maintenance_set_cmdlist, "maintenance set ", - 0/*allow-unknown*/, - &maintenancelist); + &maintenance_set_cmdlist, "maintenance set ", + 0/*allow-unknown*/, + &maintenancelist); - add_prefix_cmd ("show", class_maintenance, maintenance_show_cmd, _("\ + add_show_prefix_cmd ("show", class_maintenance, _("\ Show GDB internal variables used by the GDB maintainer.\n\ Configure variables internal to GDB that aid in GDB's maintenance"), - &maintenance_show_cmdlist, "maintenance show ", - 0/*allow-unknown*/, - &maintenancelist); + &maintenance_show_cmdlist, "maintenance show ", + 0/*allow-unknown*/, + &maintenancelist); cmd = add_cmd ("with", class_maintenance, maintenance_with_cmd, _("\ Like \"with\", but works with \"maintenance set\" variables.\n\ @@ -1203,10 +1160,10 @@ Per-command statistics settings."), &per_command_setlist, "maintenance set per-command ", 1/*allow-unknown*/, &maintenance_set_cmdlist); - add_prefix_cmd ("per-command", class_maintenance, show_per_command_cmd, _("\ + add_show_prefix_cmd ("per-command", class_maintenance, _("\ Show per-command statistics settings."), - &per_command_showlist, "maintenance show per-command ", - 0/*allow-unknown*/, &maintenance_show_cmdlist); + &per_command_showlist, "maintenance show per-command ", + 0/*allow-unknown*/, &maintenance_show_cmdlist); add_setshow_boolean_cmd ("time", class_maintenance, &per_command_time, _("\ @@ -1270,10 +1227,10 @@ Print the internal architecture configuration.\n\ Takes an optional file parameter."), &maintenanceprintlist); - add_prefix_cmd ("check", class_maintenance, maintenance_check_command, _("\ + add_basic_prefix_cmd ("check", class_maintenance, _("\ Commands for checking internal gdb state."), - &maintenancechecklist, "maintenance check ", 0, - &maintenancelist); + &maintenancechecklist, "maintenance check ", 0, + &maintenancelist); add_cmd ("translate-address", class_maintenance, maintenance_translate_address, @@ -1313,4 +1270,17 @@ When enabled GDB is profiled."), show_maintenance_profile_p, &maintenance_set_cmdlist, &maintenance_show_cmdlist); + + add_setshow_zuinteger_unlimited_cmd ("worker-threads", + class_maintenance, + &n_worker_threads, _("\ +Set the number of worker threads GDB can use."), _("\ +Show the number of worker threads GDB can use."), _("\ +GDB may use multiple threads to speed up certain CPU-intensive operations,\n\ +such as demangling symbol names."), + maintenance_set_worker_threads, NULL, + &maintenance_set_cmdlist, + &maintenance_show_cmdlist); + + update_thread_pool_size (); }