-Wwrite-strings: Constify target_pid_to_str and target_thread_extra_thread_info
authorPedro Alves <palves@redhat.com>
Wed, 5 Apr 2017 18:21:34 +0000 (19:21 +0100)
committerPedro Alves <palves@redhat.com>
Wed, 5 Apr 2017 18:21:34 +0000 (19:21 +0100)
-Wwrite-strings flagged a missing cast for example here:

   static char *
   ravenscar_extra_thread_info (struct target_ops *self, struct thread_info *tp)
   {
     return "Ravenscar task";

Since callers are not supposed to free the string returned by these
methods, change the methods' signature to return const strings.

gdb/ChangeLog:
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.

33 files changed:
gdb/ChangeLog
gdb/aix-thread.c
gdb/bsd-kvm.c
gdb/bsd-uthread.c
gdb/corelow.c
gdb/darwin-nat.c
gdb/fbsd-nat.c
gdb/fbsd-tdep.c
gdb/gdbarch.c
gdb/gdbarch.h
gdb/gdbarch.sh
gdb/gnu-nat.c
gdb/go32-nat.c
gdb/i386-cygwin-tdep.c
gdb/inf-ptrace.c
gdb/inferior.c
gdb/linux-nat.c
gdb/linux-tdep.c
gdb/linux-thread-db.c
gdb/nto-tdep.c
gdb/nto-tdep.h
gdb/obsd-nat.c
gdb/procfs.c
gdb/ravenscar-thread.c
gdb/remote-sim.c
gdb/remote.c
gdb/sol-thread.c
gdb/sol2-tdep.c
gdb/sol2-tdep.h
gdb/target-delegates.c
gdb/target.c
gdb/target.h
gdb/windows-nat.c

index f07927d468cbf5a7face57250cd9fe7b566b5b67..f0219682c50d1afa7d0f67085b3a4ac6e2415d45 100644 (file)
@@ -1,3 +1,46 @@
+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
index 3fbe96a7360423dd199b3d1e49563c1139cab8e7..05024dfcc7e12569e173be36a43cd51155a7b0ee 100644 (file)
@@ -1725,7 +1725,7 @@ aix_thread_thread_alive (struct target_ops *ops, ptid_t ptid)
 /* 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;
@@ -1745,7 +1745,7 @@ aix_thread_pid_to_str (struct target_ops *ops, ptid_t ptid)
 /* 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)
 {
index 9f4f9e71edf94127c5da7213da40feec367d556a..98e242836d9d236037205bde29c32f3ec159983a 100644 (file)
@@ -329,7 +329,7 @@ bsd_kvm_thread_alive (struct target_ops *ops,
   return 1;
 }
 
-static char *
+static const char *
 bsd_kvm_pid_to_str (struct target_ops *ops, ptid_t ptid)
 {
   static char buf[64];
index 08b8f36969c7c4ae66a57383135322e76078d6a4..5d4775c0f0bb1eb94c9c281ab5dd26284b786fc9 100644 (file)
@@ -491,7 +491,7 @@ static char *bsd_uthread_state[] =
 /* 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)
 {
@@ -511,7 +511,7 @@ bsd_uthread_extra_thread_info (struct target_ops *self,
   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)
index 656c7541a0bde9a86041fd291749180aa4733a48..3267c37843ec2936aaddfe0b118ac40dcf29edf8 100644 (file)
@@ -965,7 +965,7 @@ core_read_description (struct target_ops *target)
   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];
index edee1be85898f632c83126e2a6a9cb7cabe26201..e5092401f8746ce0cb3a17d8cd36fb6a9d9a14e6 100644 (file)
@@ -107,7 +107,7 @@ static void darwin_create_inferior (struct target_ops *ops, char *exec_file,
 
 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);
 
@@ -1970,7 +1970,7 @@ darwin_files_info (struct target_ops *ops)
 {
 }
 
-static char *
+static const char *
 darwin_pid_to_str (struct target_ops *ops, ptid_t ptid)
 {
   static char buf[80];
index 25952c3a69ba657bc3225bae76c94d5fec3295aa..5c4408b4aa6efa95d19b696d60990a98e06993c5 100644 (file)
@@ -368,7 +368,7 @@ fbsd_thread_alive (struct target_ops *ops, ptid_t ptid)
 /* 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;
index 46875d8efd1f01086f2ff6af73b97079a3425d30..b834ce38b457c02058c0ac94a39ffd1669040f19 100644 (file)
@@ -32,7 +32,7 @@
 
 /* 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];
index 87eafb2ab65389cc08df0df28574a845aef645db..6debb10f594c4b26a76ccdf96e8637f98aa9e89f 100644 (file)
@@ -3691,7 +3691,7 @@ gdbarch_core_pid_to_str_p (struct gdbarch *gdbarch)
   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);
index 34f82a719aaa366b7e08dc32d0e64b81767fd993..3264c44711f2a5178a8ea98220e5d196305e087c 100644 (file)
@@ -906,8 +906,8 @@ extern void set_gdbarch_core_xfer_shared_libraries_aix (struct gdbarch *gdbarch,
 
 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. */
index 39b1f9477c28dedacb2cdabca602fd2e04b49254..c471b73cb10b024fd1ff955fbbc0469f1f0732f6 100755 (executable)
@@ -745,7 +745,7 @@ M:ULONGEST:core_xfer_shared_libraries:gdb_byte *readbuf, ULONGEST offset, ULONGE
 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
index 7efb3c17b399b792964e594c16b04e3f4a951b35..b2a975dead75d3e712817f7c6a77fd1610ccfb03 100644 (file)
@@ -2652,7 +2652,7 @@ proc_string (struct proc *proc)
   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;
index 1fca8e2e53f83e236260e984dc803825bb60781c..d2d8d7affaa06512ccc13747b93341bf806d5914 100644 (file)
@@ -941,7 +941,7 @@ go32_thread_alive (struct target_ops *ops, ptid_t ptid)
   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);
