gdb: rename things related to step over chains
authorSimon Marchi <simon.marchi@efficios.com>
Tue, 14 Jan 2020 22:42:16 +0000 (17:42 -0500)
committerSimon Marchi <simon.marchi@efficios.com>
Thu, 4 Jun 2020 19:04:21 +0000 (15:04 -0400)
Rename step_over_queue_head to global_thread_step_over_chain_head, to
make it more obvious when reading code that we are touching the global
queue.  Rename all functions that operate on it to have "global" in
their name, to make it clear on which chain they operate on.

I also reworded a few comments in gdbthread.h.  They implied that the
step over chain is per-inferior, when in reality there is only one
global chain, as far as I understand.

gdb/gdbthread.h
gdb/infrun.c
gdb/infrun.h
gdb/thread.c

index 717a2ad08c2fce127731081e455b605cd7c56316..4f956f19b21cd26b2610476abc0e6bdab0db1b77 100644 (file)
@@ -748,20 +748,20 @@ extern value *get_last_thread_stack_temporary (struct thread_info *tp);
 extern bool value_in_thread_stack_temporaries (struct value *,
                                               struct thread_info *thr);
 
-/* Add TP to the end of its inferior's pending step-over chain.  */
+/* Add TP to the end of the global pending step-over chain.  */
 
-extern void thread_step_over_chain_enqueue (struct thread_info *tp);
+extern void global_thread_step_over_chain_enqueue (struct thread_info *tp);
 
-/* Remove TP from its inferior's pending step-over chain.  */
+/* Remove TP from the global pending step-over chain.  */
 
-extern void thread_step_over_chain_remove (struct thread_info *tp);
+extern void global_thread_step_over_chain_remove (struct thread_info *tp);
 
-/* Return the next thread in the step-over chain starting at TP.  NULL
+/* Return the next thread in the global step-over chain.  NULL
    if TP is the last entry in the chain.  */
 
-extern struct thread_info *thread_step_over_chain_next (struct thread_info *tp);
+extern struct thread_info *global_thread_step_over_chain_next (struct thread_info *tp);
 
-/* Return true if TP is in the step-over chain.  */
+/* Return true if TP is in any step-over chain.  */
 
 extern int thread_is_in_step_over_chain (struct thread_info *tp);
 
index 0c2e1de827ca232c890858561a0904e96bd5da97..ed36a96cfbaf3524b6a704003294792eb2674294 100644 (file)
@@ -1280,7 +1280,7 @@ follow_exec (ptid_t ptid, const char *exec_file_target)
    to avoid starvation, otherwise, we could e.g., find ourselves
    constantly stepping the same couple threads past their breakpoints
    over and over, if the single-step finish fast enough.  */
-struct thread_info *step_over_queue_head;
+struct thread_info *global_thread_step_over_chain_head;
 
 /* Bit flags indicating what the thread needs to step over.  */
 
@@ -1720,7 +1720,7 @@ displaced_step_prepare_throw (thread_info *tp)
                            "displaced: deferring step of %s\n",
                            target_pid_to_str (tp->ptid).c_str ());
 
-      thread_step_over_chain_enqueue (tp);
+      global_thread_step_over_chain_enqueue (tp);
       return 0;
     }
   else
@@ -1988,7 +1988,7 @@ start_step_over (void)
   if (step_over_info_valid_p ())
     return 0;
 
-  for (tp = step_over_queue_head; tp != NULL; tp = next)
+  for (tp = global_thread_step_over_chain_head; tp != NULL; tp = next)
     {
       struct execution_control_state ecss;
       struct execution_control_state *ecs = &ecss;
@@ -1997,7 +1997,7 @@ start_step_over (void)
 
       gdb_assert (!tp->stop_requested);
 
-      next = thread_step_over_chain_next (tp);
+      next = global_thread_step_over_chain_next (tp);
 
       /* If this inferior already has a displaced step in process,
         don't start a new one.  */
@@ -2015,9 +2015,9 @@ start_step_over (void)
       if (must_be_in_line && displaced_step_in_progress_any_inferior ())
        return 0;
 
-      thread_step_over_chain_remove (tp);
+      global_thread_step_over_chain_remove (tp);
 
-      if (step_over_queue_head == NULL)
+      if (global_thread_step_over_chain_head == NULL)
        infrun_log_debug ("step-over queue now empty");
 
       if (tp->control.trap_expected
@@ -3075,7 +3075,7 @@ proceed (CORE_ADDR addr, enum gdb_signal siggnal)
          infrun_log_debug ("need to step-over [%s] first",
                            target_pid_to_str (tp->ptid).c_str ());
 
-         thread_step_over_chain_enqueue (tp);
+         global_thread_step_over_chain_enqueue (tp);
        }
 
       switch_to_thread (cur_thr);
@@ -3084,7 +3084,7 @@ proceed (CORE_ADDR addr, enum gdb_signal siggnal)
   /* Enqueue the current thread last, so that we move all other
      threads over their breakpoints first.  */
   if (cur_thr->stepping_over_breakpoint)
-    thread_step_over_chain_enqueue (cur_thr);
+    global_thread_step_over_chain_enqueue (cur_thr);
 
   /* If the thread isn't started, we'll still need to set its prev_pc,
      so that switch_back_to_stepped_thread knows the thread hasn't
@@ -3268,7 +3268,7 @@ infrun_thread_stop_requested (ptid_t ptid)
         start_step_over doesn't try to resume them
         automatically.  */
       if (thread_is_in_step_over_chain (tp))
-       thread_step_over_chain_remove (tp);
+       global_thread_step_over_chain_remove (tp);
 
       /* If the thread is stopped, but the user/frontend doesn't
         know about that yet, queue a pending event, as if the
@@ -4892,7 +4892,7 @@ stop_all_threads (void)
                                            target_pid_to_str (t->ptid).c_str ());
 
                          t->control.trap_expected = 0;
-                         thread_step_over_chain_enqueue (t);
+                         global_thread_step_over_chain_enqueue (t);
                        }
                    }
                  else
@@ -4922,7 +4922,7 @@ stop_all_threads (void)
                        {
                          /* Add it back to the step-over queue.  */
                          t->control.trap_expected = 0;
-                         thread_step_over_chain_enqueue (t);
+                         global_thread_step_over_chain_enqueue (t);
                        }
 
                      regcache = get_thread_regcache (t);
