[PATCH 05/18] poison "private"

Ondrej Oprala
2013-10-21T15:37:40Z

From: Tom Tromey <tromey@redhat.com>

gdb/ChangeLog

2013-10-21 Tom Tromey <tromey@redhat.com>

* gdbthread.h (struct thread_info): Rename field private to
private_data.
* inferior.c (struct inferior): Likewise.
* inferior.h (private_data): Renamed from private.
* jit.c (private_unwind): Likewise.
* linux-thread-db.c (thread): Rename field private to
private_data.
(private_thr): Renamed from private.
* nto-tdep.c (struct thread_info): Rename field private to
private_data.
* remote.c (struct thread_info): Likewise.
* thread.c (struct thread_info): Likewise.
---
gdb/gdbthread.h | 6 +++---
gdb/inferior.c | 2 +-
gdb/inferior.h | 2 +-
gdb/jit.c | 8 ++++----
gdb/linux-thread-db.c | 42 +++++++++++++++++++++---------------------
gdb/nto-tdep.c | 6 +++---
gdb/remote.c | 18 +++++++++---------
gdb/thread.c | 10 +++++-----
8 files changed, 47 insertions(+), 47 deletions(-)

diff --git a/gdb/gdbthread.h b/gdb/gdbthread.h
index 81dc7ed..eb4bac7 100644
--- a/gdb/gdbthread.h
+++ b/gdb/gdbthread.h
@@ -230,10 +230,10 @@ struct thread_info
struct frame_id initiating_frame;

/* Private data used by the target vector implementation. */
- struct private_thread_info *private;
+ struct private_thread_info *private_data;

- /* Function that is called to free PRIVATE. If this is NULL, then
- xfree will be called on PRIVATE. */
+ /* Function that is called to free PRIVATE_DATA. If this is NULL, then
+ xfree will be called on PRIVATE_DATA. */
void (*private_dtor) (struct private_thread_info *);

/* Branch trace information for this thread. */
diff --git a/gdb/inferior.c b/gdb/inferior.c
index 28a5200..57004b2 100644
--- a/gdb/inferior.c
+++ b/gdb/inferior.c
@@ -102,7 +102,7 @@ free_inferior (struct inferior *inf)
xfree (inf->terminal);
free_environ (inf->environment);
target_desc_info_free (inf->tdesc_info);
- xfree (inf->private);
+ xfree (inf->private_data);
xfree (inf);
}

diff --git a/gdb/inferior.h b/gdb/inferior.h
index fff072b..7c5e1ea 100644
--- a/gdb/inferior.h
+++ b/gdb/inferior.h
@@ -486,7 +486,7 @@ struct inferior
struct continuation *continuations;

/* Private data used by the target vector implementation. */
- struct private_inferior *private;
+ struct private_inferior *private_data;

/* HAS_EXIT_CODE is true if the inferior exited with an exit code.
In this case, the EXIT_CODE field is also valid. */
diff --git a/gdb/jit.c b/gdb/jit.c
index 4eb818c..2048391 100644
--- a/gdb/jit.c
+++ b/gdb/jit.c
@@ -1216,20 +1216,20 @@ static void
jit_frame_this_id (struct frame_info *this_frame, void **cache,
struct frame_id *this_id)
{
- struct jit_unwind_private private;
+ struct jit_unwind_private private_unwind;
struct gdb_frame_id frame_id;
struct gdb_reader_funcs *funcs;
struct gdb_unwind_callbacks callbacks;

- private.registers = NULL;
- private.this_frame = this_frame;
+ private_unwind.registers = NULL;
+ private_unwind.this_frame = this_frame;

/* We don't expect the frame_id function to set any registers, so we
set reg_set to NULL. */
callbacks.reg_get = jit_unwind_reg_get_impl;
callbacks.reg_set = NULL;
callbacks.target_read = jit_target_read_impl;
- callbacks.priv_data = &private;
+ callbacks.priv_data = &private_unwind;

gdb_assert (loaded_jit_reader);
funcs = loaded_jit_reader->functions;
diff --git a/gdb/linux-thread-db.c b/gdb/linux-thread-db.c
index 593fc29..960e07d 100644
--- a/gdb/linux-thread-db.c
+++ b/gdb/linux-thread-db.c
@@ -375,7 +375,7 @@ have_threads_callback (struct thread_info *thread, void *args)
if (ptid_get_pid (thread->ptid) != pid)
return 0;

- return thread->private != NULL;
+ return thread->private_data != NULL;
}