index f200d39f2de496d3f4e23145e330477b016bd119..c8139ff047b52c7edbde64c4b2e8e1f29b0519ff 100644 (file)
@@ -178,7 +178,7 @@ windows_core_xfer_shared_libraries (struct gdbarch *gdbarch,
 
 /* 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];
index f912d28088e2253079d57ea9ddce324008b9c20e..c91100134b108def656d25b876687c315f0b68b5 100644 (file)
@@ -619,7 +619,7 @@ inf_ptrace_files_info (struct target_ops *ignore)
                   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);
index c4ab6d7d7f6130d4a9b8c39fc8d5be337aac941c..4ae265edab3bd54bb4cc1b4607febb60b543e7a7 100644 (file)
@@ -542,7 +542,7 @@ number_of_inferiors (void)
 /* 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)
index dff0da568a778e0d3033d867fccd7b3e9aff0073..b06e400fdc21d63d055dec3bf2378970ca70b2bd 100644 (file)
@@ -3940,7 +3940,7 @@ linux_nat_update_thread_list (struct target_ops *ops)
     }
 }
 
-static char *
+static const char *
 linux_nat_pid_to_str (struct target_ops *ops, ptid_t ptid)
 {
   static char buf[64];
index 1a3e48d83d937b393efc98c821030272ec4b269d..016aadff6b475a69968213c56861706f5da0d91e 100644 (file)
@@ -407,7 +407,7 @@ linux_has_shared_address_space (struct gdbarch *gdbarch)
 
 /* 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];
index b131fc20a9adc022f267ad04e26395a4c9edeb0d..0e2607b5d96683aba65cb7a50aa109476a2c03a1 100644 (file)
@@ -1372,7 +1372,7 @@ thread_db_update_thread_list (struct target_ops *ops)
   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);
@@ -1397,7 +1397,7 @@ thread_db_pid_to_str (struct target_ops *ops, ptid_t 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)
 {
index 96a3af325a165bc5ba2c657353f06f27f3609696..04ad06c431a0e8c8e6c4286f06185be01d727b0d 100644 (file)
@@ -408,7 +408,7 @@ static const char *nto_thread_state_str[] =
   "NET_REPLY"  /* 20 0x14 */
 };
 
