Change regcache list to be an hash map
[deliverable/binutils-gdb.git] / gdb / mi / mi-main.c
index 2ece360205666dd676b375054722486136d43b31..19c4c54b9def54eae1c5c3572779c3624ee00820 100644 (file)
@@ -1,6 +1,6 @@
 /* MI Command Set.
 
-   Copyright (C) 2000-2019 Free Software Foundation, Inc.
+   Copyright (C) 2000-2020 Free Software Foundation, Inc.
 
    Contributed by Cygnus Solutions (a Red Hat company).
 
@@ -46,7 +46,6 @@
 #include "osdata.h"
 #include "gdbsupport/gdb_splay_tree.h"
 #include "tracepoint.h"
-#include "ctf.h"
 #include "ada-lang.h"
 #include "linespec.h"
 #include "extension.h"
@@ -253,15 +252,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 (char **argv, int argc)
 {
@@ -287,7 +277,24 @@ exec_continue (char **argv, int argc)
 
              pid = inf->pid;
            }
-         iterate_over_threads (proceed_thread_callback, &pid);
+
+         /* Proceed the threads in global number order.  This is not necessary,
+            it's just to avoid breaking some tests like gdb.mi/mi-nsintrall.exp
+            that expect the *running notifications in that order.  In the end,
+            we should instead fix the test to accept the notifications in any
+            order.  */
+         std::vector<thread_info *> threads;
+         for (thread_info *tp : all_threads ())
+           threads.push_back (tp);
+
+         std::sort (threads.begin (), threads.end (),
+                    [] (thread_info *a, thread_info *b)
+                    {
+                      return a->global_num < b->global_num;
+                    });
+
+         for (thread_info *tp : threads)
+           proceed_thread (tp, pid);
        }
       else
        {
@@ -415,11 +422,7 @@ run_one_inferior (struct inferior *inf, void *arg)
       switch_to_thread (tp);
     }
   else
-    {
-      set_current_inferior (inf);
-      switch_to_no_thread ();
-      set_current_program_space (inf->pspace);
-    }
+    switch_to_inferior_no_thread (inf);
   mi_execute_cli_command (run_cmd, async_p,
                          async_p ? "&" : NULL);
   return 0;
@@ -697,8 +700,9 @@ output_cores (struct ui_out *uiout, const char *field_name, const char *xcores)
   ui_out_emit_list list_emitter (uiout, field_name);
   auto cores = make_unique_xstrdup (xcores);
   char *p = cores.get ();
+  char *saveptr;
 
-  for (p = strtok (p, ","); p;  p = strtok (NULL, ","))
+  for (p = strtok_r (p, ",", &saveptr); p;  p = strtok_r (NULL, ",", &saveptr))
     uiout->field_string (NULL, p);
 }
 
@@ -1235,12 +1239,12 @@ mi_cmd_data_evaluate_expression (const char *command, char **argv, int argc)
    the ``x'' command.
    WORD-SIZE: size of each ``word''; 1,2,4, or 8 bytes.
    NR_ROW: Number of rows.
-   NR_COL: The number of colums (words per row).
+   NR_COL: The number of columns (words per row).
    ASCHAR: (OPTIONAL) Append an ascii character dump to each row.  Use
    ASCHAR for unprintable characters.
 
    Reads SIZE*NR_ROW*NR_COL bytes starting at ADDR from memory and
-   displayes them.  Returns:
+   displays them.  Returns:
 
    {addr="...",rowN={wordN="..." ,... [,ascii="..."]}, ...}
 
@@ -1360,7 +1364,7 @@ mi_cmd_data_read_memory (const char *command, char **argv, int argc)
   uiout->field_core_addr ("next-page", gdbarch, addr + total_bytes);
   uiout->field_core_addr ("prev-page", gdbarch, addr - total_bytes);
 
-  /* Build the result as a two dimentional table.  */
+  /* Build the result as a two dimensional table.  */
   {
     int row;
     int row_byte;
This page took 0.025836 seconds and 4 git commands to generate.