diff options
Diffstat (limited to 'gdb')
-rw-r--r-- | gdb/gdbserver/ChangeLog | 7 | ||||
-rw-r--r-- | gdb/gdbserver/inferiors.c | 8 | ||||
-rw-r--r-- | gdb/gdbserver/inferiors.h | 1 | ||||
-rw-r--r-- | gdb/gdbserver/server.c | 28 |
4 files changed, 16 insertions, 28 deletions
diff --git a/gdb/gdbserver/ChangeLog b/gdb/gdbserver/ChangeLog index 144e09a..eaf8e6e 100644 --- a/gdb/gdbserver/ChangeLog +++ b/gdb/gdbserver/ChangeLog @@ -1,5 +1,12 @@ 2017-09-15 Simon Marchi <simon.marchi@ericsson.com> + * inferiors.h (gdb_id_to_thread_id): Remove. + * inferiors.c (gdb_id_to_thread_id): Remove. + * server.c (process_serial_event): Adjust to gdb_id_to_thread_id + removal. Move pid declaration closer to where it's used. + +2017-09-15 Simon Marchi <simon.marchi@ericsson.com> + * server.c (handle_detach): New function. (process_serial_event): Move code out, call handle_detach. diff --git a/gdb/gdbserver/inferiors.c b/gdb/gdbserver/inferiors.c index 2212850..933dd76 100644 --- a/gdb/gdbserver/inferiors.c +++ b/gdb/gdbserver/inferiors.c @@ -173,14 +173,6 @@ find_any_thread_of_pid (int pid) return (struct thread_info *) entry; } -ptid_t -gdb_id_to_thread_id (ptid_t gdb_id) -{ - struct thread_info *thread = find_thread_ptid (gdb_id); - - return thread ? thread->entry.id : null_ptid; -} - static void free_one_thread (struct inferior_list_entry *inf) { diff --git a/gdb/gdbserver/inferiors.h b/gdb/gdbserver/inferiors.h index f229e67..6316fe5 100644 --- a/gdb/gdbserver/inferiors.h +++ b/gdb/gdbserver/inferiors.h @@ -144,7 +144,6 @@ int have_started_inferiors_p (void); int have_attached_inferiors_p (void); ptid_t thread_to_gdb_id (struct thread_info *); -ptid_t gdb_id_to_thread_id (ptid_t); void clear_inferiors (void); struct inferior_list_entry *find_inferior diff --git a/gdb/gdbserver/server.c b/gdb/gdbserver/server.c index 3de7f16..32c9bab 100644 --- a/gdb/gdbserver/server.c +++ b/gdb/gdbserver/server.c @@ -4139,23 +4139,16 @@ process_serial_event (void) case 'H': if (own_buf[1] == 'c' || own_buf[1] == 'g' || own_buf[1] == 's') { - ptid_t gdb_id, thread_id; - int pid; - require_running_or_break (own_buf); - gdb_id = read_ptid (&own_buf[2], NULL); - - pid = ptid_get_pid (gdb_id); + ptid_t thread_id = read_ptid (&own_buf[2], NULL); - if (ptid_equal (gdb_id, null_ptid) - || ptid_equal (gdb_id, minus_one_ptid)) + if (thread_id == null_ptid || thread_id == minus_one_ptid) thread_id = null_ptid; - else if (pid != 0 - && ptid_equal (pid_to_ptid (pid), - gdb_id)) + else if (thread_id.is_pid ()) { - thread_info *thread = find_any_thread_of_pid (pid); + /* The ptid represents a pid. */ + thread_info *thread = find_any_thread_of_pid (thread_id.pid ()); if (thread == NULL) { @@ -4167,8 +4160,8 @@ process_serial_event (void) } else { - thread_id = gdb_id_to_thread_id (gdb_id); - if (ptid_equal (thread_id, null_ptid)) + /* The ptid represents a lwp/tid. */ + if (find_thread_ptid (thread_id) == NULL) { write_enn (own_buf); break; @@ -4373,13 +4366,10 @@ process_serial_event (void) case 'T': { - ptid_t gdb_id, thread_id; - require_running_or_break (own_buf); - gdb_id = read_ptid (&own_buf[1], NULL); - thread_id = gdb_id_to_thread_id (gdb_id); - if (ptid_equal (thread_id, null_ptid)) + ptid_t thread_id = read_ptid (&own_buf[1], NULL); + if (find_thread_ptid (thread_id) == NULL) { write_enn (own_buf); break; |