2001-06-13 Michael Snyder <msnyder@redhat.com>
authorMichael Snyder <msnyder@vmware.com>
Wed, 13 Jun 2001 22:56:16 +0000 (22:56 +0000)
committerMichael Snyder <msnyder@vmware.com>
Wed, 13 Jun 2001 22:56:16 +0000 (22:56 +0000)
        * gdbthread.h (struct thread_info): Add new fields:
        current_line, current_symtab, step_sp, for saved infrun state.
        * thread.c (save_infrun_state, load_infrun_state): Save and
        restore current_line, current_symtab, and step_sp.
        (add_thread): Rather than adding assignments to initialize
the new fields, just use memset (tp, 0, sizeof (*tp).
This way future new fields will not be overlooked.
        * infrun.c (handle_inferior_event): Save and restore save_sp,
        current_line, and current_symtab when switching threads.

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

index c3bc2da057de0aa128fdced0c6788539fa9894fd..1998a2013576519ff46a7d54631e76d88a6e6ae2 100644 (file)
@@ -1,3 +1,15 @@
+2001-06-13  Michael Snyder  <msnyder@redhat.com>
+
+       * gdbthread.h (struct thread_info): Add new fields: 
+       current_line, current_symtab, step_sp, for saved infrun state.
+       * thread.c (save_infrun_state, load_infrun_state): Save and
+       restore current_line, current_symtab, and step_sp.
+       (add_thread): Rather than adding assignments to initialize
+       the new fields, just use memset (tp, 0, sizeof (*tp).
+       This way future new fields will not be overlooked.
+       * infrun.c (handle_inferior_event): Save and restore save_sp,
+       current_line, and current_symtab when switching threads.
+
 2001-06-13  Elena Zannoni  <ezannoni@redhat.com>
 
        * MAINTAINERS: Add Andrew Cagney as co-maintainer of
index 0c6fb84b8cdcf28852ca37d6b593fd9f8845471e..da89b36eee1778ed3428d5a22870bdae7630b0b3 100644 (file)
@@ -44,6 +44,9 @@ struct thread_info
   CORE_ADDR step_range_start;
   CORE_ADDR step_range_end;
   CORE_ADDR step_frame_address;
+  CORE_ADDR step_sp;
+  int current_line;
+  struct symtab *current_symtab;
   int trap_expected;
   int handling_longjmp;
   int another_trap;
@@ -120,7 +123,10 @@ extern void save_infrun_state (ptid_t ptid,
                               int       another_trap,
                               int       stepping_through_solib_after_catch,
                               bpstat    stepping_through_solib_catchpoints,
-                              int       stepping_through_sigtramp);
+                              int       stepping_through_sigtramp,
+                              int       current_line,
+                              struct symtab *current_symtab,
+                              CORE_ADDR step_sp);
 
 /* infrun context switch: load the debugger state previously saved
    for the given thread.  */
@@ -138,7 +144,10 @@ extern void load_infrun_state (ptid_t ptid,
                               int       *another_trap,
                               int       *stepping_through_solib_affter_catch,
                               bpstat    *stepping_through_solib_catchpoints,
-                              int       *stepping_through_sigtramp);
+                              int       *stepping_through_sigtramp,
+                              int       *current_line,
+                              struct symtab **current_symtab,
+                              CORE_ADDR *step_sp);
 
 /* Commands with a prefix of `thread'.  */
 extern struct cmd_list_element *thread_cmd_list;
index 09cf494142d78992a9eca9d4899b5929b30228b3..5a0c5b4de10dc4c9fa1d96bf216ea6c9f32d9386 100644 (file)
@@ -2001,7 +2001,9 @@ handle_inferior_event (struct execution_control_state *ecs)
                               ecs->another_trap,
                               ecs->stepping_through_solib_after_catch,
                               ecs->stepping_through_solib_catchpoints,
-                              ecs->stepping_through_sigtramp);
+                              ecs->stepping_through_sigtramp,
+                              ecs->current_line, ecs->current_symtab, 
+                              step_sp);
 
            /* Load infrun state for the new thread.  */
            load_infrun_state (ecs->ptid, &prev_pc,
@@ -2013,7 +2015,9 @@ handle_inferior_event (struct execution_control_state *ecs)
                               &ecs->another_trap,
                               &ecs->stepping_through_solib_after_catch,
                               &ecs->stepping_through_solib_catchpoints,
-                              &ecs->stepping_through_sigtramp);
+                              &ecs->stepping_through_sigtramp, 
+                              &ecs->current_line, &ecs->current_symtab,
+                              &step_sp);
          }
 
        inferior_ptid = ecs->ptid;
index 7a942769134f37082fcefee121f01f0a2cb40fe1..210b9461bfcb6300cdf639611a01fc805c809d75 100644 (file)
@@ -124,26 +124,11 @@ add_thread (ptid_t ptid)
 {
   struct thread_info *tp;
 
-  tp = (struct thread_info *) xmalloc (sizeof (struct thread_info));
-
+  tp = (struct thread_info *) xmalloc (sizeof (*tp));
+  memset (tp, 0, sizeof (*tp));
   tp->ptid = ptid;
   tp->num = ++highest_thread_num;
-  tp->prev_pc = 0;
-  tp->prev_func_start = 0;
-  tp->prev_func_name = NULL;
-  tp->step_range_start = 0;
-  tp->step_range_end = 0;
-  tp->step_frame_address = 0;
-  tp->step_resume_breakpoint = 0;
-  tp->through_sigtramp_breakpoint = 0;
-  tp->handling_longjmp = 0;
-  tp->trap_expected = 0;
-  tp->another_trap = 0;
-  tp->stepping_through_solib_after_catch = 0;
-  tp->stepping_through_solib_catchpoints = NULL;
-  tp->stepping_through_sigtramp = 0;
   tp->next = thread_list;
-  tp->private = NULL;
   thread_list = tp;
   return tp;
 }
