aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gdb/ChangeLog35
-rw-r--r--gdb/defs.h10
-rw-r--r--gdb/procfs.c23
-rw-r--r--gdb/sol-thread.c128
-rw-r--r--gdb/top.c2
5 files changed, 127 insertions, 71 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 1f58821..10d6866 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,38 @@
+2016-10-25 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
+
+ PR build/20712
+ * defs.h: Remove obsolete comment
+ (atof): Remove.
+ * procfs.c (do_destroy_procinfo_cleanup): Add cast.
+ (sysset_t_alloc): Likewise.
+ (proc_set_traced_sysentry): Likewise.
+ (proc_set_traced_sysexit): Likewise.
+ [!PIOCLSTATUS && NEW_PROC_API] (do_closedir_cleanup): Likewise.
+ (proc_get_LDT_entry): Initiate cleanups before returns.
+ (procfs_wait): Use GDB_SIGNAL_0.
+ (procfs_corefile_thread_callback): Add cast.
+ * sol-thread.c (td_log_ftype, td_ta_new_ftype, td_ta_delete_ftype)
+ (td_init_ftype, td_ta_get_ph_ftype, td_ta_get_nthreads_ftype)
+ (td_ta_tsd_iter_ftype, td_ta_thr_iter_ftype)
+ (td_thr_validate_ftype, td_thr_tsd_ftype, td_thr_get_info_ftype)
+ (td_thr_getfpregs_ftype, td_thr_getxregsize_ftype)
+ (td_thr_getxregs_ftype, td_thr_sigsetmask_ftype)
+ (td_thr_setprio_ftype, td_thr_setsigpending_ftype)
+ (td_thr_setfpregs_ftype, td_thr_setxregs_ftype)
+ (td_ta_map_id2thr_ftype, td_ta_map_lwp2thr_ftype)
+ (td_thr_getgregs_ftype, td_thr_setgregs_ftype): New typedefs.
+ (p_td_log, p_td_ta_new, p_td_ta_delete, p_td_init, p_td_ta_get_ph)
+ (p_td_ta_get_nthreads, p_td_ta_tsd_iter, p_td_ta_thr_iter)
+ (p_td_thr_validate, p_td_thr_tsd, p_td_thr_get_info)
+ (p_td_thr_getfpregs, p_td_thr_getxregsize, p_td_thr_getxregs)
+ (p_td_thr_sigsetmask, p_td_thr_setprio, p_td_thr_setsigpending)
+ (p_td_thr_setfpregs, p_td_thr_setxregs, p_td_ta_map_id2thr)
+ (p_td_ta_map_lwp2thr, p_td_thr_getgregs, p_td_thr_setgregs): Use them.
+ (ps_pdread): Add cast.
+ (ps_ptread): Likewise.
+ (resolve): Likewise.
+ * top.c (gdb_safe_append_history): Print pid_t as long.
+
2016-10-25 Pedro Alves <palves@redhat.com>
* common/common-defs.h (__STDC_FORMAT_MACROS): Define.
diff --git a/gdb/defs.h b/gdb/defs.h
index 5322648..1e595d3 100644
--- a/gdb/defs.h
+++ b/gdb/defs.h
@@ -612,16 +612,6 @@ enum gdb_osabi
GDB_OSABI_INVALID /* keep this last */
};
-/* Global functions from other, non-gdb GNU thingies.
- Libiberty thingies are no longer declared here. We include libiberty.h
- above, instead. */
-
-/* From other system libraries */
-
-#ifndef atof
-extern double atof (const char *); /* X3.159-1989 4.10.1.1 */
-#endif
-
/* Enumerate the requirements a symbol has in order to be evaluated.
These are listed in order of "strength" -- a later entry subsumes
earlier ones. This fine-grained distinction is important because
diff --git a/gdb/procfs.c b/gdb/procfs.c
index fab15ed..ff814ba 100644
--- a/gdb/procfs.c
+++ b/gdb/procfs.c
@@ -791,7 +791,7 @@ destroy_procinfo (procinfo *pi)
static void
do_destroy_procinfo_cleanup (void *pi)
{
- destroy_procinfo (pi);
+ destroy_procinfo ((procinfo *) pi);
}
enum { NOKILL, KILL };
@@ -845,7 +845,7 @@ sysset_t_alloc (procinfo * pi)
sysset_t *ret;
int size = sysset_t_size (pi);
- ret = xmalloc (size);
+ ret = (sysset_t *) xmalloc (size);
#ifdef DYNAMIC_SYSCALLS
ret->pr_size = ((pi->num_syscalls + (8 * sizeof (uint64_t) - 1))
/ (8 * sizeof (uint64_t)));
@@ -1675,7 +1675,7 @@ proc_set_traced_sysentry (procinfo *pi, sysset_t *sysset)
- sizeof (sysset_t)
+ sysset_t_size (pi);
- argp = xmalloc (argp_size);
+ argp = (struct gdb_proc_ctl_pcsentry *) xmalloc (argp_size);
argp->cmd = PCSENTRY;
memcpy (&argp->sysset, sysset, sysset_t_size (pi));
@@ -1720,7 +1720,7 @@ proc_set_traced_sysexit (procinfo *pi, sysset_t *sysset)
- sizeof (sysset_t)
+ sysset_t_size (pi);
- argp = xmalloc (argp_size);
+ argp = (struct gdb_proc_ctl_pcsexit *) xmalloc (argp_size);
argp->cmd = PCSEXIT;
memcpy (&argp->sysset, sysset, sysset_t_size (pi));
@@ -2512,9 +2512,13 @@ proc_get_LDT_entry (procinfo *pi, int key)
break; /* end of table */
/* If key matches, return this entry. */
if (ldt_entry->sel == key)
- return ldt_entry;
+ {
+ do_cleanups (old_chain);
+ return ldt_entry;
+ }
}
/* Loop ended, match not found. */
+ do_cleanups (old_chain);
return NULL;
#else
int nldt, i;
@@ -2756,7 +2760,7 @@ proc_update_threads (procinfo *pi)
static void
do_closedir_cleanup (void *dir)
{
- closedir (dir);
+ closedir ((DIR *) dir);
}
static int
@@ -3836,7 +3840,7 @@ wait_again:
add_thread (temp_ptid);
status->kind = TARGET_WAITKIND_STOPPED;
- status->value.sig = 0;
+ status->value.sig = GDB_SIGNAL_0;
return retval;
}
#endif
@@ -4567,7 +4571,7 @@ procfs_create_inferior (struct target_ops *ops, char *exec_file,
if (path == NULL)
path = "/bin:/usr/bin";
- tryname = alloca (strlen (path) + strlen (shell_file) + 2);
+ tryname = (char *) alloca (strlen (path) + strlen (shell_file) + 2);
for (p = path; p != NULL; p = p1 ? p1 + 1: NULL)
{
p1 = strchr (p, ':');
@@ -5367,7 +5371,8 @@ struct procfs_corefile_thread_data {
static int
procfs_corefile_thread_callback (procinfo *pi, procinfo *thread, void *data)
{
- struct procfs_corefile_thread_data *args = data;
+ struct procfs_corefile_thread_data *args
+ = (struct procfs_corefile_thread_data *) data;
if (pi != NULL)
{
diff --git a/gdb/sol-thread.c b/gdb/sol-thread.c
index 000d223..85bf3ff 100644
--- a/gdb/sol-thread.c
+++ b/gdb/sol-thread.c
@@ -98,56 +98,82 @@ static void init_sol_thread_ops (void);
/* Default definitions: These must be defined in tm.h if they are to
be shared with a process module such as procfs. */
+/* 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);
+
/* Pointers to routines from libthread_db resolved by dlopen(). */
-static void (*p_td_log)(const int on_off);
-static td_err_e (*p_td_ta_new)(const struct ps_prochandle *ph_p,
- td_thragent_t **ta_pp);
-static td_err_e (*p_td_ta_delete)(td_thragent_t *ta_p);
-static td_err_e (*p_td_init)(void);
-static td_err_e (*p_td_ta_get_ph)(const td_thragent_t *ta_p,
- struct ps_prochandle **ph_pp);
-static td_err_e (*p_td_ta_get_nthreads)(const td_thragent_t *ta_p,
- int *nthread_p);
-static td_err_e (*p_td_ta_tsd_iter)(const td_thragent_t *ta_p,
- td_key_iter_f *cb, void *cbdata_p);
-static td_err_e (*p_td_ta_thr_iter)(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);
-static td_err_e (*p_td_thr_validate)(const td_thrhandle_t *th_p);
-static td_err_e (*p_td_thr_tsd)(const td_thrhandle_t * th_p,
- const thread_key_t key, void **data_pp);
-static td_err_e (*p_td_thr_get_info)(const td_thrhandle_t *th_p,
- td_thrinfo_t *ti_p);
-static td_err_e (*p_td_thr_getfpregs)(const td_thrhandle_t *th_p,
- prfpregset_t *fpregset);
-static td_err_e (*p_td_thr_getxregsize)(const td_thrhandle_t *th_p,
- int *xregsize);
-static td_err_e (*p_td_thr_getxregs)(const td_thrhandle_t *th_p,
- const caddr_t xregset);
-static td_err_e (*p_td_thr_sigsetmask)(const td_thrhandle_t *th_p,
- const sigset_t ti_sigmask);
-static td_err_e (*p_td_thr_setprio)(const td_thrhandle_t *th_p,
- const int ti_pri);
-static td_err_e (*p_td_thr_setsigpending)(const td_thrhandle_t *th_p,
- const uchar_t ti_pending_flag,
- const sigset_t ti_pending);
-static td_err_e (*p_td_thr_setfpregs)(const td_thrhandle_t *th_p,
- const prfpregset_t *fpregset);
-static td_err_e (*p_td_thr_setxregs)(const td_thrhandle_t *th_p,
- const caddr_t xregset);
-static td_err_e (*p_td_ta_map_id2thr)(const td_thragent_t *ta_p,
- thread_t tid,
- td_thrhandle_t *th_p);
-static td_err_e (*p_td_ta_map_lwp2thr)(const td_thragent_t *ta_p,
- lwpid_t lwpid,
- td_thrhandle_t *th_p);
-static td_err_e (*p_td_thr_getgregs)(const td_thrhandle_t *th_p,
- prgregset_t regset);
-static td_err_e (*p_td_thr_setgregs)(const td_thrhandle_t *th_p,
- const prgregset_t regset);
+static td_log_ftype *p_td_log;
+static td_ta_new_ftype *p_td_ta_new;
+static td_ta_delete_ftype *p_td_ta_delete;
+static td_init_ftype *p_td_init;
+static td_ta_get_ph_ftype *p_td_ta_get_ph;
+static td_ta_get_nthreads_ftype *p_td_ta_get_nthreads;
+static td_ta_tsd_iter_ftype *p_td_ta_tsd_iter;
+static td_ta_thr_iter_ftype *p_td_ta_thr_iter;
+static td_thr_validate_ftype *p_td_thr_validate;
+static td_thr_tsd_ftype *p_td_thr_tsd;
+static td_thr_get_info_ftype *p_td_thr_get_info;
+static td_thr_getfpregs_ftype *p_td_thr_getfpregs;
+static td_thr_getxregsize_ftype *p_td_thr_getxregsize;
+static td_thr_getxregs_ftype *p_td_thr_getxregs;
+static td_thr_sigsetmask_ftype *p_td_thr_sigsetmask;
+static td_thr_setprio_ftype *p_td_thr_setprio;
+static td_thr_setsigpending_ftype *p_td_thr_setsigpending;
+static td_thr_setfpregs_ftype *p_td_thr_setfpregs;
+static td_thr_setxregs_ftype *p_td_thr_setxregs;
+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
@@ -818,7 +844,7 @@ ps_err_e
ps_pdread (gdb_ps_prochandle_t ph, gdb_ps_addr_t addr,
gdb_ps_read_buf_t buf, gdb_ps_size_t size)
{
- return rw_common (0, ph, addr, buf, size);
+ return rw_common (0, ph, addr, (gdb_byte *) buf, size);
}
/* Copies SIZE bytes from debugger memory .data segment to target process. */
@@ -836,7 +862,7 @@ ps_err_e
ps_ptread (gdb_ps_prochandle_t ph, gdb_ps_addr_t addr,
gdb_ps_read_buf_t buf, gdb_ps_size_t size)
{
- return rw_common (0, ph, addr, buf, size);
+ return rw_common (0, ph, addr, (gdb_byte *) buf, size);
}
/* Copies SIZE bytes from debugger memory .text segment to target process. */
@@ -1249,7 +1275,7 @@ _initialize_sol_thread (void)
goto die;
#define resolve(X) \
- if (!(p_##X = dlsym (dlhandle, #X))) \
+ if (!(p_##X = (X ## _ftype *) dlsym (dlhandle, #X))) \
goto die;
resolve (td_log);
diff --git a/gdb/top.c b/gdb/top.c
index c84feaf..c7a9c21 100644
--- a/gdb/top.c
+++ b/gdb/top.c
@@ -1166,7 +1166,7 @@ gdb_safe_append_history (void)
struct cleanup *old_chain;
local_history_filename
- = xstrprintf ("%s-gdb%d~", history_filename, getpid ());
+ = xstrprintf ("%s-gdb%ld~", history_filename, (long) getpid ());
old_chain = make_cleanup (xfree, local_history_filename);
ret = rename (history_filename, local_history_filename);