This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[RFA] Make continuations per-thread.


Right now, continuations are global. This means that if we're doing
'finish' in one thread, then we cannot do 'finish' or anything that
also uses continuations, in any other thread. This seems unnecessary
limitation, and this patch makes continuations per-thread.

Further into non-stop series, it really allows me to do 'finish' or 'step'
in several threads independently.

OK?

- Volodya

---
 gdb/gdbthread.h |   15 +++++++++++++--
 gdb/infrun.c    |    8 ++++++--
 gdb/thread.c    |   16 ++++++++++++++--
 3 files changed, 33 insertions(+), 6 deletions(-)

diff --git a/gdb/gdbthread.h b/gdb/gdbthread.h
index 6cfb1f9..56cbd51 100644
--- a/gdb/gdbthread.h
+++ b/gdb/gdbthread.h
@@ -64,6 +64,11 @@ struct thread_info
      when we finally do stop stepping.  */
   bpstat stepping_through_solib_catchpoints;
 
+  struct continuation *continuations;
+  struct continuation *intermediate_continations;
+
+  int proceed_to_finish;
+
   /* Private data used by the target vector implementation.  */
   struct private_thread_info *private;
 };
@@ -130,7 +135,10 @@ extern void save_infrun_state (ptid_t ptid,
 			       int       stepping_through_solib_after_catch,
 			       bpstat    stepping_through_solib_catchpoints,
 			       int       current_line,
-			       struct symtab *current_symtab);
+			       struct symtab *current_symtab,
+			       struct continuation *continuations,
+			       struct continuation *intermediate_continations,
+			       int proceed_to_finish);
 
 /* infrun context switch: load the debugger state previously saved
    for the given thread.  */
@@ -146,7 +154,10 @@ extern void load_infrun_state (ptid_t ptid,
 			       int       *stepping_through_solib_affter_catch,
 			       bpstat    *stepping_through_solib_catchpoints,
 			       int       *current_line,
-			       struct symtab **current_symtab);
+			       struct symtab **current_symtab,
+			       struct continuation **continuations,
+			       struct continuation **intermediate_continations,
+			       int *proceed_to_finish);
 
 /* Switch from one thread to another.  */
 extern void switch_to_thread (ptid_t ptid);
diff --git a/gdb/infrun.c b/gdb/infrun.c
index d68b7a5..d6e2c62 100644
--- a/gdb/infrun.c
+++ b/gdb/infrun.c
@@ -1518,7 +1518,9 @@ context_switch (struct execution_control_state *ecs)
 			 ecs->handling_longjmp, ecs->stepping_over_breakpoint,
 			 ecs->stepping_through_solib_after_catch,
 			 ecs->stepping_through_solib_catchpoints,
-			 ecs->current_line, ecs->current_symtab);
+			 ecs->current_line, ecs->current_symtab,
+			 cmd_continuation, intermediate_continuation,
+			 proceed_to_finish);
 
       /* Load infrun state for the new thread.  */
       load_infrun_state (ecs->ptid, &prev_pc,
@@ -1528,7 +1530,9 @@ context_switch (struct execution_control_state *ecs)
 			 &ecs->handling_longjmp, &ecs->stepping_over_breakpoint,
 			 &ecs->stepping_through_solib_after_catch,
 			 &ecs->stepping_through_solib_catchpoints,
-			 &ecs->current_line, &ecs->current_symtab);
+			 &ecs->current_line, &ecs->current_symtab,
+			 &cmd_continuation, &intermediate_continuation,
+			 &proceed_to_finish);
     }
 
   switch_to_thread (ecs->ptid);
diff --git a/gdb/thread.c b/gdb/thread.c
index 431d88f..bba32e8 100644
--- a/gdb/thread.c
+++ b/gdb/thread.c
@@ -333,7 +333,10 @@ load_infrun_state (ptid_t ptid,
 		   int *stepping_through_solib_after_catch,
 		   bpstat *stepping_through_solib_catchpoints,
 		   int *current_line,
-		   struct symtab **current_symtab)
+		   struct symtab **current_symtab,
+		   struct continuation **continuations,
+		   struct continuation **intermediate_continations,
+		   int *proceed_to_finish)
 {
   struct thread_info *tp;
 
@@ -357,6 +360,9 @@ load_infrun_state (ptid_t ptid,
     tp->stepping_through_solib_catchpoints;
   *current_line = tp->current_line;
   *current_symtab = tp->current_symtab;
+  *continuations = tp->continuations;
+  *intermediate_continations = tp->intermediate_continations;
+  *proceed_to_finish = tp->proceed_to_finish;
 }
 
 /* Save infrun state for the thread PID.  */
@@ -374,7 +380,10 @@ save_infrun_state (ptid_t ptid,
 		   int stepping_through_solib_after_catch,
 		   bpstat stepping_through_solib_catchpoints,
 		   int current_line,
-		   struct symtab *current_symtab)
+		   struct symtab *current_symtab,
+		   struct continuation *continuations,
+		   struct continuation *intermediate_continations,
+		   int proceed_to_finish)
 {
   struct thread_info *tp;
 
@@ -396,6 +405,9 @@ save_infrun_state (ptid_t ptid,
   tp->stepping_through_solib_catchpoints = stepping_through_solib_catchpoints;
   tp->current_line = current_line;
   tp->current_symtab = current_symtab;
+  tp->continuations = continuations;
+  tp->intermediate_continations = intermediate_continations;
+  tp->proceed_to_finish = proceed_to_finish;
 }
 
 /* Return true if TP is an active thread. */
-- 
1.5.3.5


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]