* dll.h (struct dll_info): Add comment.
* gdbthread.h (struct thread_info): Add comment.
(current_ptid): Simplify.
* inferiors.c (add_process): Update.
(remove_process): Update.
* inferiors.h (struct process_info): Rename member "head" to "entry".
* linux-low.c (delete_lwp): Update.
(add_lwp): Update.
(last_thread_of_process_p): Update.
(kill_one_lwp_callback, linux_kill): Update.
(status_pending_p_callback): Update.
(wait_for_sigstop): Update. Simplify read of ptid.
(start_step_over): Update.
* linux-low.h (ptid_of, pid_of, lwpid_of): Update.
(get_lwp_thread): Update.
(struct lwp_info): Rename member "head" to "entry".
* regcache.h (inferior_list_entry): Delete.
* server.c (kill_inferior_callback): Update.
(detach_or_kill_inferior_callback): Update.
(print_started_pid): Update.
(print_attached_pid): Update.
(process_serial_event): Simplify read of ptid.
* thread-db.c (thread_db_create_event): Update.
(thread_db_get_tls_address): Update.
* win32-low.c (current_inferior_ptid): Simplify.
+2014-02-19 Doug Evans <dje@google.com>
+
+ * dll.h (struct dll_info): Add comment.
+ * gdbthread.h (struct thread_info): Add comment.
+ (current_ptid): Simplify.
+ * inferiors.c (add_process): Update.
+ (remove_process): Update.
+ * inferiors.h (struct process_info): Rename member "head" to "entry".
+ * linux-low.c (delete_lwp): Update.
+ (add_lwp): Update.
+ (last_thread_of_process_p): Update.
+ (kill_one_lwp_callback, linux_kill): Update.
+ (status_pending_p_callback): Update.
+ (wait_for_sigstop): Update. Simplify read of ptid.
+ (start_step_over): Update.
+ * linux-low.h (ptid_of, pid_of, lwpid_of): Update.
+ (get_lwp_thread): Update.
+ (struct lwp_info): Rename member "head" to "entry".
+ * regcache.h (inferior_list_entry): Delete.
+ * server.c (kill_inferior_callback): Update.
+ (detach_or_kill_inferior_callback): Update.
+ (print_started_pid): Update.
+ (print_attached_pid): Update.
+ (process_serial_event): Simplify read of ptid.
+ * thread-db.c (thread_db_create_event): Update.
+ (thread_db_get_tls_address): Update.
+ * win32-low.c (current_inferior_ptid): Simplify.
+
2014-02-19 Tom Tromey <tromey@redhat.com>
* target.h (struct target_ops) <supports_btrace>: Add target_ops
struct dll_info
{
+ /* This must appear first. See inferiors.h.
+ The list iterator functions assume it. */
struct inferior_list_entry entry;
+
char *name;
CORE_ADDR base_addr;
};
struct thread_info
{
+ /* This must appear first. See inferiors.h.
+ The list iterator functions assume it. */
struct inferior_list_entry entry;
+
void *target_data;
void *regcache_data;
struct thread_info *find_thread_ptid (ptid_t ptid);
/* Get current thread ID (Linux task ID). */
-#define current_ptid ((struct inferior_list_entry *) current_inferior)->id
+#define current_ptid (current_inferior->entry.id)
#endif /* GDB_THREAD_H */
process = xcalloc (1, sizeof (*process));
- process->head.id = pid_to_ptid (pid);
+ process->entry.id = pid_to_ptid (pid);
process->attached = attached;
- add_inferior_to_list (&all_processes, &process->head);
+ add_inferior_to_list (&all_processes, &process->entry);
return process;
}
{
clear_symbol_cache (&process->symbol_cache);
free_all_breakpoints (process);
- remove_inferior (&all_processes, &process->head);
+ remove_inferior (&all_processes, &process->entry);
free (process);
}
struct process_info
{
- struct inferior_list_entry head;
+ /* This must appear first.
+ The list iterator functions assume it. */
+ struct inferior_list_entry entry;
/* Nonzero if this child process was attached rather than
spawned. */
void *arg);
struct inferior_list_entry *find_inferior_id (struct inferior_list *list,
ptid_t id);
+
void *inferior_target_data (struct thread_info *);
void set_inferior_target_data (struct thread_info *, void *);
void *inferior_regcache_data (struct thread_info *);
delete_lwp (struct lwp_info *lwp)
{
remove_thread (get_lwp_thread (lwp));
- remove_inferior (&all_lwps, &lwp->head);
+ remove_inferior (&all_lwps, &lwp->entry);
free (lwp->arch_private);
free (lwp);
}
lwp = (struct lwp_info *) xmalloc (sizeof (*lwp));
memset (lwp, 0, sizeof (*lwp));
- lwp->head.id = ptid;
+ lwp->entry.id = ptid;
if (the_low_target.new_thread != NULL)
lwp->arch_private = the_low_target.new_thread ();
- add_inferior_to_list (&all_lwps, &lwp->head);
+ add_inferior_to_list (&all_lwps, &lwp->entry);
return lwp;
}
static int
last_thread_of_process_p (struct thread_info *thread)
{
- ptid_t ptid = ((struct inferior_list_entry *)thread)->id;
+ ptid_t ptid = thread->entry.id;
int pid = ptid_get_pid (ptid);
struct counter counter = { pid , 0 };
linux_kill_one_lwp (lwp);
/* Make sure it died. The loop is most likely unnecessary. */
- pid = linux_wait_for_event (lwp->head.id, &wstat, __WALL);
+ pid = linux_wait_for_event (lwp->entry.id, &wstat, __WALL);
} while (pid > 0 && WIFSTOPPED (wstat));
return 0;
linux_kill_one_lwp (lwp);
/* Make sure it died. The loop is most likely unnecessary. */
- lwpid = linux_wait_for_event (lwp->head.id, &wstat, __WALL);
+ lwpid = linux_wait_for_event (lwp->entry.id, &wstat, __WALL);
} while (lwpid > 0 && WIFSTOPPED (wstat));
}
/* Check if we're only interested in events from a specific process
or its lwps. */
if (!ptid_equal (minus_one_ptid, ptid)
- && ptid_get_pid (ptid) != ptid_get_pid (lwp->head.id))
+ && ptid_get_pid (ptid) != ptid_get_pid (lwp->entry.id))
return 0;
thread = get_lwp_thread (lwp);
saved_inferior = current_inferior;
if (saved_inferior != NULL)
- saved_tid = ((struct inferior_list_entry *) saved_inferior)->id;
+ saved_tid = saved_inferior->entry.id;
else
saved_tid = null_ptid; /* avoid bogus unused warning */
- ptid = lwp->head.id;
+ ptid = lwp->entry.id;
if (debug_threads)
debug_printf ("wait_for_sigstop: pulling one event\n");
linux_resume_one_lwp (lwp, step, 0, NULL);
/* Require next event from this LWP. */
- step_over_bkpt = lwp->head.id;
+ step_over_bkpt = lwp->entry.id;
return 1;
}
extern struct linux_target_ops the_low_target;
-#define ptid_of(proc) ((proc)->head.id)
-#define pid_of(proc) ptid_get_pid ((proc)->head.id)
-#define lwpid_of(proc) ptid_get_lwp ((proc)->head.id)
+#define ptid_of(proc) ((proc)->entry.id)
+#define pid_of(proc) ptid_get_pid ((proc)->entry.id)
+#define lwpid_of(proc) ptid_get_lwp ((proc)->entry.id)
#define get_lwp(inf) ((struct lwp_info *)(inf))
#define get_thread_lwp(thr) (get_lwp (inferior_target_data (thr)))
#define get_lwp_thread(proc) ((struct thread_info *) \
find_inferior_id (&all_threads, \
- get_lwp (proc)->head.id))
+ get_lwp (proc)->entry.id))
struct lwp_info
{
- struct inferior_list_entry head;
+ struct inferior_list_entry entry;
/* If this flag is set, the next SIGSTOP will be ignored (the
process will be immediately resumed). This means that either we
#ifndef REGCACHE_H
#define REGCACHE_H
-struct inferior_list_entry;
struct thread_info;
struct target_desc;
kill_inferior_callback (struct inferior_list_entry *entry)
{
struct process_info *process = (struct process_info *) entry;
- int pid = ptid_get_pid (process->head.id);
+ int pid = ptid_get_pid (process->entry.id);
kill_inferior (pid);
discard_queued_stop_replies (pid);
detach_or_kill_inferior_callback (struct inferior_list_entry *entry)
{
struct process_info *process = (struct process_info *) entry;
- int pid = ptid_get_pid (process->head.id);
+ int pid = ptid_get_pid (process->entry.id);
if (process->attached)
detach_inferior (pid);
if (! process->attached)
{
- int pid = ptid_get_pid (process->head.id);
+ int pid = ptid_get_pid (process->entry.id);
fprintf (stderr, " %d", pid);
}
}
if (process->attached)
{
- int pid = ptid_get_pid (process->head.id);
+ int pid = ptid_get_pid (process->entry.id);
fprintf (stderr, " %d", pid);
}
}
break;
}
- thread_id = ((struct inferior_list_entry *)thread)->id;
+ thread_id = thread->entry.id;
}
else
{
created threads. */
lwp = get_thread_lwp (current_inferior);
if (lwp->thread_known == 0)
- find_one_thread (lwp->head.id);
+ find_one_thread (current_inferior->entry.id);
/* msg.event == TD_EVENT_CREATE */
lwp = get_thread_lwp (thread);
if (!lwp->thread_known)
- find_one_thread (lwp->head.id);
+ find_one_thread (thread->entry.id);
if (!lwp->thread_known)
return TD_NOTHR;
static ptid_t
current_inferior_ptid (void)
{
- return ((struct inferior_list_entry*) current_inferior)->id;
+ return current_ptid;
}
/* The current debug event from WaitForDebugEvent. */