aboutsummaryrefslogtreecommitdiff
path: root/gdb/thread.c
diff options
context:
space:
mode:
authorMichael Snyder <msnyder@vmware.com>2001-06-13 22:56:16 +0000
committerMichael Snyder <msnyder@vmware.com>2001-06-13 22:56:16 +0000
commit6c0d3f6a034437ee436b20784a4a4eee92163395 (patch)
tree516ea56a75a018cd979f5e9023301509d9f8befa /gdb/thread.c
parent16075aced5830467024fec7c8229cbcbfa3a47c9 (diff)
downloadgdb-6c0d3f6a034437ee436b20784a4a4eee92163395.zip
gdb-6c0d3f6a034437ee436b20784a4a4eee92163395.tar.gz
gdb-6c0d3f6a034437ee436b20784a4a4eee92163395.tar.bz2
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 7a94276..210b946 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. */