diff options
author | Jan Kratochvil <jan.kratochvil@redhat.com> | 2008-09-17 21:48:49 +0000 |
---|---|---|
committer | Jan Kratochvil <jan.kratochvil@redhat.com> | 2008-09-17 21:48:49 +0000 |
commit | 88ed393a46c5216e25997cb873e1ebef32cb511f (patch) | |
tree | 635847b897b73c3f30c5dabb84099c3342a1f29a | |
parent | 2a7b2e88e38cbd83225e9c3b28a990de56dccef7 (diff) | |
download | gdb-88ed393a46c5216e25997cb873e1ebef32cb511f.zip gdb-88ed393a46c5216e25997cb873e1ebef32cb511f.tar.gz gdb-88ed393a46c5216e25997cb873e1ebef32cb511f.tar.bz2 |
Fix a crash on uninitialized ECS->EVENT_THREAD for a newly found thread.
* infrun.c (wait_for_inferior): Move this ECS->EVENT_THREAD
initialization ...
(fetch_inferior_event): ... and this ECS->EVENT_THREAD initialization
...
(handle_inferior_event): ... here after the add_thread call together
with the local adjust_pc_after_break and reinit_frame_cache calls.
-rw-r--r-- | gdb/ChangeLog | 10 | ||||
-rw-r--r-- | gdb/infrun.c | 16 |
2 files changed, 18 insertions, 8 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 16d6891..65f60a9 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,13 @@ +2008-09-17 Jan Kratochvil <jan.kratochvil@redhat.com> + + Fix a crash on uninitialized ECS->EVENT_THREAD for a newly found thread. + * infrun.c (wait_for_inferior): Move this ECS->EVENT_THREAD + initialization ... + (fetch_inferior_event): ... and this ECS->EVENT_THREAD initialization + ... + (handle_inferior_event): ... here after the add_thread call together + with the local adjust_pc_after_break and reinit_frame_cache calls. + 2008-09-16 David Daney <ddaney@avtrex.com> * breakpoint.c (bpstat_stop_status): Clear breakpoint_at for diff --git a/gdb/infrun.c b/gdb/infrun.c index d914f0a..c7fdd61 100644 --- a/gdb/infrun.c +++ b/gdb/infrun.c @@ -1568,8 +1568,6 @@ wait_for_inferior (int treat_exec_as_sigtrap) else ecs->ptid = target_wait (waiton_ptid, &ecs->ws); - ecs->event_thread = find_thread_pid (ecs->ptid); - if (treat_exec_as_sigtrap && ecs->ws.kind == TARGET_WAITKIND_EXECD) { xfree (ecs->ws.value.execd_pathname); @@ -1645,8 +1643,6 @@ fetch_inferior_event (void *client_data) thread. */ context_switch (ecs->ptid); - ecs->event_thread = find_thread_pid (ecs->ptid); - /* Now figure out what to do with the result of the result. */ handle_inferior_event (ecs); @@ -1854,10 +1850,6 @@ handle_inferior_event (struct execution_control_state *ecs) /* Always clear state belonging to the previous time we stopped. */ stop_stack_dummy = 0; - adjust_pc_after_break (ecs); - - reinit_frame_cache (); - /* If it's a new process, add it to the thread database */ ecs->new_thread_event = (!ptid_equal (ecs->ptid, inferior_ptid) @@ -1868,6 +1860,14 @@ handle_inferior_event (struct execution_control_state *ecs) && ecs->ws.kind != TARGET_WAITKIND_SIGNALLED && ecs->new_thread_event) add_thread (ecs->ptid); + ecs->event_thread = find_thread_pid (ecs->ptid); + + /* Dependent on valid ECS->EVENT_THREAD. */ + adjust_pc_after_break (ecs); + + /* Dependent on the current PC value modified by adjust_pc_after_break. */ + reinit_frame_cache (); + if (ecs->ws.kind != TARGET_WAITKIND_IGNORE) { /* Mark the non-executing threads accordingly. */ |