-Wwrite-strings: Fix Solaris "set procfs-file"
Compiling GDB with -Wwrite-strings flags this code in gdb/proc-api.c:
static char *procfs_filename = "procfs_trace";
as needing a cast. However, this variable is a command variable, and
as such it's incorrect to initialize it to a literal, since when you
use the corresponding set command, gdb frees the old string...
I didn't manage to fully build Solaris gdb (fails for other reasons),
but I confirmed that the system GDB on Solaris 11 crashes when running
this command:
(gdb) set procfs-file foo
Segmentation Fault (core dumped)
So I don't think this commit can make it worse than the status quo.
gdb/ChangeLog:
2017-04-05 Pedro Alves <palves@redhat.com>
* proc-api.c (procfs_filename): Don't initialize
procfs_filename.
(prepare_to_trace): Assume procfs_filename is non-NULL.
(_initialize_proc_api): Give procfs_filename a default value here.