@@ -7786,7 +7786,7 @@ keep_going_pass_signal (struct execution_control_state *ecs)
          infrun_log_debug ("step-over already in progress: "
                            "step-over for %s deferred",
                            target_pid_to_str (tp->ptid).c_str ());
-         thread_step_over_chain_enqueue (tp);
+         global_thread_step_over_chain_enqueue (tp);
        }
       else
        {
index 980854135197c7fd2c66a0c8b40e5746ec10aa2d..a49d8627c0aac8f80cc1b8c340b3ca9a056fbce2 100644 (file)
@@ -245,7 +245,7 @@ extern void mark_infrun_async_event_handler (void);
 
 /* The global queue of threads that need to do a step-over operation
    to get past e.g., a breakpoint.  */
-extern struct thread_info *step_over_queue_head;
+extern struct thread_info *global_thread_step_over_chain_head;
 
 /* Remove breakpoints if possible (usually that means, if everything
    is stopped).  On failure, print a message.  */
index 02672f01fcf13aed1a5d4571d3e6d15002233e7d..289cf24feece5aeca2f5f3b9f83ea071ca7f54b3 100644 (file)
@@ -198,7 +198,7 @@ set_thread_exited (thread_info *tp, int silent)
 {
   /* Dead threads don't need to step-over.  Remove from queue.  */
   if (tp->step_over_next != NULL)
-    thread_step_over_chain_remove (tp);
+    global_thread_step_over_chain_remove (tp);
 
   if (tp->state != THREAD_EXITED)
     {
@@ -416,11 +416,11 @@ step_over_chain_remove (struct thread_info **list_p, struct thread_info *tp)
 /* See gdbthread.h.  */
 
 struct thread_info *
-thread_step_over_chain_next (struct thread_info *tp)
+global_thread_step_over_chain_next (struct thread_info *tp)
 {
   struct thread_info *next = tp->step_over_next;
 
-  return (next == step_over_queue_head ? NULL : next);
+  return (next == global_thread_step_over_chain_head ? NULL : next);
 }
 
 /* See gdbthread.h.  */
@@ -434,17 +434,17 @@ thread_is_in_step_over_chain (struct thread_info *tp)
 /* See gdbthread.h.  */
 
 void
-thread_step_over_chain_enqueue (struct thread_info *tp)
+global_thread_step_over_chain_enqueue (struct thread_info *tp)
 {
-  step_over_chain_enqueue (&step_over_queue_head, tp);
+  step_over_chain_enqueue (&global_thread_step_over_chain_head, tp);
 }
 
 /* See gdbthread.h.  */
 
 void
-thread_step_over_chain_remove (struct thread_info *tp)
+global_thread_step_over_chain_remove (struct thread_info *tp)
 {
-  step_over_chain_remove (&step_over_queue_head, tp);
+  step_over_chain_remove (&global_thread_step_over_chain_head, tp);
 }
 
 /* Delete the thread referenced by THR.  If SILENT, don't notify
@@ -838,7 +838,7 @@ set_running_thread (struct thread_info *tp, bool running)
         the step-over queue, so that we don't try to resume
         it until the user wants it to.  */
       if (tp->step_over_next != NULL)
-       thread_step_over_chain_remove (tp);
+       global_thread_step_over_chain_remove (tp);
     }
 
   return started;
This page took 0.034161 seconds and 4 git commands to generate.