-char *
+const char *
 nto_extra_thread_info (struct target_ops *self, struct thread_info *ti)
 {
   if (ti && ti->priv
index 457bbc904ffda151004ba6a4bb0b9b78539b3243..afe3452d3453a0f7b7cf62474bcd26f6c5eb463e 100644 (file)
@@ -176,7 +176,7 @@ void nto_dummy_supply_regset (struct regcache *regcache, char *regs);
 
 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,
index 3a73cbdd272a91a9e8c74135431dfe52c50b6392..e2336a0579ec18f4f20dd1da97312b1c1b5c755d 100644 (file)
@@ -35,7 +35,7 @@
 
 #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)
index b860f1699e7d09a047c1d95cd5f7b622a05de961..71d4b643d9679e9a3edfcf8b9f602a08907ba931 100644 (file)
@@ -135,7 +135,7 @@ static target_xfer_partial_ftype procfs_xfer_partial;
 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 *);
@@ -4691,7 +4691,7 @@ procfs_thread_alive (struct target_ops *ops, ptid_t ptid)
 /* 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];
index d1bd97f3a659599c076b37970ba4541a70899328..1f89ea23a9dec80686813ec19d508ab844450878 100644 (file)
@@ -54,8 +54,8 @@ static const char ravenscar_runtime_initializer[] =
 
 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);
@@ -241,7 +241,7 @@ ravenscar_running_thread (void)
     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";
@@ -254,7 +254,7 @@ ravenscar_thread_alive (struct target_ops *ops, ptid_t ptid)
   return 1;
 }
 
-static char *
+static const char *
 ravenscar_pid_to_str (struct target_ops *ops, ptid_t ptid)
 {
   static char buf[30];
index 0e8d65779f6f4609cee74700b2edcba6939d24d4..4396d4bcfe4dec20d03e68549b3503a719dd5133 100644 (file)
@@ -1270,7 +1270,7 @@ gdbsim_thread_alive (struct target_ops *ops, ptid_t ptid)
 /* 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);
index 73a2e5124e54430440ca9509c32af5d97659f0a3..30cd47ac8bfde2d417b78ed22e7be33dee8bb90f 100644 (file)
@@ -3354,7 +3354,7 @@ remote_update_thread_list (struct target_ops *ops)
  * 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 ();
@@ -10946,7 +10946,7 @@ init_remote_threadtests (void)
 /* 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];
index 7c1620a0f68b59e971dbf15d21308255d48ff9f1..39dae864a39cfa3fc1d670979534d5f2a6cd5271 100644 (file)
@@ -1021,7 +1021,7 @@ ps_lgetLDT (gdb_ps_prochandle_t ph, lwpid_t lwpid,
 
 /* 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];
index 89eda53768bfff4156a3edee1963b4f0952dfcf2..7a06aa7a0d92babde42428df11e8379abc7124a4 100644 (file)
@@ -40,7 +40,7 @@ sol2_skip_solib_resolver (struct gdbarch *gdbarch, CORE_ADDR pc)
 /* 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];
index d2382e39a5ff446fd4f3bccb145fe40157c52b5e..56dd898be5416e4d5f14181979f44f5b9ff39b9d 100644 (file)
@@ -24,6 +24,6 @@ struct gdbarch;
 
 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 */
index 470b7e44d879ab2bedcfe9335f4e37b03db04eed..88e3e0b9940d77fca40f32ba24c550521170757c 100644 (file)
@@ -1502,17 +1502,17 @@ debug_update_thread_list (struct target_ops *self)
   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);
@@ -1520,28 +1520,28 @@ debug_pid_to_str (struct target_ops *self, ptid_t arg1)
   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);
@@ -1549,7 +1549,7 @@ debug_extra_thread_info (struct target_ops *self, struct thread_info *arg1)
   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;
 }
index 7c286ab6bf821ced42a0c1ac945343b761a37157..fd9181ee30d89d7f45adaf51e34027d93d259061 100644 (file)
@@ -103,7 +103,7 @@ static int dummy_find_memory_regions (struct target_ops *self,
 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);
@@ -2303,7 +2303,7 @@ default_target_wait (struct target_ops *ops,
   return minus_one_ptid;
 }
 
-char *
+const char *
 target_pid_to_str (ptid_t ptid)
 {
   return (*current_target.to_pid_to_str) (&current_target, ptid);
@@ -3344,7 +3344,7 @@ generic_mourn_inferior (void)
 /* 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];
@@ -3353,7 +3353,7 @@ normal_pid_to_str (ptid_t ptid)
   return buf;
 }
 
-static char *
+static const char *
 default_pid_to_str (struct target_ops *ops, ptid_t ptid)
 {
   return normal_pid_to_str (ptid);
index 943a0e2e1a04c82775efda14ac21b6ee226ef5a5..6553f491b298063823a62dd0691bd4fe67ecce36 100644 (file)
@@ -639,9 +639,9 @@ struct target_ops
       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);
@@ -1851,9 +1851,9 @@ extern int target_is_non_stop_p (void);
    `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
index 76313db98914973135247bddc6314ef8464202bc..85f2030214ea563eb9c0d5cbccb7ec57551710fc 100644 (file)
@@ -2807,7 +2807,7 @@ windows_close (struct target_ops *self)
 }
 
 /* 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];
This page took 0.05358 seconds and 4 git commands to generate.