Replace code accessing list implementation details with API calls.
* dll.c (clear_dlls): Replace accessing list implemention details with API function. * gdbthread.h (get_first_thread): Declare. * inferiors.c (for_each_inferior_with_data): New function. (get_first_thread): New function. (find_thread_ptid): Simplify. (get_first_inferior): New function. (clear_list): Delete. (one_inferior_p): New function. (clear_inferior_list): New function. (clear_inferiors): Update. * inferiors.h (for_each_inferior_with_data): Declare. (clear_inferior_list): Declare. (one_inferior_p): Declare. (get_first_inferior): Declare. * linux-low.c (linux_wait_for_event): Replace accessing list implemention details with API function. * server.c (target_running): Ditto. (accumulate_file_name_length): New function. (emit_dll_description): New function. (handle_qxfer_libraries): Replace accessing list implemention details with API function. (handle_qxfer_threads_worker): New function. (handle_qxfer_threads_proper): Replace accessing list implemention details with API function. (handle_query): Ditto. (visit_actioned_threads_callback_ftype): New typedef. (visit_actioned_threads_data): New struct. (visit_actioned_threads): Rewrite to be find_inferior callback. (resume): Call find_inferior. (handle_status): Replace accessing list implemention details with API function. (process_serial_event): Replace accessing list implemention details with API function. * target.c (set_desired_inferior): Replace accessing list implemention details with API function. * tracepoint.c (same_process_p): New function. (gdb_agent_about_to_close): Replace accessing list implemention details with API function. * win32-low.c (child_delete_thread): Replace accessing list implemention details with API function. (match_dll_by_basename): New function. (dll_is_loaded_by_basename): New function. (win32_ensure_ntdll_loaded): Replace accessing list implemention details call to dll_is_loaded_by_basename.
This commit is contained in:
parent
b5ad007edc
commit
649ebbcaef
10 changed files with 279 additions and 109 deletions
|
@ -3943,6 +3943,17 @@ cmd_qtstmat (char *packet)
|
|||
run_inferior_command (packet, strlen (packet) + 1);
|
||||
}
|
||||
|
||||
/* Helper for gdb_agent_about_to_close.
|
||||
Return non-zero if thread ENTRY is in the same process in DATA. */
|
||||
|
||||
static int
|
||||
same_process_p (struct inferior_list_entry *entry, void *data)
|
||||
{
|
||||
int *pid = data;
|
||||
|
||||
return ptid_get_pid (entry->id) == *pid;
|
||||
}
|
||||
|
||||
/* Sent the agent a command to close it. */
|
||||
|
||||
void
|
||||
|
@ -3953,19 +3964,12 @@ gdb_agent_about_to_close (int pid)
|
|||
if (!maybe_write_ipa_not_loaded (buf))
|
||||
{
|
||||
struct thread_info *save_inferior;
|
||||
struct inferior_list_entry *inf = all_threads.head;
|
||||
|
||||
save_inferior = current_inferior;
|
||||
|
||||
/* Find a certain thread which belongs to process PID. */
|
||||
while (inf != NULL)
|
||||
{
|
||||
if (ptid_get_pid (inf->id) == pid)
|
||||
break;
|
||||
inf = inf->next;
|
||||
}
|
||||
|
||||
current_inferior = (struct thread_info *) inf;
|
||||
/* Find any thread which belongs to process PID. */
|
||||
current_inferior = (struct thread_info *)
|
||||
find_inferior (&all_threads, same_process_p, &pid);
|
||||
|
||||
strcpy (buf, "close");
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue