diff options
author | Pedro Alves <palves@redhat.com> | 2017-04-05 19:21:36 +0100 |
---|---|---|
committer | Pedro Alves <palves@redhat.com> | 2017-04-05 19:21:36 +0100 |
commit | 3e83a920090130052a407621b94b94513f539fda (patch) | |
tree | 67e4b825fac13a2e7b841f389b55efc7edf4735e /gdb/symfile-mem.c | |
parent | 63160a43508fb50d9013df061b2191de71f67b50 (diff) | |
download | gdb-3e83a920090130052a407621b94b94513f539fda.zip gdb-3e83a920090130052a407621b94b94513f539fda.tar.gz gdb-3e83a920090130052a407621b94b94513f539fda.tar.bz2 |
-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.
Diffstat (limited to 'gdb/symfile-mem.c')
0 files changed, 0 insertions, 0 deletions