static int
@@ -1224,7 +1224,7 @@ static int
attach_thread (ptid_t ptid, const td_thrhandle_t *th_p,
const td_thrinfo_t *ti_p)
{
- struct private_thread_info *private;
+ struct private_thread_info *private_thr;
struct thread_info *tp;
td_err_e err;
struct thread_db_info *info;
@@ -1249,9 +1249,9 @@ attach_thread (ptid_t ptid, const td_thrhandle_t *th_p,
PTRACE_EVENT_CLONE); assume the same mechanism notices thread
exit, so this can not be a stale thread recreated with the
same ID. */
- if (tp->private != NULL)
+ if (tp->private_data != NULL)
{
- if (!tp->private->dying)
+ if (!tp->private_data->dying)
return 0;

delete_thread (ptid);
@@ -1286,8 +1286,8 @@ attach_thread (ptid_t ptid, const td_thrhandle_t *th_p,
}

/* Construct the thread's private data. */
- private = xmalloc (sizeof (struct private_thread_info));
- memset (private, 0, sizeof (struct private_thread_info));
+ private_thr = xmalloc (sizeof (struct private_thread_info));
+ memset (private_thr, 0, sizeof (struct private_thread_info));

/* A thread ID of zero may mean the thread library has not initialized
yet. But we shouldn't even get here if that's the case. FIXME:
@@ -1295,16 +1295,16 @@ attach_thread (ptid_t ptid, const td_thrhandle_t *th_p,
list this will have to go somewhere else; maybe private == NULL
until the thread_db target claims it. */
gdb_assert (ti_p->ti_tid != 0);
- private->th = *th_p;
- private->tid = ti_p->ti_tid;
+ private_thr->th = *th_p;
+ private_thr->tid = ti_p->ti_tid;
if (ti_p->ti_state == TD_THR_UNKNOWN || ti_p->ti_state == TD_THR_ZOMBIE)
- private->dying = 1;
+ private_thr->dying = 1;

/* Add the thread to GDB's thread list. */
if (tp == NULL)
- add_thread_with_info (ptid, private);
+ add_thread_with_info (ptid, private_thr);
else
- tp->private = private;
+ tp->private_data = private_thr;

info = get_thread_db_info (ptid_get_pid (ptid));

@@ -1335,8 +1335,8 @@ detach_thread (ptid_t ptid)
something re-uses its thread ID. We'll report the thread exit
when the underlying LWP dies. */
thread_info = find_thread_ptid (ptid);
- gdb_assert (thread_info != NULL && thread_info->private != NULL);
- thread_info->private->dying = 1;
+ gdb_assert (thread_info != NULL && thread_info->private_data != NULL);
+ thread_info->private_data->dying = 1;
}

static void
@@ -1598,7 +1598,7 @@ find_new_threads_callback (const td_thrhandle_t *th_p, void *data)

ptid = ptid_build (info->pid, ti.ti_lid, 0);
tp = find_thread_ptid (ptid);
- if (tp == NULL || tp->private == NULL)
+ if (tp == NULL || tp->private_data == NULL)
{
if (attach_thread (ptid, th_p, &ti))
cb_data->new_threads += 1;
@@ -1741,12 +1741,12 @@ thread_db_pid_to_str (struct target_ops *ops, ptid_t ptid)
struct thread_info *thread_info = find_thread_ptid (ptid);
struct target_ops *beneath;

- if (thread_info != NULL && thread_info->private != NULL)
+ if (thread_info != NULL && thread_info->private_data != NULL)
{
static char buf[64];
thread_t tid;

- tid = thread_info->private->tid;
+ tid = thread_info->private_data->tid;
snprintf (buf, sizeof (buf), "Thread 0x%lx (LWP %ld)",
tid, ptid_get_lwp (ptid));

@@ -1766,10 +1766,10 @@ thread_db_pid_to_str (struct target_ops *ops, ptid_t ptid)
static char *
thread_db_extra_thread_info (struct thread_info *info)
{
- if (info->private == NULL)
+ if (info->private_data == NULL)
return NULL;

- if (info->private->dying)
+ if (info->private_data->dying)
return "Exiting";

return NULL;
@@ -1794,7 +1794,7 @@ thread_db_get_thread_local_address (struct target_ops *ops,
/* Find the matching thread. */
thread_info = find_thread_ptid (ptid);

- if (thread_info != NULL && thread_info->private != NULL)
+ if (thread_info != NULL && thread_info->private_data != NULL)
{
td_err_e err;
psaddr_t address;
@@ -1814,7 +1814,7 @@ thread_db_get_thread_local_address (struct target_ops *ops,
/* Note the cast through uintptr_t: this interface only works if
a target address fits in a psaddr_t, which is a host pointer.
So a 32-bit debugger can not access 64-bit TLS through this. */
- err = info->td_thr_tls_get_addr_p (&thread_info->private->th,
+ err = info->td_thr_tls_get_addr_p (&thread_info->private_data->th,
(psaddr_t)(uintptr_t) lm,
offset, &address);

@@ -1857,7 +1857,7 @@ thread_db_find_thread_from_tid (struct thread_info *thread, void *data)
{
long *tid = (long *) data;

- if (thread->private->tid == *tid)
+ if (thread->private_data->tid == *tid)
return 1;

return 0;
diff --git a/gdb/nto-tdep.c b/gdb/nto-tdep.c
index 5ec746d..117443c 100644
--- a/gdb/nto-tdep.c
+++ b/gdb/nto-tdep.c
@@ -366,9 +366,9 @@ static const char *nto_thread_state_str[] =
char *
nto_extra_thread_info (struct thread_info *ti)
{
- if (ti && ti->private
- && ti->private->state < ARRAY_SIZE (nto_thread_state_str))
- return (char *)nto_thread_state_str [ti->private->state];
+ if (ti && ti->private_data
+ && ti->private_data->state < ARRAY_SIZE (nto_thread_state_str))
+ return (char *)nto_thread_state_str [ti->private_data->state];
return "";
}

diff --git a/gdb/remote.c b/gdb/remote.c
index a2e8a01..34c7edf 100644
--- a/gdb/remote.c
+++ b/gdb/remote.c
@@ -1657,15 +1657,15 @@ demand_private_info (ptid_t ptid)

gdb_assert (info);

- if (!info->private)
+ if (!info->private_data)
{
- info->private = xmalloc (sizeof (*(info->private)));
+ info->private_data = xmalloc (sizeof (*(info->private_data)));
info->private_dtor = free_private_thread_info;
- info->private->core = -1;
- info->private->extra = 0;
+ info->private_data->core = -1;
+ info->private_data->extra = 0;
}

- return info->private;
+ return info->private_data;
}

/* Call this function as a result of
@@ -2885,8 +2885,8 @@ remote_threads_extra_info (struct thread_info *tp)
{
struct thread_info *info = find_thread_ptid (tp->ptid);

- if (info && info->private)
- return info->private->extra;
+ if (info && info->private_data)
+ return info->private_data->extra;
else
return NULL;
}
@@ -11122,8 +11122,8 @@ remote_core_of_thread (struct target_ops *ops, ptid_t ptid)
{
struct thread_info *info = find_thread_ptid (ptid);

- if (info && info->private)
- return info->private->core;
+ if (info && info->private_data)
+ return info->private_data->core;
return -1;
}

diff --git a/gdb/thread.c b/gdb/thread.c
index 64a57c5..aae8cfb 100644
--- a/gdb/thread.c
+++ b/gdb/thread.c
@@ -139,12 +139,12 @@ clear_thread_inferior_resources (struct thread_info *tp)
static void
free_thread (struct thread_info *tp)
{
- if (tp->private)
+ if (tp->private_data)
{
if (tp->private_dtor)
- tp->private_dtor (tp->private);
+ tp->private_dtor (tp->private_data);
else
- xfree (tp->private);
+ xfree (tp->private_data);
}

xfree (tp->name);
@@ -244,11 +244,11 @@ add_thread_silent (ptid_t ptid)
}

struct thread_info *
-add_thread_with_info (ptid_t ptid, struct private_thread_info *private)
+add_thread_with_info (ptid_t ptid, struct private_thread_info *private_data)
{
struct thread_info *result = add_thread_silent (ptid);

- result->private = private;
+ result->private_data = private_data;

if (print_thread_events)
printf_unfiltered (_("[New %s]\n"), target_pid_to_str (ptid));
--
1.8.3.1