Fix gdb 8.0 compilation on Solaris

Message ID ydd37cbboem.fsf@CeBiTec.Uni-Bielefeld.DE
State New, archived
Headers

Commit Message

Rainer Orth May 11, 2017, 11:53 a.m. UTC
  Prompted by the creation of the gdb 8.0 branch, I tried to build it on
x86_64-pc-solaris2.12, but failed:

/vol/src/gnu/gdb/gdb-8.0-branch/local/gdb/procfs.c: In function ‘target_ops* procfs_target()’:
/vol/src/gnu/gdb/gdb-8.0-branch/local/gdb/procfs.c:186:27: error: invalid conversion from ‘void (*)(target_ops*, char*, char*, char**, int)’ to ‘void (*)(target_ops*, const char*, const string&, char**, int) {aka void (*)(target_ops*, const char*, const std::__cxx11::basic_string<char>&, char**, int)}’ [-fpermissive]
   t->to_create_inferior = procfs_create_inferior;
                           ^~~~~~~~~~~~~~~~~~~~~~
/vol/src/gnu/gdb/gdb-8.0-branch/local/gdb/procfs.c: At global scope:
/vol/src/gnu/gdb/gdb-8.0-branch/local/gdb/procfs.c:125:13: warning: ‘void procfs_create_inferior(target_ops*, char*, char*, char**, int)’ declared ‘static’ but never defined [-Wunused-function]
 static void procfs_create_inferior (struct target_ops *, char *,
             ^~~~~~~~~~~~~~~~~~~~~~
/vol/src/gnu/gdb/gdb-8.0-branch/local/gdb/procfs.c:4529:1: warning: ‘void procfs_create_inferior(target_ops*, const char*, const string&, char**, int)’ defined but not used [-Wunused-function]
 procfs_create_inferior (struct target_ops *ops, const char *exec_file,
 ^~~~~~~~~~~~~~~~~~~~~~

This can easily be fixed by the following patch.

Ok for gdb mainline (which is equally affected) and 8.0 branch?

Thanks.
        Rainer
  

Comments

Yao Qi May 11, 2017, 9:16 p.m. UTC | #1
On 17-05-11 13:53:21, Rainer Orth wrote:
> 
> Ok for gdb mainline (which is equally affected) and 8.0 branch?
> 

Yes, please apply it to both.
  

Patch

diff --git a/gdb/procfs.c b/gdb/procfs.c
--- a/gdb/procfs.c
+++ b/gdb/procfs.c
@@ -122,8 +122,8 @@  static void procfs_pass_signals (struct 
 				 int, unsigned char *);
 static void procfs_kill_inferior (struct target_ops *ops);
 static void procfs_mourn_inferior (struct target_ops *ops);
-static void procfs_create_inferior (struct target_ops *, char *,
-				    char *, char **, int);
+static void procfs_create_inferior (struct target_ops *, const char *,
+				    const std::string &, char **, int);
 static ptid_t procfs_wait (struct target_ops *,
 			   ptid_t, struct target_waitstatus *, int);
 static enum target_xfer_status procfs_xfer_memory (gdb_byte *,