aboutsummaryrefslogtreecommitdiff
path: root/gdb/sol-thread.c
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/sol-thread.c')
-rw-r--r--gdb/sol-thread.c353
1 files changed, 168 insertions, 185 deletions
diff --git a/gdb/sol-thread.c b/gdb/sol-thread.c
index 8945c20..4f69e5b 100644
--- a/gdb/sol-thread.c
+++ b/gdb/sol-thread.c
@@ -69,17 +69,15 @@
#include "minsyms.h"
#include "objfiles.h"
-static const target_info thread_db_target_info = {
- "solaris-threads",
- N_("Solaris threads and pthread."),
- N_("Solaris threads and pthread support.")
-};
+static const target_info thread_db_target_info
+ = { "solaris-threads", N_ ("Solaris threads and pthread."),
+ N_ ("Solaris threads and pthread support.") };
class sol_thread_target final : public target_ops
{
public:
- const target_info &info () const override
- { return thread_db_target_info; }
+
+ const target_info &info () const override { return thread_db_target_info; }
strata stratum () const override { return thread_stratum; }
@@ -94,8 +92,7 @@ public:
void store_registers (struct regcache *, int) override;
enum target_xfer_status xfer_partial (enum target_object object,
- const char *annex,
- gdb_byte *readbuf,
+ const char *annex, gdb_byte *readbuf,
const gdb_byte *writebuf,
ULONGEST offset, ULONGEST len,
ULONGEST *xfered_len) override;
@@ -133,54 +130,53 @@ static int sol_thread_active = 0;
/* Types of the libthread_db functions. */
-typedef void (td_log_ftype)(const int on_off);
-typedef td_err_e (td_ta_new_ftype)(const struct ps_prochandle *ph_p,
- td_thragent_t **ta_pp);
-typedef td_err_e (td_ta_delete_ftype)(td_thragent_t *ta_p);
-typedef td_err_e (td_init_ftype)(void);
-typedef td_err_e (td_ta_get_ph_ftype)(const td_thragent_t *ta_p,
- struct ps_prochandle **ph_pp);
-typedef td_err_e (td_ta_get_nthreads_ftype)(const td_thragent_t *ta_p,
- int *nthread_p);
-typedef td_err_e (td_ta_tsd_iter_ftype)(const td_thragent_t *ta_p,
- td_key_iter_f *cb, void *cbdata_p);
-typedef td_err_e (td_ta_thr_iter_ftype)(const td_thragent_t *ta_p,
- td_thr_iter_f *cb, void *cbdata_p,
- td_thr_state_e state, int ti_pri,
- sigset_t *ti_sigmask_p,
- unsigned ti_user_flags);
-typedef td_err_e (td_thr_validate_ftype)(const td_thrhandle_t *th_p);
-typedef td_err_e (td_thr_tsd_ftype)(const td_thrhandle_t * th_p,
- const thread_key_t key, void **data_pp);
-typedef td_err_e (td_thr_get_info_ftype)(const td_thrhandle_t *th_p,
- td_thrinfo_t *ti_p);
-typedef td_err_e (td_thr_getfpregs_ftype)(const td_thrhandle_t *th_p,
- prfpregset_t *fpregset);
-typedef td_err_e (td_thr_getxregsize_ftype)(const td_thrhandle_t *th_p,
- int *xregsize);
-typedef td_err_e (td_thr_getxregs_ftype)(const td_thrhandle_t *th_p,
- const caddr_t xregset);
-typedef td_err_e (td_thr_sigsetmask_ftype)(const td_thrhandle_t *th_p,
- const sigset_t ti_sigmask);
-typedef td_err_e (td_thr_setprio_ftype)(const td_thrhandle_t *th_p,
- const int ti_pri);
-typedef td_err_e (td_thr_setsigpending_ftype)(const td_thrhandle_t *th_p,
- const uchar_t ti_pending_flag,
- const sigset_t ti_pending);
-typedef td_err_e (td_thr_setfpregs_ftype)(const td_thrhandle_t *th_p,
- const prfpregset_t *fpregset);
-typedef td_err_e (td_thr_setxregs_ftype)(const td_thrhandle_t *th_p,
- const caddr_t xregset);
-typedef td_err_e (td_ta_map_id2thr_ftype)(const td_thragent_t *ta_p,
- thread_t tid,
- td_thrhandle_t *th_p);
-typedef td_err_e (td_ta_map_lwp2thr_ftype)(const td_thragent_t *ta_p,
- lwpid_t lwpid,
- td_thrhandle_t *th_p);
-typedef td_err_e (td_thr_getgregs_ftype)(const td_thrhandle_t *th_p,
- prgregset_t regset);
-typedef td_err_e (td_thr_setgregs_ftype)(const td_thrhandle_t *th_p,
- const prgregset_t regset);
+typedef void (td_log_ftype) (const int on_off);
+typedef td_err_e (td_ta_new_ftype) (const struct ps_prochandle *ph_p,
+ td_thragent_t **ta_pp);
+typedef td_err_e (td_ta_delete_ftype) (td_thragent_t *ta_p);
+typedef td_err_e (td_init_ftype) (void);
+typedef td_err_e (td_ta_get_ph_ftype) (const td_thragent_t *ta_p,
+ struct ps_prochandle **ph_pp);
+typedef td_err_e (td_ta_get_nthreads_ftype) (const td_thragent_t *ta_p,
+ int *nthread_p);
+typedef td_err_e (td_ta_tsd_iter_ftype) (const td_thragent_t *ta_p,
+ td_key_iter_f *cb, void *cbdata_p);
+typedef td_err_e (td_ta_thr_iter_ftype) (const td_thragent_t *ta_p,
+ td_thr_iter_f *cb, void *cbdata_p,
+ td_thr_state_e state, int ti_pri,
+ sigset_t *ti_sigmask_p,
+ unsigned ti_user_flags);
+typedef td_err_e (td_thr_validate_ftype) (const td_thrhandle_t *th_p);
+typedef td_err_e (td_thr_tsd_ftype) (const td_thrhandle_t *th_p,
+ const thread_key_t key, void **data_pp);
+typedef td_err_e (td_thr_get_info_ftype) (const td_thrhandle_t *th_p,
+ td_thrinfo_t *ti_p);
+typedef td_err_e (td_thr_getfpregs_ftype) (const td_thrhandle_t *th_p,
+ prfpregset_t *fpregset);
+typedef td_err_e (td_thr_getxregsize_ftype) (const td_thrhandle_t *th_p,
+ int *xregsize);
+typedef td_err_e (td_thr_getxregs_ftype) (const td_thrhandle_t *th_p,
+ const caddr_t xregset);
+typedef td_err_e (td_thr_sigsetmask_ftype) (const td_thrhandle_t *th_p,
+ const sigset_t ti_sigmask);
+typedef td_err_e (td_thr_setprio_ftype) (const td_thrhandle_t *th_p,
+ const int ti_pri);
+typedef td_err_e (td_thr_setsigpending_ftype) (const td_thrhandle_t *th_p,
+ const uchar_t ti_pending_flag,
+ const sigset_t ti_pending);
+typedef td_err_e (td_thr_setfpregs_ftype) (const td_thrhandle_t *th_p,
+ const prfpregset_t *fpregset);
+typedef td_err_e (td_thr_setxregs_ftype) (const td_thrhandle_t *th_p,
+ const caddr_t xregset);
+typedef td_err_e (td_ta_map_id2thr_ftype) (const td_thragent_t *ta_p,
+ thread_t tid, td_thrhandle_t *th_p);
+typedef td_err_e (td_ta_map_lwp2thr_ftype) (const td_thragent_t *ta_p,
+ lwpid_t lwpid,
+ td_thrhandle_t *th_p);
+typedef td_err_e (td_thr_getgregs_ftype) (const td_thrhandle_t *th_p,
+ prgregset_t regset);
+typedef td_err_e (td_thr_setgregs_ftype) (const td_thrhandle_t *th_p,
+ const prgregset_t regset);
/* Pointers to routines from libthread_db resolved by dlopen(). */
@@ -207,7 +203,6 @@ static td_ta_map_id2thr_ftype *p_td_ta_map_id2thr;
static td_ta_map_lwp2thr_ftype *p_td_ta_map_lwp2thr;
static td_thr_getgregs_ftype *p_td_thr_getgregs;
static td_thr_setgregs_ftype *p_td_thr_setgregs;
-
/* Return the libthread_db error string associated with ERRCODE. If
ERRCODE is unknown, return an appropriate message. */
@@ -215,30 +210,28 @@ static td_thr_setgregs_ftype *p_td_thr_setgregs;
static const char *
td_err_string (td_err_e errcode)
{
- static struct string_map td_err_table[] =
- {
- { TD_OK, "generic \"call succeeded\"" },
- { TD_ERR, "generic error." },
- { TD_NOTHR, "no thread can be found to satisfy query" },
- { TD_NOSV, "no synch. variable can be found to satisfy query" },
- { TD_NOLWP, "no lwp can be found to satisfy query" },
- { TD_BADPH, "invalid process handle" },
- { TD_BADTH, "invalid thread handle" },
- { TD_BADSH, "invalid synchronization handle" },
- { TD_BADTA, "invalid thread agent" },
- { TD_BADKEY, "invalid key" },
- { TD_NOMSG, "td_thr_event_getmsg() called when there was no message" },
- { TD_NOFPREGS, "FPU register set not available for given thread" },
- { TD_NOLIBTHREAD, "application not linked with libthread" },
- { TD_NOEVENT, "requested event is not supported" },
- { TD_NOCAPAB, "capability not available" },
- { TD_DBERR, "Debugger service failed" },
- { TD_NOAPLIC, "Operation not applicable to" },
- { TD_NOTSD, "No thread specific data for this thread" },
- { TD_MALLOC, "Malloc failed" },
- { TD_PARTIALREG, "Only part of register set was written/read" },
- { TD_NOXREGS, "X register set not available for given thread" }
- };
+ static struct string_map td_err_table[]
+ = { { TD_OK, "generic \"call succeeded\"" },
+ { TD_ERR, "generic error." },
+ { TD_NOTHR, "no thread can be found to satisfy query" },
+ { TD_NOSV, "no synch. variable can be found to satisfy query" },
+ { TD_NOLWP, "no lwp can be found to satisfy query" },
+ { TD_BADPH, "invalid process handle" },
+ { TD_BADTH, "invalid thread handle" },
+ { TD_BADSH, "invalid synchronization handle" },
+ { TD_BADTA, "invalid thread agent" },
+ { TD_BADKEY, "invalid key" },
+ { TD_NOMSG, "td_thr_event_getmsg() called when there was no message" },
+ { TD_NOFPREGS, "FPU register set not available for given thread" },
+ { TD_NOLIBTHREAD, "application not linked with libthread" },
+ { TD_NOEVENT, "requested event is not supported" },
+ { TD_NOCAPAB, "capability not available" },
+ { TD_DBERR, "Debugger service failed" },
+ { TD_NOAPLIC, "Operation not applicable to" },
+ { TD_NOTSD, "No thread specific data for this thread" },
+ { TD_MALLOC, "Malloc failed" },
+ { TD_PARTIALREG, "Only part of register set was written/read" },
+ { TD_NOXREGS, "X register set not available for given thread" } };
const int td_err_size = sizeof td_err_table / sizeof (struct string_map);
int i;
static char buf[50];
@@ -259,19 +252,17 @@ td_err_string (td_err_e errcode)
static const char *
td_state_string (td_thr_state_e statecode)
{
- static struct string_map td_thr_state_table[] =
- {
- { TD_THR_ANY_STATE, "any state" },
- { TD_THR_UNKNOWN, "unknown" },
- { TD_THR_STOPPED, "stopped" },
- { TD_THR_RUN, "run" },
- { TD_THR_ACTIVE, "active" },
- { TD_THR_ZOMBIE, "zombie" },
- { TD_THR_SLEEP, "sleep" },
- { TD_THR_STOPPED_ASLEEP, "stopped asleep" }
- };
- const int td_thr_state_table_size =
- sizeof td_thr_state_table / sizeof (struct string_map);
+ static struct string_map td_thr_state_table[]
+ = { { TD_THR_ANY_STATE, "any state" },
+ { TD_THR_UNKNOWN, "unknown" },
+ { TD_THR_STOPPED, "stopped" },
+ { TD_THR_RUN, "run" },
+ { TD_THR_ACTIVE, "active" },
+ { TD_THR_ZOMBIE, "zombie" },
+ { TD_THR_SLEEP, "sleep" },
+ { TD_THR_STOPPED_ASLEEP, "stopped asleep" } };
+ const int td_thr_state_table_size
+ = sizeof td_thr_state_table / sizeof (struct string_map);
int i;
static char buf[50];
@@ -284,7 +275,6 @@ td_state_string (td_thr_state_e statecode)
return buf;
}
-
/* Convert a POSIX or Solaris thread ID into a LWP ID. If THREAD_ID
doesn't exist, that's an error. If it's an inactive thread, return
@@ -300,27 +290,27 @@ thread_to_lwp (ptid_t thread_id, int default_lwp)
td_err_e val;
if (thread_id.lwp_p ())
- return thread_id; /* It's already an LWP ID. */
+ return thread_id; /* It's already an LWP ID. */
/* It's a thread. Convert to LWP. */
val = p_td_ta_map_id2thr (main_ta, thread_id.tid (), &th);
if (val == TD_NOTHR)
- return ptid_t (-1); /* Thread must have terminated. */
+ return ptid_t (-1); /* Thread must have terminated. */
else if (val != TD_OK)
- error (_("thread_to_lwp: td_ta_map_id2thr %s"), td_err_string (val));
+ error (_ ("thread_to_lwp: td_ta_map_id2thr %s"), td_err_string (val));
val = p_td_thr_get_info (&th, &ti);
if (val == TD_NOTHR)
- return ptid_t (-1); /* Thread must have terminated. */
+ return ptid_t (-1); /* Thread must have terminated. */
else if (val != TD_OK)
- error (_("thread_to_lwp: td_thr_get_info: %s"), td_err_string (val));
+ error (_ ("thread_to_lwp: td_thr_get_info: %s"), td_err_string (val));
if (ti.ti_state != TD_THR_ACTIVE)
{
if (default_lwp != -1)
return ptid_t (default_lwp);
- error (_("thread_to_lwp: thread state not active: %s"),
+ error (_ ("thread_to_lwp: thread state not active: %s"),
td_state_string (ti.ti_state));
}
@@ -340,34 +330,33 @@ lwp_to_thread (ptid_t lwp)
td_err_e val;
if (lwp.tid_p ())
- return lwp; /* It's already a thread ID. */
+ return lwp; /* It's already a thread ID. */
/* It's an LWP. Convert it to a thread ID. */
if (!target_thread_alive (lwp))
- return ptid_t (-1); /* Must be a defunct LPW. */
+ return ptid_t (-1); /* Must be a defunct LPW. */
val = p_td_ta_map_lwp2thr (main_ta, lwp.lwp (), &th);
if (val == TD_NOTHR)
- return ptid_t (-1); /* Thread must have terminated. */
+ return ptid_t (-1); /* Thread must have terminated. */
else if (val != TD_OK)
- error (_("lwp_to_thread: td_ta_map_lwp2thr: %s."), td_err_string (val));
+ error (_ ("lwp_to_thread: td_ta_map_lwp2thr: %s."), td_err_string (val));
val = p_td_thr_validate (&th);
if (val == TD_NOTHR)
- return lwp; /* Unknown to libthread; just return LPW, */
+ return lwp; /* Unknown to libthread; just return LPW, */
else if (val != TD_OK)
- error (_("lwp_to_thread: td_thr_validate: %s."), td_err_string (val));
+ error (_ ("lwp_to_thread: td_thr_validate: %s."), td_err_string (val));
val = p_td_thr_get_info (&th, &ti);
if (val == TD_NOTHR)
- return ptid_t (-1); /* Thread must have terminated. */
+ return ptid_t (-1); /* Thread must have terminated. */
else if (val != TD_OK)
- error (_("lwp_to_thread: td_thr_get_info: %s."), td_err_string (val));
+ error (_ ("lwp_to_thread: td_thr_get_info: %s."), td_err_string (val));
- return ptid_t (lwp.pid (), 0 , ti.ti_tid);
+ return ptid_t (lwp.pid (), 0, ti.ti_tid);
}
-
/* Most target vector functions from here on actually just pass
through to the layer beneath, as they don't need to do anything
@@ -410,10 +399,10 @@ sol_thread_target::resume (ptid_t ptid, int step, enum gdb_signal signo)
ptid_t save_ptid = ptid;
ptid = thread_to_lwp (ptid, -2);
- if (ptid.pid () == -2) /* Inactive thread. */
- error (_("This version of Solaris can't start inactive threads."));
+ if (ptid.pid () == -2) /* Inactive thread. */
+ error (_ ("This version of Solaris can't start inactive threads."));
if (info_verbose && ptid.pid () == -1)
- warning (_("Specified thread %s seems to have terminated"),
+ warning (_ ("Specified thread %s seems to have terminated"),
pulongest (save_ptid.tid ()));
}
@@ -432,10 +421,10 @@ sol_thread_target::wait (ptid_t ptid, struct target_waitstatus *ourstatus,
ptid_t ptid_for_warning = ptid;
ptid = thread_to_lwp (ptid, -2);
- if (ptid.pid () == -2) /* Inactive thread. */
- error (_("This version of Solaris can't start inactive threads."));
+ if (ptid.pid () == -2) /* Inactive thread. */
+ error (_ ("This version of Solaris can't start inactive threads."));
if (info_verbose && ptid.pid () == -1)
- warning (_("Specified thread %s seems to have terminated"),
+ warning (_ ("Specified thread %s seems to have terminated"),
pulongest (ptid_for_warning.tid ()));
}
@@ -490,18 +479,18 @@ sol_thread_target::fetch_registers (struct regcache *regcache, int regnum)
/* Solaris thread: convert PTID into a td_thrhandle_t. */
thread = ptid.tid ();
if (thread == 0)
- error (_("sol_thread_fetch_registers: thread == 0"));
+ error (_ ("sol_thread_fetch_registers: thread == 0"));
val = p_td_ta_map_id2thr (main_ta, thread, &thandle);
if (val != TD_OK)
- error (_("sol_thread_fetch_registers: td_ta_map_id2thr: %s"),
+ error (_ ("sol_thread_fetch_registers: td_ta_map_id2thr: %s"),
td_err_string (val));
/* Get the general-purpose registers. */
val = p_td_thr_getgregs (&thandle, gregset);
if (val != TD_OK && val != TD_PARTIALREG)
- error (_("sol_thread_fetch_registers: td_thr_getgregs %s"),
+ error (_ ("sol_thread_fetch_registers: td_thr_getgregs %s"),
td_err_string (val));
/* For SPARC, TD_PARTIALREG means that only %i0...%i7, %l0..%l7, %pc
@@ -511,7 +500,7 @@ sol_thread_target::fetch_registers (struct regcache *regcache, int regnum)
val = p_td_thr_getfpregs (&thandle, &fpregset);
if (val != TD_OK && val != TD_NOFPREGS)
- error (_("sol_thread_fetch_registers: td_thr_getfpregs %s"),
+ error (_ ("sol_thread_fetch_registers: td_thr_getfpregs %s"),
td_err_string (val));
/* Note that we must call supply_gregset and supply_fpregset *after*
@@ -544,18 +533,18 @@ sol_thread_target::store_registers (struct regcache *regcache, int regnum)
val = p_td_ta_map_id2thr (main_ta, thread, &thandle);
if (val != TD_OK)
- error (_("sol_thread_store_registers: td_ta_map_id2thr %s"),
+ error (_ ("sol_thread_store_registers: td_ta_map_id2thr %s"),
td_err_string (val));
if (regnum != -1)
{
val = p_td_thr_getgregs (&thandle, gregset);
if (val != TD_OK)
- error (_("sol_thread_store_registers: td_thr_getgregs %s"),
+ error (_ ("sol_thread_store_registers: td_thr_getgregs %s"),
td_err_string (val));
val = p_td_thr_getfpregs (&thandle, &fpregset);
if (val != TD_OK)
- error (_("sol_thread_store_registers: td_thr_getfpregs %s"),
+ error (_ ("sol_thread_store_registers: td_thr_getfpregs %s"),
td_err_string (val));
}
@@ -564,11 +553,11 @@ sol_thread_target::store_registers (struct regcache *regcache, int regnum)
val = p_td_thr_setgregs (&thandle, gregset);
if (val != TD_OK)
- error (_("sol_thread_store_registers: td_thr_setgregs %s"),
+ error (_ ("sol_thread_store_registers: td_thr_setgregs %s"),
td_err_string (val));
val = p_td_thr_setfpregs (&thandle, &fpregset);
if (val != TD_OK)
- error (_("sol_thread_store_registers: td_thr_setfpregs %s"),
+ error (_ ("sol_thread_store_registers: td_thr_setfpregs %s"),
td_err_string (val));
}
@@ -577,9 +566,8 @@ sol_thread_target::store_registers (struct regcache *regcache, int regnum)
one, of readbuf or writebuf must be non-NULL. */
enum target_xfer_status
-sol_thread_target::xfer_partial (enum target_object object,
- const char *annex, gdb_byte *readbuf,
- const gdb_byte *writebuf,
+sol_thread_target::xfer_partial (enum target_object object, const char *annex,
+ gdb_byte *readbuf, const gdb_byte *writebuf,
ULONGEST offset, ULONGEST len,
ULONGEST *xfered_len)
{
@@ -595,8 +583,8 @@ sol_thread_target::xfer_partial (enum target_object object,
inferior_ptid = procfs_first_available ();
}
- return beneath ()->xfer_partial (object, annex, readbuf,
- writebuf, offset, len, xfered_len);
+ return beneath ()->xfer_partial (object, annex, readbuf, writebuf, offset,
+ len, xfered_len);
}
static void
@@ -625,7 +613,7 @@ check_for_thread_db (void)
err = p_td_init ();
if (err != TD_OK)
{
- warning (_("sol_thread_new_objfile: td_init: %s"), td_err_string (err));
+ warning (_ ("sol_thread_new_objfile: td_init: %s"), td_err_string (err));
return;
}
@@ -638,7 +626,7 @@ check_for_thread_db (void)
break;
case TD_OK:
- gdb_printf (_("[Thread debugging using libthread_db enabled]\n"));
+ gdb_printf (_ ("[Thread debugging using libthread_db enabled]\n"));
/* The thread library was detected. Activate the sol_thread target. */
current_inferior ()->push_target (&sol_thread_ops);
@@ -653,7 +641,7 @@ check_for_thread_db (void)
break;
default:
- warning (_("Cannot initialize thread debugging library: %s"),
+ warning (_ ("Cannot initialize thread debugging library: %s"),
td_err_string (err));
break;
}
@@ -701,11 +689,11 @@ sol_thread_target::thread_alive (ptid_t ptid)
pid = ptid.tid ();
val = p_td_ta_map_id2thr (main_ta, pid, &th);
if (val != TD_OK)
- return false; /* Thread not found. */
+ return false; /* Thread not found. */
val = p_td_thr_validate (&th);
if (val != TD_OK)
- return false; /* Thread not valid. */
- return true; /* Known thread. */
+ return false; /* Thread not valid. */
+ return true; /* Known thread. */
}
else
{
@@ -714,7 +702,6 @@ sol_thread_target::thread_alive (ptid_t ptid)
}
}
-
/* These routines implement the lower half of the thread_db interface,
i.e. the ps_* routines. */
@@ -791,7 +778,7 @@ rw_common (int dowrite, const struct ps_prochandle *ph, psaddr_t addr,
inferior_ptid = procfs_first_available ();
}
-#if defined (__sparcv9)
+#if defined(__sparcv9)
/* For Sparc64 cross Sparc32, make sure the address has not been
accidentally sign-extended (or whatever) to beyond 32 bits. */
if (bfd_get_arch_size (current_program_space->exec_bfd ()) == 32)
@@ -817,8 +804,8 @@ ps_pdread (struct ps_prochandle *ph, psaddr_t addr, void *buf, size_t size)
/* Copies SIZE bytes from debugger memory .data segment to target process. */
ps_err_e
-ps_pdwrite (struct ps_prochandle *ph, psaddr_t addr,
- const void *buf, size_t size)
+ps_pdwrite (struct ps_prochandle *ph, psaddr_t addr, const void *buf,
+ size_t size)
{
return rw_common (1, ph, addr, (gdb_byte *) buf, size);
}
@@ -834,8 +821,8 @@ ps_ptread (struct ps_prochandle *ph, psaddr_t addr, void *buf, size_t size)
/* Copies SIZE bytes from debugger memory .text segment to target process. */
ps_err_e
-ps_ptwrite (struct ps_prochandle *ph, psaddr_t addr,
- const void *buf, size_t size)
+ps_ptwrite (struct ps_prochandle *ph, psaddr_t addr, const void *buf,
+ size_t size)
{
return rw_common (1, ph, addr, (gdb_byte *) buf, size);
}
@@ -847,8 +834,8 @@ ps_lgetregs (struct ps_prochandle *ph, lwpid_t lwpid, prgregset_t gregset)
{
ptid_t ptid = ptid_t (current_inferior ()->pid, lwpid, 0);
struct regcache *regcache
- = get_thread_arch_regcache (current_inferior ()->process_target (),
- ptid, target_gdbarch ());
+ = get_thread_arch_regcache (current_inferior ()->process_target (), ptid,
+ target_gdbarch ());
target_fetch_registers (regcache, -1);
fill_gregset (regcache, (gdb_gregset_t *) gregset, -1);
@@ -864,8 +851,8 @@ ps_lsetregs (struct ps_prochandle *ph, lwpid_t lwpid,
{
ptid_t ptid = ptid_t (current_inferior ()->pid, lwpid, 0);
struct regcache *regcache
- = get_thread_arch_regcache (current_inferior ()->process_target (),
- ptid, target_gdbarch ());
+ = get_thread_arch_regcache (current_inferior ()->process_target (), ptid,
+ target_gdbarch ());
supply_gregset (regcache, (const gdb_gregset_t *) gregset);
target_store_registers (regcache, -1);
@@ -912,13 +899,12 @@ ps_lsetxregs (struct ps_prochandle *ph, lwpid_t lwpid, caddr_t xregset)
/* Get floating-point registers for LWP. */
ps_err_e
-ps_lgetfpregs (struct ps_prochandle *ph, lwpid_t lwpid,
- prfpregset_t *fpregset)
+ps_lgetfpregs (struct ps_prochandle *ph, lwpid_t lwpid, prfpregset_t *fpregset)
{
ptid_t ptid = ptid_t (current_inferior ()->pid, lwpid, 0);
struct regcache *regcache
- = get_thread_arch_regcache (current_inferior ()->process_target (),
- ptid, target_gdbarch ());
+ = get_thread_arch_regcache (current_inferior ()->process_target (), ptid,
+ target_gdbarch ());
target_fetch_registers (regcache, -1);
fill_fpregset (regcache, (gdb_fpregset_t *) fpregset, -1);
@@ -930,12 +916,12 @@ ps_lgetfpregs (struct ps_prochandle *ph, lwpid_t lwpid,
ps_err_e
ps_lsetfpregs (struct ps_prochandle *ph, lwpid_t lwpid,
- const prfpregset_t * fpregset)
+ const prfpregset_t *fpregset)
{
ptid_t ptid = ptid_t (current_inferior ()->pid, lwpid, 0);
struct regcache *regcache
- = get_thread_arch_regcache (current_inferior ()->process_target (),
- ptid, target_gdbarch ());
+ = get_thread_arch_regcache (current_inferior ()->process_target (), ptid,
+ target_gdbarch ());
supply_fpregset (regcache, (const gdb_fpregset_t *) fpregset);
target_store_registers (regcache, -1);
@@ -959,7 +945,6 @@ ps_pdmodel (struct ps_prochandle *ph, int *data_model)
return PS_OK;
}
-
/* Convert PTID to printable form. */
@@ -973,21 +958,18 @@ sol_thread_target::pid_to_str (ptid_t ptid)
lwp = thread_to_lwp (ptid, -2);
if (lwp.pid () == -1)
- return string_printf ("Thread %s (defunct)",
- pulongest (ptid.tid ()));
+ return string_printf ("Thread %s (defunct)", pulongest (ptid.tid ()));
else if (lwp.pid () != -2)
- return string_printf ("Thread %s (LWP %ld)",
- pulongest (ptid.tid ()), lwp.lwp ());
+ return string_printf ("Thread %s (LWP %ld)", pulongest (ptid.tid ()),
+ lwp.lwp ());
else
- return string_printf ("Thread %s ",
- pulongest (ptid.tid ()));
+ return string_printf ("Thread %s ", pulongest (ptid.tid ()));
}
else if (ptid.lwp () != 0)
return string_printf ("LWP %ld ", ptid.lwp ());
else
return string_printf ("process %d ", ptid.pid ());
}
-
/* Worker bee for update_thread_list. Callback function that gets
called once per user-level thread (i.e. not for LWP's). */
@@ -1025,8 +1007,8 @@ sol_thread_target::update_thread_list ()
/* Then find any new user-level threads. */
p_td_ta_thr_iter (main_ta, sol_update_thread_list_callback, (void *) 0,
- TD_THR_ANY_STATE, TD_THR_LOWEST_PRIORITY,
- TD_SIGNO_MASK, TD_THR_ANY_USER_FLAGS);
+ TD_THR_ANY_STATE, TD_THR_LOWEST_PRIORITY, TD_SIGNO_MASK,
+ TD_THR_ANY_USER_FLAGS);
}
/* Worker bee for the "info sol-thread" command. This is a callback
@@ -1044,8 +1026,8 @@ info_cb (const td_thrhandle_t *th, void *s)
if (ret == TD_OK)
{
gdb_printf ("%s thread #%d, lwp %d, ",
- ti.ti_type == TD_THR_SYSTEM ? "system" : "user ",
- ti.ti_tid, ti.ti_lid);
+ ti.ti_type == TD_THR_SYSTEM ? "system" : "user ", ti.ti_tid,
+ ti.ti_lid);
switch (ti.ti_state)
{
default:
@@ -1079,8 +1061,8 @@ info_cb (const td_thrhandle_t *th, void *s)
gdb_printf (" startfunc=%s",
msym.minsym
- ? msym.minsym->print_name ()
- : paddress (target_gdbarch (), ti.ti_startfunc));
+ ? msym.minsym->print_name ()
+ : paddress (target_gdbarch (), ti.ti_startfunc));
}
/* If thread is asleep, print function that went to sleep. */
@@ -1090,15 +1072,14 @@ info_cb (const td_thrhandle_t *th, void *s)
= lookup_minimal_symbol_by_pc (ti.ti_pc);
gdb_printf (" sleepfunc=%s",
- msym.minsym
- ? msym.minsym->print_name ()
- : paddress (target_gdbarch (), ti.ti_pc));
+ msym.minsym ? msym.minsym->print_name ()
+ : paddress (target_gdbarch (), ti.ti_pc));
}
gdb_printf ("\n");
}
else
- warning (_("info sol-thread: failed to get info for thread."));
+ warning (_ ("info sol-thread: failed to get info for thread."));
return 0;
}
@@ -1109,9 +1090,9 @@ info_cb (const td_thrhandle_t *th, void *s)
static void
info_solthreads (const char *args, int from_tty)
{
- p_td_ta_thr_iter (main_ta, info_cb, (void *) args,
- TD_THR_ANY_STATE, TD_THR_LOWEST_PRIORITY,
- TD_SIGNO_MASK, TD_THR_ANY_USER_FLAGS);
+ p_td_ta_thr_iter (main_ta, info_cb, (void *) args, TD_THR_ANY_STATE,
+ TD_THR_LOWEST_PRIORITY, TD_SIGNO_MASK,
+ TD_THR_ANY_USER_FLAGS);
}
/* Callback routine used to find a thread based on the TID part of
@@ -1131,16 +1112,16 @@ thread_db_find_thread_from_tid (struct thread_info *thread, void *data)
ptid_t
sol_thread_target::get_ada_task_ptid (long lwp, ULONGEST thread)
{
- struct thread_info *thread_info =
- iterate_over_threads (thread_db_find_thread_from_tid, &thread);
+ struct thread_info *thread_info
+ = iterate_over_threads (thread_db_find_thread_from_tid, &thread);
if (thread_info == NULL)
{
/* The list of threads is probably not up to date. Find any
thread that is missing from the list, and try again. */
update_thread_list ();
- thread_info = iterate_over_threads (thread_db_find_thread_from_tid,
- &thread);
+ thread_info
+ = iterate_over_threads (thread_db_find_thread_from_tid, &thread);
}
gdb_assert (thread_info != NULL);
@@ -1149,6 +1130,7 @@ sol_thread_target::get_ada_task_ptid (long lwp, ULONGEST thread)
}
void _initialize_sol_thread ();
+
void
_initialize_sol_thread ()
{
@@ -1158,8 +1140,8 @@ _initialize_sol_thread ()
if (!dlhandle)
goto die;
-#define resolve(X) \
- if (!(p_##X = (X ## _ftype *) dlsym (dlhandle, #X))) \
+#define resolve(X) \
+ if (!(p_##X = (X##_ftype *) dlsym (dlhandle, #X))) \
goto die;
resolve (td_log);
@@ -1187,15 +1169,16 @@ _initialize_sol_thread ()
resolve (td_thr_setgregs);
add_cmd ("sol-threads", class_maintenance, info_solthreads,
- _("Show info on Solaris user threads."), &maintenanceinfolist);
+ _ ("Show info on Solaris user threads."), &maintenanceinfolist);
/* Hook into new_objfile notification. */
gdb::observers::new_objfile.attach (sol_thread_new_objfile, "sol-thread");
return;
- die:
+die:
gdb_printf (gdb_stderr, "\
-[GDB will not be able to debug user-mode threads: %s]\n", dlerror ());
+[GDB will not be able to debug user-mode threads: %s]\n",
+ dlerror ());
if (dlhandle)
dlclose (dlhandle);