aboutsummaryrefslogtreecommitdiff
path: root/gdb/infrun.c
diff options
context:
space:
mode:
authorPedro Alves <palves@redhat.com>2012-06-06 18:10:17 +0000
committerPedro Alves <palves@redhat.com>2012-06-06 18:10:17 +0000
commit359f5fe60e35bf3a428289fb3027ee9b6b5c848c (patch)
tree28556ecdb8b947a4b68d14fe258b1afdb908420a /gdb/infrun.c
parent2d4c29c5e6d43e8a6dfec443d25f42b371bb4f0b (diff)
downloadgdb-359f5fe60e35bf3a428289fb3027ee9b6b5c848c.zip
gdb-359f5fe60e35bf3a428289fb3027ee9b6b5c848c.tar.gz
gdb-359f5fe60e35bf3a428289fb3027ee9b6b5c848c.tar.bz2
gdb/
2012-06-06 Pedro Alves <palves@redhat.com> * infrun.c (struct execution_control_state): Remove `new_thread_event' field. (handle_inferior_event): Simplify new threads handling; don't resume the inferior if we find a new thread. gdb/testsuite/ 2012-06-06 Pedro Alves <palves@redhat.com> * gdb.threads/clone-new-thread-event.c: New file. * gdb.threads/clone-new-thread-event.exp: New file.
Diffstat (limited to 'gdb/infrun.c')
-rw-r--r--gdb/infrun.c43
1 files changed, 8 insertions, 35 deletions
diff --git a/gdb/infrun.c b/gdb/infrun.c
index 45b1fe7..b008552 100644
--- a/gdb/infrun.c
+++ b/gdb/infrun.c
@@ -2393,7 +2393,6 @@ struct execution_control_state
CORE_ADDR stop_func_start;
CORE_ADDR stop_func_end;
const char *stop_func_name;
- int new_thread_event;
int wait_some_more;
};
@@ -3229,17 +3228,15 @@ handle_inferior_event (struct execution_control_state *ecs)
return;
}
- /* If it's a new process, add it to the thread database. */
-
- ecs->new_thread_event = (!ptid_equal (ecs->ptid, inferior_ptid)
- && !ptid_equal (ecs->ptid, minus_one_ptid)
- && !in_thread_list (ecs->ptid));
-
if (ecs->ws.kind != TARGET_WAITKIND_EXITED
- && ecs->ws.kind != TARGET_WAITKIND_SIGNALLED && ecs->new_thread_event)
- add_thread (ecs->ptid);
-
- ecs->event_thread = find_thread_ptid (ecs->ptid);
+ && ecs->ws.kind != TARGET_WAITKIND_SIGNALLED
+ && !ptid_equal (ecs->ptid, minus_one_ptid))
+ {
+ ecs->event_thread = find_thread_ptid (ecs->ptid);
+ /* If it's a new thread, add it to the thread database. */
+ if (ecs->event_thread == NULL)
+ ecs->event_thread = add_thread (ecs->ptid);
+ }
/* Dependent on valid ECS->EVENT_THREAD. */
adjust_pc_after_break (ecs);
@@ -3713,30 +3710,6 @@ handle_inferior_event (struct execution_control_state *ecs)
return;
}
- if (ecs->new_thread_event)
- {
- if (non_stop)
- /* Non-stop assumes that the target handles adding new threads
- to the thread list. */
- internal_error (__FILE__, __LINE__,
- "targets should add new threads to the thread "
- "list themselves in non-stop mode.");
-
- /* We may want to consider not doing a resume here in order to
- give the user a chance to play with the new thread. It might
- be good to make that a user-settable option. */
-
- /* At this point, all threads are stopped (happens automatically
- in either the OS or the native code). Therefore we need to
- continue all threads in order to make progress. */
-
- if (!ptid_equal (ecs->ptid, inferior_ptid))
- context_switch (ecs->ptid);
- target_resume (RESUME_ALL, 0, GDB_SIGNAL_0);
- prepare_to_wait (ecs);
- return;
- }
-
if (ecs->ws.kind == TARGET_WAITKIND_STOPPED)
{
/* Do we need to clean up the state of a thread that has