summaryrefslogtreecommitdiff
path: root/gdb/thread.c
diff options
context:
space:
mode:
authorMichael Snyder <msnyder@specifix.com>2001-06-13 22:56:16 +0000
committerMichael Snyder <msnyder@specifix.com>2001-06-13 22:56:16 +0000
commite8b35f4e5586ff02bc736d4e521fd69c05efddae (patch)
tree54572040e731786dc2931f5af3adecc766d6f670 /gdb/thread.c
parente625a1f43dcd86d605599570a71186ba204134d9 (diff)
downloadgdb-e8b35f4e5586ff02bc736d4e521fd69c05efddae.tar.gz
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.
Diffstat (limited to 'gdb/thread.c')
-rw-r--r--gdb/thread.c75
1 files changed, 42 insertions, 33 deletions
diff --git a/gdb/thread.c b/gdb/thread.c
index 7a942769134..210b9461bfc 100644
--- a/gdb/thread.c
+++ b/gdb/thread.c
@@ -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. */