gdbserver: Rename some functions, thread -> inferior

These functions apply to thread, and not inferiors (in the gdbserver
sense, the abstraction for threads and processes, as in
inferior_list).  Therefore, it would make more sense if these functions
were named with "thread" rather than "inferior".

gdb/gdbserver/ChangeLog:

	* inferiors.h (inferior_target_data): Rename to ...
	(thread_target_data): ... this.
	(inferior_regcache_data): Rename to ...
	(thread_regcache_data): ... this.
	(set_inferior_regcache_data): Rename to ...
	(set_thread_regcache_data): ... this.
	* inferiors.c (inferior_target_data): Rename to ...
	(thread_target_data): ... this.
	(inferior_regcache_data): Rename to ...
	(thread_regcache_data): ... this.
	(set_inferior_regcache_data): Rename to ...
	(set_thread_regcache_data): ... this.
	(free_one_thread): Update.
	* linux-low.h (get_thread_lwp): Update.
	* regcache.c (get_thread_regcache): Update.
	(regcache_invalidate_thread): Update.
	(free_register_cache_thread): Update.
	* win32-i386-low.c (update_debug_registers_callback): Update.
	(win32_get_current_dr): Update.
	* win32-low.c (thread_rec): Update.
	(delete_thread_info): Update.
	(continue_one_thread): Update.
	(suspend_one_thread): Update.
This commit is contained in:
Simon Marchi 2017-08-25 10:45:33 +02:00
parent 1445030f31
commit 6afd337d1a
7 changed files with 48 additions and 22 deletions

View File

@ -1,3 +1,29 @@
2017-08-25 Simon Marchi <simon.marchi@ericsson.com>
* inferiors.h (inferior_target_data): Rename to ...
(thread_target_data): ... this.
(inferior_regcache_data): Rename to ...
(thread_regcache_data): ... this.
(set_inferior_regcache_data): Rename to ...
(set_thread_regcache_data): ... this.
* inferiors.c (inferior_target_data): Rename to ...
(thread_target_data): ... this.
(inferior_regcache_data): Rename to ...
(thread_regcache_data): ... this.
(set_inferior_regcache_data): Rename to ...
(set_thread_regcache_data): ... this.
(free_one_thread): Update.
* linux-low.h (get_thread_lwp): Update.
* regcache.c (get_thread_regcache): Update.
(regcache_invalidate_thread): Update.
(free_register_cache_thread): Update.
* win32-i386-low.c (update_debug_registers_callback): Update.
(win32_get_current_dr): Update.
* win32-low.c (thread_rec): Update.
(delete_thread_info): Update.
(continue_one_thread): Update.
(suspend_one_thread): Update.
2017-08-24 Simon Marchi <simon.marchi@ericsson.com>
* inferiors.c (set_inferior_target_data): Remove.

View File

@ -197,7 +197,7 @@ static void
free_one_thread (struct inferior_list_entry *inf)
{
struct thread_info *thread = get_thread (inf);
free_register_cache (inferior_regcache_data (thread));
free_register_cache (thread_regcache_data (thread));
free (thread);
}
@ -309,21 +309,21 @@ find_inferior_id (struct inferior_list *list, ptid_t id)
}
void *
inferior_target_data (struct thread_info *inferior)
thread_target_data (struct thread_info *thread)
{
return inferior->target_data;
return thread->target_data;
}
struct regcache *
inferior_regcache_data (struct thread_info *inferior)
thread_regcache_data (struct thread_info *thread)
{
return inferior->regcache_data;
return thread->regcache_data;
}
void
set_inferior_regcache_data (struct thread_info *inferior, struct regcache *data)
set_thread_regcache_data (struct thread_info *thread, struct regcache *data)
{
inferior->regcache_data = data;
thread->regcache_data = data;
}
/* Return true if LIST has exactly one entry. */

View File

@ -160,8 +160,8 @@ struct inferior_list_entry *
void *),
void *arg);
void *inferior_target_data (struct thread_info *);
struct regcache *inferior_regcache_data (struct thread_info *);
void set_inferior_regcache_data (struct thread_info *, struct regcache *);
void *thread_target_data (struct thread_info *);
struct regcache *thread_regcache_data (struct thread_info *);
void set_thread_regcache_data (struct thread_info *, struct regcache *);
#endif /* INFERIORS_H */

