+2017-04-05 Pedro Alves <palves@redhat.com>
+
+ * aix-thread.c (aix_thread_pid_to_str)
+ (aix_thread_extra_thread_info): Constify.
+ * bsd-kvm.c (bsd_kvm_pid_to_str): Constify.
+ * bsd-uthread.c (bsd_uthread_extra_thread_info)
+ (bsd_uthread_pid_to_str): Constify.
+ * corelow.c (core_pid_to_str): Constify.
+ * darwin-nat.c (darwin_pid_to_str): Constify.
+ * fbsd-nat.c (fbsd_pid_to_str): Constify.
+ * fbsd-tdep.c (fbsd_core_pid_to_str, gdbarch_core_pid_to_str):
+ Constify.
+ * gnu-nat.c (gnu_pid_to_str): Constify.
+ * go32-nat.c (go32_pid_to_str): Constify.
+ * i386-cygwin-tdep.c (i386_windows_core_pid_to_str): Constify.
+ * inf-ptrace.c (inf_ptrace_pid_to_str): Constify.
+ * inferior.c (inferior_pid_to_str): Constify.
+ * linux-nat.c (linux_nat_pid_to_str): Constify.
+ * linux-tdep.c (linux_core_pid_to_str): Constify.
+ * linux-thread-db.c (thread_db_pid_to_str)
+ (thread_db_extra_thread_info): Constify.
+ * nto-tdep.c (nto_extra_thread_info): Constify.
+ * nto-tdep.h (nto_extra_thread_info): Constify.
+ * obsd-nat.c (obsd_pid_to_str): Constify.
+ * procfs.c (procfs_pid_to_str): Constify.
+ * ravenscar-thread.c (ravenscar_extra_thread_info)
+ (ravenscar_pid_to_str): Constify.
+ * remote-sim.c (gdbsim_pid_to_str): Constify.
+ * remote.c (remote_threads_extra_info, remote_pid_to_str):
+ Constify.
+ * sol-thread.c (solaris_pid_to_str): Constify.
+ * sol2-tdep.c (sol2_core_pid_to_str): Constify.
+ * sol2-tdep.h (sol2_core_pid_to_str): Constify.
+ * target.c (default_pid_to_str, target_pid_to_str)
+ (normal_pid_to_str, default_pid_to_str): Constify.
+ * target.h (target_ops::to_pid_to_str)
+ (target_ops::to_extra_thread_info): Constify.
+ (target_pid_to_str, normal_pid_to_str): Constify.
+ * windows-nat.c (windows_pid_to_str): Constify.
+ * gdbarch.sh (core_pid_to_str): Constify.
+ * target-delegates.c: Regenerate.
+ * gdbarch.h, gdbarch.c: Regenerate.
+
2017-04-05 Pedro Alves <palves@redhat.com>
* main.c (captured_main_1): Use gdb::unique_xmalloc_ptr to manage
/* Return a printable representation of composite PID for use in
"info threads" output. */
-static char *
+static const char *
aix_thread_pid_to_str (struct target_ops *ops, ptid_t ptid)
{
static char *ret = NULL;
/* Return a printable representation of extra information about
THREAD, for use in "info threads" output. */
-static char *
+static const char *
aix_thread_extra_thread_info (struct target_ops *self,
struct thread_info *thread)
{
return 1;
}
-static char *
+static const char *
bsd_kvm_pid_to_str (struct target_ops *ops, ptid_t ptid)
{
static char buf[64];
/* Return a string describing th state of the thread specified by
INFO. */
-static char *
+static const char *
bsd_uthread_extra_thread_info (struct target_ops *self,
struct thread_info *info)
{
return NULL;
}
-static char *
+static const char *
bsd_uthread_pid_to_str (struct target_ops *ops, ptid_t ptid)
{
if (ptid_get_tid (ptid) != 0)
return target->beneath->to_read_description (target->beneath);
}
-static char *
+static const char *
core_pid_to_str (struct target_ops *ops, ptid_t ptid)
{
static char buf[64];
static void darwin_files_info (struct target_ops *ops);
-static char *darwin_pid_to_str (struct target_ops *ops, ptid_t tpid);
+static const char *darwin_pid_to_str (struct target_ops *ops, ptid_t tpid);
static int darwin_thread_alive (struct target_ops *ops, ptid_t tpid);
{
}
-static char *
+static const char *
darwin_pid_to_str (struct target_ops *ops, ptid_t ptid)
{
static char buf[80];
/* Convert PTID to a string. Returns the string in a static
buffer. */
-static char *
+static const char *
fbsd_pid_to_str (struct target_ops *ops, ptid_t ptid)
{
lwpid_t lwp;
/* This is how we want PTIDs from core files to be printed. */
-static char *
+static const char *
fbsd_core_pid_to_str (struct gdbarch *gdbarch, ptid_t ptid)
{
static char buf[80];
return gdbarch->core_pid_to_str != NULL;
}
-char *
+const char *
gdbarch_core_pid_to_str (struct gdbarch *gdbarch, ptid_t ptid)
{
gdb_assert (gdbarch != NULL);
extern int gdbarch_core_pid_to_str_p (struct gdbarch *gdbarch);
-typedef char * (gdbarch_core_pid_to_str_ftype) (struct gdbarch *gdbarch, ptid_t ptid);
-extern char * gdbarch_core_pid_to_str (struct gdbarch *gdbarch, ptid_t ptid);
+typedef const char * (gdbarch_core_pid_to_str_ftype) (struct gdbarch *gdbarch, ptid_t ptid);
+extern const char * gdbarch_core_pid_to_str (struct gdbarch *gdbarch, ptid_t ptid);
extern void set_gdbarch_core_pid_to_str (struct gdbarch *gdbarch, gdbarch_core_pid_to_str_ftype *core_pid_to_str);
/* How the core target extracts the name of a thread from a core file. */
M:ULONGEST:core_xfer_shared_libraries_aix:gdb_byte *readbuf, ULONGEST offset, ULONGEST len:readbuf, offset, len
# How the core target converts a PTID from a core file to a string.
-M:char *:core_pid_to_str:ptid_t ptid:ptid
+M:const char *:core_pid_to_str:ptid_t ptid:ptid
# How the core target extracts the name of a thread from a core file.
M:const char *:core_thread_name:struct thread_info *thr:thr
return tid_str;
}
-static char *
+static const char *
gnu_pid_to_str (struct target_ops *ops, ptid_t ptid)
{
struct inf *inf = gnu_current_inf;
return !ptid_equal (ptid, null_ptid);
}
-static char *
+static const char *
go32_pid_to_str (struct target_ops *ops, ptid_t ptid)
{
return normal_pid_to_str (ptid);
/* This is how we want PTIDs from core files to be printed. */
-static char *
+static const char *
i386_windows_core_pid_to_str (struct gdbarch *gdbarch, ptid_t ptid)
{
static char buf[80];
target_pid_to_str (inferior_ptid));
}
-static char *
+static const char *
inf_ptrace_pid_to_str (struct target_ops *ops, ptid_t ptid)
{
return normal_pid_to_str (ptid);
/* Converts an inferior process id to a string. Like
target_pid_to_str, but special cases the null process. */
-static char *
+static const char *
inferior_pid_to_str (int pid)
{
if (pid != 0)
}
}
-static char *
+static const char *
linux_nat_pid_to_str (struct target_ops *ops, ptid_t ptid)
{
static char buf[64];
/* This is how we want PTIDs from core files to be printed. */
-static char *
+static const char *
linux_core_pid_to_str (struct gdbarch *gdbarch, ptid_t ptid)
{
static char buf[80];
ops->beneath->to_update_thread_list (ops->beneath);
}
-static char *
+static const char *
thread_db_pid_to_str (struct target_ops *ops, ptid_t ptid)
{
struct thread_info *thread_info = find_thread_ptid (ptid);
/* Return a string describing the state of the thread specified by
INFO. */
-static char *
+static const char *
thread_db_extra_thread_info (struct target_ops *self,
struct thread_info *info)
{
"NET_REPLY" /* 20 0x14 */
};
-char *
+const char *
nto_extra_thread_info (struct target_ops *self, struct thread_info *ti)
{
if (ti && ti->priv
int nto_in_dynsym_resolve_code (CORE_ADDR pc);
-char *nto_extra_thread_info (struct target_ops *self, struct thread_info *);
+const char *nto_extra_thread_info (struct target_ops *self, struct thread_info *);
LONGEST nto_read_auxv_from_initial_stack (CORE_ADDR inital_stack,
gdb_byte *readbuf,
#ifdef PT_GET_THREAD_FIRST
-static char *
+static const char *
obsd_pid_to_str (struct target_ops *ops, ptid_t ptid)
{
if (ptid_get_lwp (ptid) != 0)
static int procfs_thread_alive (struct target_ops *ops, ptid_t);
static void procfs_update_thread_list (struct target_ops *ops);
-static char *procfs_pid_to_str (struct target_ops *, ptid_t);
+static const char *procfs_pid_to_str (struct target_ops *, ptid_t);
static int proc_find_memory_regions (struct target_ops *self,
find_memory_region_ftype, void *);
/* Convert PTID to a string. Returns the string in a static
buffer. */
-static char *
+static const char *
procfs_pid_to_str (struct target_ops *ops, ptid_t ptid)
{
static char buf[80];
static void ravenscar_update_thread_list (struct target_ops *ops);
static ptid_t ravenscar_running_thread (void);
-static char *ravenscar_extra_thread_info (struct target_ops *self,
- struct thread_info *tp);
+static const char *ravenscar_extra_thread_info (struct target_ops *self,
+ struct thread_info *tp);
static int ravenscar_thread_alive (struct target_ops *ops, ptid_t ptid);
static void ravenscar_fetch_registers (struct target_ops *ops,
struct regcache *regcache, int regnum);
return ptid_build (ptid_get_pid (base_ptid), 0, tid);
}
-static char *
+static const char *
ravenscar_extra_thread_info (struct target_ops *self, struct thread_info *tp)
{
return "Ravenscar task";
return 1;
}
-static char *
+static const char *
ravenscar_pid_to_str (struct target_ops *ops, ptid_t ptid)
{
static char buf[30];
/* Convert a thread ID to a string. Returns the string in a static
buffer. */
-static char *
+static const char *
gdbsim_pid_to_str (struct target_ops *ops, ptid_t ptid)
{
return normal_pid_to_str (ptid);
* Optional: targets are not required to implement this function.
*/
-static char *
+static const char *
remote_threads_extra_info (struct target_ops *self, struct thread_info *tp)
{
struct remote_state *rs = get_remote_state ();
/* Convert a thread ID to a string. Returns the string in a static
buffer. */
-static char *
+static const char *
remote_pid_to_str (struct target_ops *ops, ptid_t ptid)
{
static char buf[64];
/* Convert PTID to printable form. */
-static char *
+static const char *
solaris_pid_to_str (struct target_ops *ops, ptid_t ptid)
{
static char buf[100];
/* This is how we want PTIDs from Solaris core files to be
printed. */
-char *
+const char *
sol2_core_pid_to_str (struct gdbarch *gdbarch, ptid_t ptid)
{
static char buf[80];
CORE_ADDR sol2_skip_solib_resolver (struct gdbarch *, CORE_ADDR);
-char *sol2_core_pid_to_str (struct gdbarch *gdbarch, ptid_t ptid);
+const char *sol2_core_pid_to_str (struct gdbarch *gdbarch, ptid_t ptid);
#endif /* sol2-tdep.h */
fputs_unfiltered (")\n", gdb_stdlog);
}
-static char *
+static const char *
delegate_pid_to_str (struct target_ops *self, ptid_t arg1)
{
self = self->beneath;
return self->to_pid_to_str (self, arg1);
}
-static char *
+static const char *
debug_pid_to_str (struct target_ops *self, ptid_t arg1)
{
- char * result;
+ const char * result;
fprintf_unfiltered (gdb_stdlog, "-> %s->to_pid_to_str (...)\n", debug_target.to_shortname);
result = debug_target.to_pid_to_str (&debug_target, arg1);
fprintf_unfiltered (gdb_stdlog, "<- %s->to_pid_to_str (", debug_target.to_shortname);
fputs_unfiltered (", ", gdb_stdlog);
target_debug_print_ptid_t (arg1);
fputs_unfiltered (") = ", gdb_stdlog);
- target_debug_print_char_p (result);
+ target_debug_print_const_char_p (result);
fputs_unfiltered ("\n", gdb_stdlog);
return result;
}
-static char *
+static const char *
delegate_extra_thread_info (struct target_ops *self, struct thread_info *arg1)
{
self = self->beneath;
return self->to_extra_thread_info (self, arg1);
}
-static char *
+static const char *
tdefault_extra_thread_info (struct target_ops *self, struct thread_info *arg1)
{
return NULL;
}
-static char *
+static const char *
debug_extra_thread_info (struct target_ops *self, struct thread_info *arg1)
{
- char * result;
+ const char * result;
fprintf_unfiltered (gdb_stdlog, "-> %s->to_extra_thread_info (...)\n", debug_target.to_shortname);
result = debug_target.to_extra_thread_info (&debug_target, arg1);
fprintf_unfiltered (gdb_stdlog, "<- %s->to_extra_thread_info (", debug_target.to_shortname);
fputs_unfiltered (", ", gdb_stdlog);
target_debug_print_struct_thread_info_p (arg1);
fputs_unfiltered (") = ", gdb_stdlog);
- target_debug_print_char_p (result);
+ target_debug_print_const_char_p (result);
fputs_unfiltered ("\n", gdb_stdlog);
return result;
}
static char *dummy_make_corefile_notes (struct target_ops *self,
bfd *ignore1, int *ignore2);
-static char *default_pid_to_str (struct target_ops *ops, ptid_t ptid);
+static const char *default_pid_to_str (struct target_ops *ops, ptid_t ptid);
static enum exec_direction_kind default_execution_direction
(struct target_ops *self);
return minus_one_ptid;
}
-char *
+const char *
target_pid_to_str (ptid_t ptid)
{
return (*current_target.to_pid_to_str) (¤t_target, ptid);
/* Convert a normal process ID to a string. Returns the string in a
static buffer. */
-char *
+const char *
normal_pid_to_str (ptid_t ptid)
{
static char buf[32];
return buf;
}
-static char *
+static const char *
default_pid_to_str (struct target_ops *ops, ptid_t ptid)
{
return normal_pid_to_str (ptid);
TARGET_DEFAULT_RETURN (0);
void (*to_update_thread_list) (struct target_ops *)
TARGET_DEFAULT_IGNORE ();
- char *(*to_pid_to_str) (struct target_ops *, ptid_t)
+ const char *(*to_pid_to_str) (struct target_ops *, ptid_t)
TARGET_DEFAULT_FUNC (default_pid_to_str);
- char *(*to_extra_thread_info) (struct target_ops *, struct thread_info *)
+ const char *(*to_extra_thread_info) (struct target_ops *, struct thread_info *)
TARGET_DEFAULT_RETURN (NULL);
const char *(*to_thread_name) (struct target_ops *, struct thread_info *)
TARGET_DEFAULT_RETURN (NULL);
`process xyz', but on some systems it may contain
`process xyz thread abc'. */
-extern char *target_pid_to_str (ptid_t ptid);
+extern const char *target_pid_to_str (ptid_t ptid);
-extern char *normal_pid_to_str (ptid_t ptid);
+extern const char *normal_pid_to_str (ptid_t ptid);
/* Return a short string describing extra information about PID,
e.g. "sleeping", "runnable", "running on LWP 3". Null return value
}
/* Convert pid to printable format. */
-static char *
+static const char *
windows_pid_to_str (struct target_ops *ops, ptid_t ptid)
{
static char buf[80];