From: Tom Tromey Date: Tue, 25 Feb 2025 14:58:59 +0000 (-0700) Subject: Use gdb set and map in mi-main.c X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=d99b43c298f4235aba0889c74e1d23dd24beb9ac;p=thirdparty%2Fbinutils-gdb.git Use gdb set and map in mi-main.c This changes mi-main.c to use gdb::unordered_set and gdb::unordered_map. this may change the order of core ids that are emitted, but that seems fine as MI generally doesn't guarantee ordering. Approved-By: Simon Marchi --- diff --git a/gdb/mi/mi-main.c b/gdb/mi/mi-main.c index 1b5d9fb1021..1ae54d0d36c 100644 --- a/gdb/mi/mi-main.c +++ b/gdb/mi/mi-main.c @@ -57,8 +57,8 @@ #include #include "progspace-and-thread.h" #include "gdbsupport/rsp-low.h" -#include -#include +#include "gdbsupport/unordered_map.h" +#include "gdbsupport/unordered_set.h" enum { @@ -583,13 +583,13 @@ mi_cmd_thread_info (const char *command, const char *const *argv, int argc) static void print_one_inferior (struct inferior *inferior, bool recurse, - const std::set &ids) + const gdb::unordered_set &ids) { struct ui_out *uiout = current_uiout; if (ids.empty () || (ids.find (inferior->pid) != ids.end ())) { - std::set cores; + gdb::unordered_set cores; ui_out_emit_tuple tuple_emitter (uiout, NULL); uiout->field_fmt ("id", "i%d", inferior->num); @@ -648,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 &ids, int recurse) +list_available_thread_groups (const gdb::unordered_set &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> tree; + gdb::unordered_map> tree; /* get_osdata will throw if it cannot return data. */ std::unique_ptr data = get_osdata ("processes"); @@ -731,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 ids; + gdb::unordered_set ids; enum opt {