View File

@ -252,7 +252,7 @@ struct linux_target_ops
extern struct linux_target_ops the_low_target;
#define get_thread_lwp(thr) ((struct lwp_info *) (inferior_target_data (thr)))
#define get_thread_lwp(thr) ((struct lwp_info *) (thread_target_data (thr)))
#define get_lwp_thread(lwp) ((lwp)->thread)
/* This struct is recorded in the target_data field of struct thread_info.

View File

@ -28,7 +28,7 @@ get_thread_regcache (struct thread_info *thread, int fetch)
{
struct regcache *regcache;
regcache = inferior_regcache_data (thread);
regcache = thread_regcache_data (thread);
/* Threads' regcaches are created lazily, because biarch targets add
the main thread/lwp before seeing it stop for the first time, and
@ -44,7 +44,7 @@ get_thread_regcache (struct thread_info *thread, int fetch)
gdb_assert (proc->tdesc != NULL);
regcache = new_register_cache (proc->tdesc);
set_inferior_regcache_data (thread, regcache);
set_thread_regcache_data (thread, regcache);
}
if (fetch && regcache->registers_valid == 0)
@ -76,7 +76,7 @@ regcache_invalidate_thread (struct thread_info *thread)
{
struct regcache *regcache;
regcache = inferior_regcache_data (thread);
regcache = thread_regcache_data (thread);
if (regcache == NULL)
return;
@ -277,13 +277,13 @@ find_register_by_number (const struct target_desc *tdesc, int n)
static void
free_register_cache_thread (struct thread_info *thread)
{
struct regcache *regcache = inferior_regcache_data (thread);
struct regcache *regcache = thread_regcache_data (thread);
if (regcache != NULL)
{
regcache_invalidate_thread (thread);
free_register_cache (regcache);
set_inferior_regcache_data (thread, NULL);
set_thread_regcache_data (thread, NULL);
}
}

View File

@ -45,7 +45,7 @@ update_debug_registers_callback (struct inferior_list_entry *entry,
void *pid_p)
{
struct thread_info *thr = (struct thread_info *) entry;
win32_thread_info *th = (win32_thread_info *) inferior_target_data (thr);
win32_thread_info *th = (win32_thread_info *) thread_target_data (thr);
int pid = *(int *) pid_p;
/* Only update the threads of this process. */
@ -90,7 +90,7 @@ static DWORD64
win32_get_current_dr (int dr)
{
win32_thread_info *th
= (win32_thread_info *) inferior_target_data (current_thread);
= (win32_thread_info *) thread_target_data (current_thread);
win32_require_context (th);

View File

@ -198,7 +198,7 @@ thread_rec (ptid_t ptid, int get_context)
if (thread == NULL)
return NULL;
th = (win32_thread_info *) inferior_target_data (thread);
th = (win32_thread_info *) thread_target_data (thread);
if (get_context)
win32_require_context (th);
return th;
@ -232,7 +232,7 @@ static void
delete_thread_info (struct inferior_list_entry *entry)
{
struct thread_info *thread = (struct thread_info *) entry;
win32_thread_info *th = (win32_thread_info *) inferior_target_data (thread);
win32_thread_info *th = (win32_thread_info *) thread_target_data (thread);
remove_thread (thread);
CloseHandle (th->h);
@ -433,7 +433,7 @@ continue_one_thread (struct inferior_list_entry *this_thread, void *id_ptr)
{
struct thread_info *thread = (struct thread_info *) this_thread;
int thread_id = * (int *) id_ptr;
win32_thread_info *th = (win32_thread_info *) inferior_target_data (thread);
win32_thread_info *th = (win32_thread_info *) thread_target_data (thread);
if (thread_id == -1 || thread_id == th->tid)
{
@ -1333,7 +1333,7 @@ static void
suspend_one_thread (struct inferior_list_entry *entry)
{
struct thread_info *thread = (struct thread_info *) entry;
win32_thread_info *th = (win32_thread_info *) inferior_target_data (thread);
win32_thread_info *th = (win32_thread_info *) thread_target_data (thread);
if (!th->suspended)
{