@@ -302,15 +287,24 @@ gdb_list_thread_ids (/* output object */)
 /* Load infrun state for the thread PID.  */
 
 void
-load_infrun_state (ptid_t ptid, CORE_ADDR *prev_pc, CORE_ADDR *prev_func_start,
-                  char **prev_func_name, int *trap_expected,
+load_infrun_state (ptid_t ptid, 
+                  CORE_ADDR *prev_pc, 
+                  CORE_ADDR *prev_func_start,
+                  char **prev_func_name, 
+                  int *trap_expected,
                   struct breakpoint **step_resume_breakpoint,
                   struct breakpoint **through_sigtramp_breakpoint,
-                  CORE_ADDR *step_range_start, CORE_ADDR *step_range_end,
-                  CORE_ADDR *step_frame_address, int *handling_longjmp,
-                  int *another_trap, int *stepping_through_solib_after_catch,
+                  CORE_ADDR *step_range_start, 
+                  CORE_ADDR *step_range_end,
+                  CORE_ADDR *step_frame_address, 
+                  int *handling_longjmp,
+                  int *another_trap, 
+                  int *stepping_through_solib_after_catch,
                   bpstat *stepping_through_solib_catchpoints,
-                  int *stepping_through_sigtramp)
+                  int *stepping_through_sigtramp,
+                  int *current_line, 
+                  struct symtab **current_symtab, 
+                  CORE_ADDR *step_sp)
 {
   struct thread_info *tp;
 
@@ -323,31 +317,43 @@ load_infrun_state (ptid_t ptid, CORE_ADDR *prev_pc, CORE_ADDR *prev_func_start,
   *prev_pc = tp->prev_pc;
   *prev_func_start = tp->prev_func_start;
   *prev_func_name = tp->prev_func_name;
+  *trap_expected = tp->trap_expected;
   *step_resume_breakpoint = tp->step_resume_breakpoint;
+  *through_sigtramp_breakpoint = tp->through_sigtramp_breakpoint;
   *step_range_start = tp->step_range_start;
   *step_range_end = tp->step_range_end;
   *step_frame_address = tp->step_frame_address;
-  *through_sigtramp_breakpoint = tp->through_sigtramp_breakpoint;
   *handling_longjmp = tp->handling_longjmp;
-  *trap_expected = tp->trap_expected;
   *another_trap = tp->another_trap;
   *stepping_through_solib_after_catch = tp->stepping_through_solib_after_catch;
   *stepping_through_solib_catchpoints = tp->stepping_through_solib_catchpoints;
   *stepping_through_sigtramp = tp->stepping_through_sigtramp;
+  *current_line = tp->current_line;
+  *current_symtab = tp->current_symtab;
+  *step_sp = tp->step_sp;
 }
 
 /* Save infrun state for the thread PID.  */
 
 void
-save_infrun_state (ptid_t ptid, CORE_ADDR prev_pc, CORE_ADDR prev_func_start,
-                  char *prev_func_name, int trap_expected,
+save_infrun_state (ptid_t ptid, 
+                  CORE_ADDR prev_pc, 
+                  CORE_ADDR prev_func_start,
+                  char *prev_func_name, 
+                  int trap_expected,
                   struct breakpoint *step_resume_breakpoint,
                   struct breakpoint *through_sigtramp_breakpoint,
-                  CORE_ADDR step_range_start, CORE_ADDR step_range_end,
-                  CORE_ADDR step_frame_address, int handling_longjmp,
-                  int another_trap, int stepping_through_solib_after_catch,
+                  CORE_ADDR step_range_start, 
+                  CORE_ADDR step_range_end,
+                  CORE_ADDR step_frame_address, 
+                  int handling_longjmp,
+                  int another_trap, 
+                  int stepping_through_solib_after_catch,
                   bpstat stepping_through_solib_catchpoints,
-                  int stepping_through_sigtramp)
+                  int stepping_through_sigtramp, 
+                  int current_line,
+                  struct symtab *current_symtab,
+                  CORE_ADDR step_sp)
 {
   struct thread_info *tp;
 
@@ -360,17 +366,20 @@ save_infrun_state (ptid_t ptid, CORE_ADDR prev_pc, CORE_ADDR prev_func_start,
   tp->prev_pc = prev_pc;
   tp->prev_func_start = prev_func_start;
   tp->prev_func_name = prev_func_name;
+  tp->trap_expected = trap_expected;
   tp->step_resume_breakpoint = step_resume_breakpoint;
+  tp->through_sigtramp_breakpoint = through_sigtramp_breakpoint;
   tp->step_range_start = step_range_start;
   tp->step_range_end = step_range_end;
   tp->step_frame_address = step_frame_address;
-  tp->through_sigtramp_breakpoint = through_sigtramp_breakpoint;
   tp->handling_longjmp = handling_longjmp;
-  tp->trap_expected = trap_expected;
   tp->another_trap = another_trap;
   tp->stepping_through_solib_after_catch = stepping_through_solib_after_catch;
   tp->stepping_through_solib_catchpoints = stepping_through_solib_catchpoints;
   tp->stepping_through_sigtramp = stepping_through_sigtramp;
+  tp->current_line = current_line;
+  tp->current_symtab = current_symtab;
+  tp->step_sp = step_sp;
 }
 
 /* Return true if TP is an active thread. */