diff options
Diffstat (limited to 'gdb/mi')
-rw-r--r-- | gdb/mi/mi-cmd-break.c | 5 | ||||
-rw-r--r-- | gdb/mi/mi-cmd-break.h | 2 | ||||
-rw-r--r-- | gdb/mi/mi-cmd-catch.c | 2 | ||||
-rw-r--r-- | gdb/mi/mi-cmd-disas.c | 3 | ||||
-rw-r--r-- | gdb/mi/mi-cmd-env.c | 8 | ||||
-rw-r--r-- | gdb/mi/mi-cmd-file.c | 10 | ||||
-rw-r--r-- | gdb/mi/mi-cmd-info.c | 2 | ||||
-rw-r--r-- | gdb/mi/mi-cmd-stack.c | 6 | ||||
-rw-r--r-- | gdb/mi/mi-cmd-target.c | 2 | ||||
-rw-r--r-- | gdb/mi/mi-cmd-var.c | 3 | ||||
-rw-r--r-- | gdb/mi/mi-cmds.c | 11 | ||||
-rw-r--r-- | gdb/mi/mi-cmds.h | 2 | ||||
-rw-r--r-- | gdb/mi/mi-common.c | 2 | ||||
-rw-r--r-- | gdb/mi/mi-common.h | 2 | ||||
-rw-r--r-- | gdb/mi/mi-console.c | 2 | ||||
-rw-r--r-- | gdb/mi/mi-console.h | 2 | ||||
-rw-r--r-- | gdb/mi/mi-getopt.c | 2 | ||||
-rw-r--r-- | gdb/mi/mi-getopt.h | 2 | ||||
-rw-r--r-- | gdb/mi/mi-interp.c | 41 | ||||
-rw-r--r-- | gdb/mi/mi-interp.h | 6 | ||||
-rw-r--r-- | gdb/mi/mi-main.c | 130 | ||||
-rw-r--r-- | gdb/mi/mi-main.h | 2 | ||||
-rw-r--r-- | gdb/mi/mi-out.c | 3 | ||||
-rw-r--r-- | gdb/mi/mi-out.h | 3 | ||||
-rw-r--r-- | gdb/mi/mi-parse.c | 3 | ||||
-rw-r--r-- | gdb/mi/mi-parse.h | 2 | ||||
-rw-r--r-- | gdb/mi/mi-symbol-cmds.c | 2 |
27 files changed, 100 insertions, 160 deletions
diff --git a/gdb/mi/mi-cmd-break.c b/gdb/mi/mi-cmd-break.c index 5c78acd..e4cb2e7 100644 --- a/gdb/mi/mi-cmd-break.c +++ b/gdb/mi/mi-cmd-break.c @@ -1,5 +1,5 @@ /* MI Command Set - breakpoint and watchpoint commands. - Copyright (C) 2000-2024 Free Software Foundation, Inc. + Copyright (C) 2000-2025 Free Software Foundation, Inc. Contributed by Cygnus Solutions (a Red Hat company). This file is part of GDB. @@ -20,8 +20,6 @@ #include "arch-utils.h" #include "exceptions.h" #include "mi-cmds.h" -#include "ui-out.h" -#include "mi-out.h" #include "breakpoint.h" #include "mi-getopt.h" #include "observable.h" @@ -30,7 +28,6 @@ #include "language.h" #include "location.h" #include "linespec.h" -#include "gdbsupport/gdb_obstack.h" #include <ctype.h> #include "tracepoint.h" diff --git a/gdb/mi/mi-cmd-break.h b/gdb/mi/mi-cmd-break.h index 160c578..89f25d3 100644 --- a/gdb/mi/mi-cmd-break.h +++ b/gdb/mi/mi-cmd-break.h @@ -1,5 +1,5 @@ /* MI Command Set - breakpoint and watchpoint commands. - Copyright (C) 2012-2024 Free Software Foundation, Inc. + Copyright (C) 2012-2025 Free Software Foundation, Inc. Contributed by Intel Corporation. diff --git a/gdb/mi/mi-cmd-catch.c b/gdb/mi/mi-cmd-catch.c index 6cba316..8c0d230 100644 --- a/gdb/mi/mi-cmd-catch.c +++ b/gdb/mi/mi-cmd-catch.c @@ -1,5 +1,5 @@ /* MI Command Set - catch commands. - Copyright (C) 2012-2024 Free Software Foundation, Inc. + Copyright (C) 2012-2025 Free Software Foundation, Inc. Contributed by Intel Corporation. diff --git a/gdb/mi/mi-cmd-disas.c b/gdb/mi/mi-cmd-disas.c index a311e25..cb839e7 100644 --- a/gdb/mi/mi-cmd-disas.c +++ b/gdb/mi/mi-cmd-disas.c @@ -1,5 +1,5 @@ /* MI Command Set - disassemble commands. - Copyright (C) 2000-2024 Free Software Foundation, Inc. + Copyright (C) 2000-2025 Free Software Foundation, Inc. Contributed by Cygnus Solutions (a Red Hat company). This file is part of GDB. @@ -19,7 +19,6 @@ #include "arch-utils.h" #include "progspace.h" -#include "target.h" #include "value.h" #include "mi-cmds.h" #include "mi-getopt.h" diff --git a/gdb/mi/mi-cmd-env.c b/gdb/mi/mi-cmd-env.c index ae8c5e8..bc2fe77 100644 --- a/gdb/mi/mi-cmd-env.c +++ b/gdb/mi/mi-cmd-env.c @@ -1,5 +1,5 @@ /* MI Command Set - environment commands. - Copyright (C) 2002-2024 Free Software Foundation, Inc. + Copyright (C) 2002-2025 Free Software Foundation, Inc. Contributed by Red Hat Inc. @@ -19,11 +19,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */ #include "inferior.h" -#include "value.h" #include "mi-out.h" #include "mi-cmds.h" #include "mi-getopt.h" -#include "symtab.h" #include "target.h" #include "gdbsupport/environ.h" #include "command.h" @@ -238,9 +236,7 @@ mi_cmd_inferior_tty_show (const char *command, const char *const *argv, current_uiout->field_string ("inferior_tty_terminal", inferior_tty); } -void _initialize_mi_cmd_env (); -void -_initialize_mi_cmd_env () +INIT_GDB_FILE (mi_cmd_env) { const char *env; diff --git a/gdb/mi/mi-cmd-file.c b/gdb/mi/mi-cmd-file.c index f2fe435..cf7991f 100644 --- a/gdb/mi/mi-cmd-file.c +++ b/gdb/mi/mi-cmd-file.c @@ -1,5 +1,5 @@ /* MI Command Set - file commands. - Copyright (C) 2000-2024 Free Software Foundation, Inc. + Copyright (C) 2000-2025 Free Software Foundation, Inc. Contributed by Cygnus Solutions (a Red Hat company). This file is part of GDB. @@ -20,13 +20,11 @@ #include "mi-cmds.h" #include "mi-getopt.h" #include "mi-interp.h" +#include "progspace.h" #include "ui-out.h" #include "symtab.h" #include "source.h" -#include "objfiles.h" #include "solib.h" -#include "solist.h" -#include "gdbsupport/gdb_regex.h" /* Return to the client the absolute path and line number of the current file being executed. */ @@ -164,10 +162,10 @@ mi_cmd_file_list_shared_libraries (const char *command, for (const solib &so : current_program_space->solibs ()) { - if (so.so_name.empty ()) + if (so.name.empty ()) continue; - if (pattern != nullptr && !re_exec (so.so_name.c_str ())) + if (pattern != nullptr && !re_exec (so.name.c_str ())) continue; ui_out_emit_tuple tuple_emitter (uiout, NULL); diff --git a/gdb/mi/mi-cmd-info.c b/gdb/mi/mi-cmd-info.c index 628891b..4fc884e 100644 --- a/gdb/mi/mi-cmd-info.c +++ b/gdb/mi/mi-cmd-info.c @@ -1,5 +1,5 @@ /* MI Command Set - information commands. - Copyright (C) 2011-2024 Free Software Foundation, Inc. + Copyright (C) 2011-2025 Free Software Foundation, Inc. This file is part of GDB. diff --git a/gdb/mi/mi-cmd-stack.c b/gdb/mi/mi-cmd-stack.c index 5e50428..cc26747 100644 --- a/gdb/mi/mi-cmd-stack.c +++ b/gdb/mi/mi-cmd-stack.c @@ -1,5 +1,5 @@ /* MI Command Set - stack commands. - Copyright (C) 2000-2024 Free Software Foundation, Inc. + Copyright (C) 2000-2025 Free Software Foundation, Inc. Contributed by Cygnus Solutions (a Red Hat company). This file is part of GDB. @@ -18,18 +18,15 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */ #include "event-top.h" -#include "target.h" #include "frame.h" #include "value.h" #include "mi-cmds.h" #include "ui-out.h" #include "symtab.h" #include "block.h" -#include "stack.h" #include "dictionary.h" #include "language.h" #include "valprint.h" -#include "utils.h" #include "mi-getopt.h" #include "extension.h" #include <ctype.h> @@ -37,7 +34,6 @@ #include <optional> #include "gdbsupport/gdb-safe-ctype.h" #include "inferior.h" -#include "observable.h" enum what_to_list { locals, arguments, all }; diff --git a/gdb/mi/mi-cmd-target.c b/gdb/mi/mi-cmd-target.c index fbc6d6c..22bc43e 100644 --- a/gdb/mi/mi-cmd-target.c +++ b/gdb/mi/mi-cmd-target.c @@ -1,5 +1,5 @@ /* MI Command Set - target commands. - Copyright (C) 2007-2024 Free Software Foundation, Inc. + Copyright (C) 2007-2025 Free Software Foundation, Inc. This file is part of GDB. diff --git a/gdb/mi/mi-cmd-var.c b/gdb/mi/mi-cmd-var.c index f311204..9cbb857 100644 --- a/gdb/mi/mi-cmd-var.c +++ b/gdb/mi/mi-cmd-var.c @@ -1,5 +1,5 @@ /* MI Command Set - varobj commands. - Copyright (C) 2000-2024 Free Software Foundation, Inc. + Copyright (C) 2000-2025 Free Software Foundation, Inc. Contributed by Cygnus Solutions (a Red Hat company). @@ -29,7 +29,6 @@ #include "mi-getopt.h" #include "gdbthread.h" #include "mi-parse.h" -#include <optional> #include "inferior.h" static void varobj_update_one (struct varobj *var, diff --git a/gdb/mi/mi-cmds.c b/gdb/mi/mi-cmds.c index c7afb10..abd3fb9 100644 --- a/gdb/mi/mi-cmds.c +++ b/gdb/mi/mi-cmds.c @@ -1,5 +1,5 @@ /* MI Command Set for GDB, the GNU debugger. - Copyright (C) 2000-2024 Free Software Foundation, Inc. + Copyright (C) 2000-2025 Free Software Foundation, Inc. Contributed by Cygnus Solutions (a Red Hat company). @@ -18,16 +18,15 @@ You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ -#include "top.h" #include "mi-cmds.h" #include "mi-main.h" #include "mi-parse.h" -#include <map> +#include "gdbsupport/unordered_map.h" #include <string> /* MI command table (built at run time). */ -static std::map<std::string, mi_command_up> mi_cmd_table; +static gdb::unordered_map<std::string, mi_command_up> mi_cmd_table; /* MI command with a pure MI implementation. */ @@ -370,9 +369,7 @@ mi_cmd_lookup (const char *command) return it->second.get (); } -void _initialize_mi_cmds (); -void -_initialize_mi_cmds () +INIT_GDB_FILE (mi_cmds) { add_builtin_mi_commands (); } diff --git a/gdb/mi/mi-cmds.h b/gdb/mi/mi-cmds.h index 2059202..990ff75 100644 --- a/gdb/mi/mi-cmds.h +++ b/gdb/mi/mi-cmds.h @@ -1,6 +1,6 @@ /* MI Command Set for GDB, the GNU debugger. - Copyright (C) 2000-2024 Free Software Foundation, Inc. + Copyright (C) 2000-2025 Free Software Foundation, Inc. Contributed by Cygnus Solutions (a Red Hat company). diff --git a/gdb/mi/mi-common.c b/gdb/mi/mi-common.c index 699ead2..bc01371 100644 --- a/gdb/mi/mi-common.c +++ b/gdb/mi/mi-common.c @@ -1,5 +1,5 @@ /* Interface for common GDB/MI data - Copyright (C) 2005-2024 Free Software Foundation, Inc. + Copyright (C) 2005-2025 Free Software Foundation, Inc. This file is part of GDB. diff --git a/gdb/mi/mi-common.h b/gdb/mi/mi-common.h index 4c3951c..c37cbc1 100644 --- a/gdb/mi/mi-common.h +++ b/gdb/mi/mi-common.h @@ -1,5 +1,5 @@ /* Interface for common GDB/MI data - Copyright (C) 2005-2024 Free Software Foundation, Inc. + Copyright (C) 2005-2025 Free Software Foundation, Inc. This file is part of GDB. diff --git a/gdb/mi/mi-console.c b/gdb/mi/mi-console.c index 1f8d731..991ad7e 100644 --- a/gdb/mi/mi-console.c +++ b/gdb/mi/mi-console.c @@ -1,6 +1,6 @@ /* MI Console code. - Copyright (C) 2000-2024 Free Software Foundation, Inc. + Copyright (C) 2000-2025 Free Software Foundation, Inc. Contributed by Cygnus Solutions (a Red Hat company). diff --git a/gdb/mi/mi-console.h b/gdb/mi/mi-console.h index 89e0f4d..935529c 100644 --- a/gdb/mi/mi-console.h +++ b/gdb/mi/mi-console.h @@ -1,5 +1,5 @@ /* MI Command Set - MI Console. - Copyright (C) 2000-2024 Free Software Foundation, Inc. + Copyright (C) 2000-2025 Free Software Foundation, Inc. Contributed by Cygnus Solutions (a Red Hat company). This file is part of GDB. diff --git a/gdb/mi/mi-getopt.c b/gdb/mi/mi-getopt.c index 143c5b9..2c8615a 100644 --- a/gdb/mi/mi-getopt.c +++ b/gdb/mi/mi-getopt.c @@ -1,5 +1,5 @@ /* MI Command Set - MI Option Parser. - Copyright (C) 2000-2024 Free Software Foundation, Inc. + Copyright (C) 2000-2025 Free Software Foundation, Inc. Contributed by Cygnus Solutions (a Red Hat company). This file is part of GDB. diff --git a/gdb/mi/mi-getopt.h b/gdb/mi/mi-getopt.h index 5bc35aa..e3b0c3e 100644 --- a/gdb/mi/mi-getopt.h +++ b/gdb/mi/mi-getopt.h @@ -1,5 +1,5 @@ /* MI Option Parser. - Copyright (C) 2000-2024 Free Software Foundation, Inc. + Copyright (C) 2000-2025 Free Software Foundation, Inc. Contributed by Cygnus Solutions (a Red Hat company). This file is part of GDB. diff --git a/gdb/mi/mi-interp.c b/gdb/mi/mi-interp.c index ff4a0ff..8373e1a 100644 --- a/gdb/mi/mi-interp.c +++ b/gdb/mi/mi-interp.c @@ -1,6 +1,6 @@ /* MI Interpreter Definitions and Commands for GDB, the GNU debugger. - Copyright (C) 2002-2024 Free Software Foundation, Inc. + Copyright (C) 2002-2025 Free Software Foundation, Inc. This file is part of GDB. @@ -23,7 +23,6 @@ #include "exceptions.h" #include "interps.h" #include "event-top.h" -#include "gdbsupport/event-loop.h" #include "inferior.h" #include "infrun.h" #include "ui-out.h" @@ -35,7 +34,7 @@ #include "mi-common.h" #include "observable.h" #include "gdbthread.h" -#include "solist.h" +#include "solib.h" #include "objfiles.h" #include "tracepoint.h" #include "cli-out.h" @@ -721,15 +720,17 @@ mi_interp::on_target_resumed (ptid_t ptid) /* See mi-interp.h. */ -void -mi_output_solib_attribs (ui_out *uiout, const solib &solib) +static void +mi_output_solib_attribs_1 (ui_out *uiout, const solib &solib, + bool include_symbols_loaded_p) { gdbarch *gdbarch = current_inferior ()->arch (); - uiout->field_string ("id", solib.so_original_name); - uiout->field_string ("target-name", solib.so_original_name); - uiout->field_string ("host-name", solib.so_name); - uiout->field_signed ("symbols-loaded", solib.symbols_loaded); + uiout->field_string ("id", solib.original_name); + uiout->field_string ("target-name", solib.original_name); + uiout->field_string ("host-name", solib.name); + if (include_symbols_loaded_p) + uiout->field_signed ("symbols-loaded", solib.symbols_loaded); if (!gdbarch_has_global_solist (current_inferior ()->arch ())) uiout->field_fmt ("thread-group", "i%d", current_inferior ()->num); @@ -742,6 +743,14 @@ mi_output_solib_attribs (ui_out *uiout, const solib &solib) } } +/* See mi-interp.h. */ + +void +mi_output_solib_attribs (ui_out *uiout, const solib &solib) +{ + mi_output_solib_attribs_1 (uiout, solib, true); +} + void mi_interp::on_solib_loaded (const solib &solib) { @@ -760,7 +769,7 @@ mi_interp::on_solib_loaded (const solib &solib) } void -mi_interp::on_solib_unloaded (const solib &solib) +mi_interp::on_solib_unloaded (const solib &solib, bool still_in_use) { ui_out *uiout = this->interp_ui_out (); @@ -771,11 +780,9 @@ mi_interp::on_solib_unloaded (const solib &solib) ui_out_redirect_pop redir (uiout, this->event_channel); - uiout->field_string ("id", solib.so_original_name); - uiout->field_string ("target-name", solib.so_original_name); - uiout->field_string ("host-name", solib.so_name); - if (!gdbarch_has_global_solist (current_inferior ()->arch ())) - uiout->field_fmt ("thread-group", "i%d", current_inferior ()->num); + /* Pass false here so that 'symbols-loaded' is not included. */ + mi_output_solib_attribs_1 (uiout, solib, false); + uiout->field_string ("still-in-use", still_in_use ? "true" : "false"); gdb_flush (this->event_channel); } @@ -928,9 +935,7 @@ mi_interp_factory (const char *name) return new mi_interp (name); } -void _initialize_mi_interp (); -void -_initialize_mi_interp () +INIT_GDB_FILE (mi_interp) { /* The various interpreter levels. */ interp_factory_register (INTERP_MI2, mi_interp_factory); diff --git a/gdb/mi/mi-interp.h b/gdb/mi/mi-interp.h index 8f5eee6..c9211ba 100644 --- a/gdb/mi/mi-interp.h +++ b/gdb/mi/mi-interp.h @@ -1,6 +1,6 @@ /* MI Interpreter Definitions and Commands for GDB, the GNU debugger. - Copyright (C) 2017-2024 Free Software Foundation, Inc. + Copyright (C) 2017-2025 Free Software Foundation, Inc. This file is part of GDB. @@ -61,7 +61,7 @@ public: const char *format) override; void on_target_resumed (ptid_t ptid) override; void on_solib_loaded (const solib &so) override; - void on_solib_unloaded (const solib &so) override; + void on_solib_unloaded (const solib &so, bool still_in_use) override; void on_about_to_proceed () override; void on_traceframe_changed (int tfnum, int tpnum) override; void on_tsv_created (const trace_state_variable *tsv) override; @@ -103,7 +103,7 @@ public: command was issued. */ int mi_proceeded; - const char *current_token; + const char *current_token = nullptr; }; /* Output the shared object attributes to UIOUT. */ diff --git a/gdb/mi/mi-main.c b/gdb/mi/mi-main.c index 1d0fae9..789e6fa 100644 --- a/gdb/mi/mi-main.c +++ b/gdb/mi/mi-main.c @@ -1,6 +1,6 @@ /* MI Command Set. - Copyright (C) 2000-2024 Free Software Foundation, Inc. + Copyright (C) 2000-2025 Free Software Foundation, Inc. Contributed by Cygnus Solutions (a Red Hat company). @@ -30,11 +30,9 @@ #include "mi-cmds.h" #include "mi-parse.h" #include "mi-getopt.h" -#include "mi-console.h" #include "ui-out.h" #include "mi-out.h" #include "interps.h" -#include "gdbsupport/event-loop.h" #include "event-top.h" #include "gdbcore.h" #include "value.h" @@ -45,7 +43,6 @@ #include "language.h" #include "valprint.h" #include "osdata.h" -#include "gdbsupport/gdb_splay_tree.h" #include "tracepoint.h" #include "ada-lang.h" #include "linespec.h" @@ -60,9 +57,8 @@ #include <chrono> #include "progspace-and-thread.h" #include "gdbsupport/rsp-low.h" -#include <algorithm> -#include <set> -#include <map> +#include "gdbsupport/unordered_map.h" +#include "gdbsupport/unordered_set.h" enum { @@ -254,15 +250,6 @@ proceed_thread (struct thread_info *thread, int pid) proceed ((CORE_ADDR) -1, GDB_SIGNAL_DEFAULT); } -static int -proceed_thread_callback (struct thread_info *thread, void *arg) -{ - int pid = *(int *)arg; - - proceed_thread (thread, pid); - return 0; -} - static void exec_continue (const char *const *argv, int argc) { @@ -292,7 +279,11 @@ exec_continue (const char *const *argv, int argc) pid = inf->pid; } - iterate_over_threads (proceed_thread_callback, &pid); + iterate_over_threads ([&] (struct thread_info *thread) + { + proceed_thread (thread, pid); + return false; + }); disable_commit_resumed.reset_and_commit (); } else @@ -345,21 +336,6 @@ mi_cmd_exec_continue (const char *command, const char *const *argv, int argc) exec_continue (argv, argc); } -static int -interrupt_thread_callback (struct thread_info *thread, void *arg) -{ - int pid = *(int *)arg; - - if (thread->state != THREAD_RUNNING) - return 0; - - if (thread->ptid.pid () != pid) - return 0; - - target_stop (thread->ptid); - return 0; -} - /* Interrupt the execution of the target. Note how we must play around with the token variables, in order to display the current token in the result of the interrupt command, and the previous @@ -389,7 +365,17 @@ mi_cmd_exec_interrupt (const char *command, const char *const *argv, int argc) scoped_disable_commit_resumed disable_commit_resumed ("interrupting all threads of thread group"); - iterate_over_threads (interrupt_thread_callback, &inf->pid); + iterate_over_threads ([&] (struct thread_info *thread) + { + if (thread->state != THREAD_RUNNING) + return false; + + if (thread->ptid.pid () != inf->pid) + return false; + + target_stop (thread->ptid); + return false; + }); } else { @@ -482,18 +468,6 @@ mi_cmd_exec_run (const char *command, const char *const *argv, int argc) } } - -static int -find_thread_of_process (struct thread_info *ti, void *p) -{ - int pid = *(int *)p; - - if (ti->ptid.pid () == pid && ti->state != THREAD_EXITED) - return 1; - - return 0; -} - void mi_cmd_target_detach (const char *command, const char *const *argv, int argc) { @@ -532,7 +506,10 @@ mi_cmd_target_detach (const char *command, const char *const *argv, int argc) /* Pick any thread in the desired process. Current target_detach detaches from the parent of inferior_ptid. */ - tp = iterate_over_threads (find_thread_of_process, &pid); + tp = iterate_over_threads ([&] (struct thread_info *ti) + { + return ti->ptid.pid () == pid && ti->state != THREAD_EXITED; + }); if (!tp) error (_("Thread group is empty")); @@ -604,43 +581,15 @@ mi_cmd_thread_info (const char *command, const char *const *argv, int argc) print_thread_info (current_uiout, argv[0], -1); } -struct collect_cores_data -{ - int pid; - std::set<int> cores; -}; - -static int -collect_cores (struct thread_info *ti, void *xdata) -{ - struct collect_cores_data *data = (struct collect_cores_data *) xdata; - - if (ti->ptid.pid () == data->pid) - { - int core = target_core_of_thread (ti->ptid); - - if (core != -1) - data->cores.insert (core); - } - - return 0; -} - -struct print_one_inferior_data -{ - int recurse; - const std::set<int> *inferiors; -}; - static void print_one_inferior (struct inferior *inferior, bool recurse, - const std::set<int> &ids) + const gdb::unordered_set<int> &ids) { struct ui_out *uiout = current_uiout; if (ids.empty () || (ids.find (inferior->pid) != ids.end ())) { - struct collect_cores_data data; + gdb::unordered_set<int> cores; ui_out_emit_tuple tuple_emitter (uiout, NULL); uiout->field_fmt ("id", "i%d", inferior->num); @@ -656,15 +605,24 @@ print_one_inferior (struct inferior *inferior, bool recurse, if (inferior->pid != 0) { - data.pid = inferior->pid; - iterate_over_threads (collect_cores, &data); + iterate_over_threads ([&] (struct thread_info *ti) + { + if (ti->ptid.pid () == inferior->pid) + { + int core = target_core_of_thread (ti->ptid); + + if (core != -1) + cores.insert (core); + } + return false; + }); } - if (!data.cores.empty ()) + if (!cores.empty ()) { ui_out_emit_list list_emitter (uiout, "cores"); - for (int b : data.cores) + for (int b : cores) uiout->field_signed (NULL, b); } @@ -690,13 +648,13 @@ output_cores (struct ui_out *uiout, const char *field_name, const char *xcores) } static void -list_available_thread_groups (const std::set<int> &ids, int recurse) +list_available_thread_groups (const gdb::unordered_set<int> &ids, int recurse) { struct ui_out *uiout = current_uiout; /* This keeps a map from integer (pid) to vector of struct osdata_item. The vector contains information about all threads for the given pid. */ - std::map<int, std::vector<osdata_item>> tree; + gdb::unordered_map<int, std::vector<osdata_item>> tree; /* get_osdata will throw if it cannot return data. */ std::unique_ptr<osdata> data = get_osdata ("processes"); @@ -773,7 +731,7 @@ mi_cmd_list_thread_groups (const char *command, const char *const *argv, struct ui_out *uiout = current_uiout; int available = 0; int recurse = 0; - std::set<int> ids; + gdb::unordered_set<int> ids; enum opt { @@ -2260,7 +2218,7 @@ timestamp (struct mi_timestamp *tv) using namespace std::chrono; tv->wallclock = steady_clock::now (); - run_time_clock::now (tv->utime, tv->stime); + get_run_time (tv->utime, tv->stime, run_time_scope::process); } static void @@ -2810,9 +2768,7 @@ mi_parse_thread_group_id (const char *id) return (int) num; } -void _initialize_mi_main (); -void -_initialize_mi_main () +INIT_GDB_FILE (mi_main) { set_show_commands mi_async_cmds = add_setshow_boolean_cmd ("mi-async", class_run, diff --git a/gdb/mi/mi-main.h b/gdb/mi/mi-main.h index af67029..a857d33 100644 --- a/gdb/mi/mi-main.h +++ b/gdb/mi/mi-main.h @@ -1,6 +1,6 @@ /* MI Internal Functions for GDB, the GNU debugger. - Copyright (C) 2003-2024 Free Software Foundation, Inc. + Copyright (C) 2003-2025 Free Software Foundation, Inc. This file is part of GDB. diff --git a/gdb/mi/mi-out.c b/gdb/mi/mi-out.c index 9ad26e7..6adf108 100644 --- a/gdb/mi/mi-out.c +++ b/gdb/mi/mi-out.c @@ -1,6 +1,6 @@ /* MI Command Set - output generating routines. - Copyright (C) 2000-2024 Free Software Foundation, Inc. + Copyright (C) 2000-2025 Free Software Foundation, Inc. Contributed by Cygnus Solutions (a Red Hat company). @@ -323,7 +323,6 @@ mi_ui_out::version () mi_ui_out::mi_ui_out (int mi_version) : ui_out (make_flags (mi_version)), m_suppress_field_separator (false), - m_suppress_output (false), m_mi_version (mi_version) { string_file *stream = new string_file (); diff --git a/gdb/mi/mi-out.h b/gdb/mi/mi-out.h index 0112d5a..ec3de74 100644 --- a/gdb/mi/mi-out.h +++ b/gdb/mi/mi-out.h @@ -1,5 +1,5 @@ /* MI Command Set - MI output generating routines for GDB. - Copyright (C) 2000-2024 Free Software Foundation, Inc. + Copyright (C) 2000-2025 Free Software Foundation, Inc. Contributed by Cygnus Solutions (a Red Hat company). This file is part of GDB. @@ -139,7 +139,6 @@ private: } bool m_suppress_field_separator; - bool m_suppress_output; int m_mi_version; std::vector<ui_file *> m_streams; }; diff --git a/gdb/mi/mi-parse.c b/gdb/mi/mi-parse.c index 8804c98..0af90cb 100644 --- a/gdb/mi/mi-parse.c +++ b/gdb/mi/mi-parse.c @@ -1,6 +1,6 @@ /* MI Command Set - MI parser. - Copyright (C) 2000-2024 Free Software Foundation, Inc. + Copyright (C) 2000-2025 Free Software Foundation, Inc. Contributed by Cygnus Solutions (a Red Hat company). @@ -21,7 +21,6 @@ #include "mi-cmds.h" #include "mi-parse.h" -#include "charset.h" #include <ctype.h> #include "cli/cli-utils.h" diff --git a/gdb/mi/mi-parse.h b/gdb/mi/mi-parse.h index 22d1018..73d39b8 100644 --- a/gdb/mi/mi-parse.h +++ b/gdb/mi/mi-parse.h @@ -1,5 +1,5 @@ /* MI Command Set - MI Command Parser. - Copyright (C) 2000-2024 Free Software Foundation, Inc. + Copyright (C) 2000-2025 Free Software Foundation, Inc. Contributed by Cygnus Solutions (a Red Hat company). This file is part of GDB. diff --git a/gdb/mi/mi-symbol-cmds.c b/gdb/mi/mi-symbol-cmds.c index e4d890f..4f5562d 100644 --- a/gdb/mi/mi-symbol-cmds.c +++ b/gdb/mi/mi-symbol-cmds.c @@ -1,5 +1,5 @@ /* MI Command Set - symbol commands. - Copyright (C) 2003-2024 Free Software Foundation, Inc. + Copyright (C) 2003-2025 Free Software Foundation, Inc. This file is part of GDB. |