This is the mail archive of the gdb-cvs@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[binutils-gdb] Change get_inferior_args to return const char *


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=cbaaa0cafcac0630c6f07f81663a1b10a4e197a0

commit cbaaa0cafcac0630c6f07f81663a1b10a4e197a0
Author: Tom Tromey <tom@tromey.com>
Date:   Sat Sep 15 16:29:03 2018 -0600

    Change get_inferior_args to return const char *
    
    I noticed that get_inferior_args should return const char *, because
    it is just returning a reference to something owned by the inferior.
    
    I'm checking this in.
    
    gdb/ChangeLog
    2018-09-15  Tom Tromey  <tom@tromey.com>
    
    	* infcmd.c (get_inferior_args): Return const char *.
    	* inferior.h (get_inferior_args): Return type now const.
    	* linux-tdep.c (linux_fill_prpsinfo): Update.
    	* procfs.c (procfs_target::make_corefile_notes): Update.

Diff:
---
 gdb/ChangeLog    | 7 +++++++
 gdb/infcmd.c     | 2 +-
 gdb/inferior.h   | 2 +-
 gdb/linux-tdep.c | 2 +-
 gdb/procfs.c     | 2 +-
 5 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 80e1ccd..da9b450 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,10 @@
+2018-09-15  Tom Tromey  <tom@tromey.com>
+
+	* infcmd.c (get_inferior_args): Return const char *.
+	* inferior.h (get_inferior_args): Return type now const.
+	* linux-tdep.c (linux_fill_prpsinfo): Update.
+	* procfs.c (procfs_target::make_corefile_notes): Update.
+
 2018-09-07  Tom Tromey  <tom@tromey.com>
 
 	* python/python.c (execute_gdb_command): Call bpstat_do_actions
diff --git a/gdb/infcmd.c b/gdb/infcmd.c
index 860909f..047693e 100644
--- a/gdb/infcmd.c
+++ b/gdb/infcmd.c
@@ -154,7 +154,7 @@ show_inferior_tty_command (struct ui_file *file, int from_tty,
 		      "is \"%s\".\n"), inferior_io_terminal);
 }
 
-char *
+const char *
 get_inferior_args (void)
 {
   if (current_inferior ()->argc != 0)
diff --git a/gdb/inferior.h b/gdb/inferior.h
index c5dc324..8d38429 100644
--- a/gdb/inferior.h
+++ b/gdb/inferior.h
@@ -161,7 +161,7 @@ extern void post_create_inferior (struct target_ops *, int);
 
 extern void attach_command (const char *, int);
 
-extern char *get_inferior_args (void);
+extern const char *get_inferior_args (void);
 
 extern void set_inferior_args (const char *);
 
diff --git a/gdb/linux-tdep.c b/gdb/linux-tdep.c
index 5801ab5..5bfd7ed 100644
--- a/gdb/linux-tdep.c
+++ b/gdb/linux-tdep.c
@@ -1728,7 +1728,7 @@ linux_fill_prpsinfo (struct elf_internal_linux_prpsinfo *p)
   char filename[100];
   /* The basename of the executable.  */
   const char *basename;
-  char *infargs;
+  const char *infargs;
   /* Temporary buffer.  */
   char *tmpstr;
   /* The valid states of a process, according to the Linux kernel.  */
diff --git a/gdb/procfs.c b/gdb/procfs.c
index 81a4900..66a3197 100644
--- a/gdb/procfs.c
+++ b/gdb/procfs.c
@@ -3848,7 +3848,7 @@ procfs_target::make_corefile_notes (bfd *obfd, int *note_size)
   char psargs[80] = {'\0'};
   procinfo *pi = find_procinfo_or_die (inferior_ptid.pid (), 0);
   char *note_data = NULL;
-  char *inf_args;
+  const char *inf_args;
   struct procfs_corefile_thread_data thread_args;
   enum gdb_signal stop_signal;


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]