aboutsummaryrefslogtreecommitdiff
path: root/gdb/gdbserver
diff options
context:
space:
mode:
authorPedro Alves <palves@redhat.com>2017-04-05 19:21:35 +0100
committerPedro Alves <palves@redhat.com>2017-04-05 19:21:35 +0100
commitfb32b4f7005ef8f1bde02394b58b5c5eda9cbf10 (patch)
treea8de4f50124a206aa18acc2a3a9ff496de38301e /gdb/gdbserver
parentfdf9e36fa2ed39f0da0dfa5dfdbd8e2452c6cb45 (diff)
downloadgdb-fb32b4f7005ef8f1bde02394b58b5c5eda9cbf10.zip
gdb-fb32b4f7005ef8f1bde02394b58b5c5eda9cbf10.tar.gz
gdb-fb32b4f7005ef8f1bde02394b58b5c5eda9cbf10.tar.bz2
-Wwrite-strings: gdbserver's 'port' parsing
-Wwrite-strings flags this assignment as requiring a cast: port = STDIO_CONNECTION_NAME; because 'port' is a "char *", and STDIO_CONNECTION_NAME is a string literal. gdb/gdbserver/ChangeLog: 2017-04-05 Pedro Alves <palves@redhat.com> * remote-utils.c (remote_prepare, remote_open): Constify. * remote-utils.h (remote_prepare, remote_open): Constify. * server.c (captured_main): Constify 'port' handling.
Diffstat (limited to 'gdb/gdbserver')
-rw-r--r--gdb/gdbserver/ChangeLog6
-rw-r--r--gdb/gdbserver/remote-utils.c8
-rw-r--r--gdb/gdbserver/remote-utils.h4
-rw-r--r--gdb/gdbserver/server.c13
4 files changed, 21 insertions, 10 deletions
diff --git a/gdb/gdbserver/ChangeLog b/gdb/gdbserver/ChangeLog
index 39aea2f..4660a7b 100644
--- a/gdb/gdbserver/ChangeLog
+++ b/gdb/gdbserver/ChangeLog
@@ -1,3 +1,9 @@
+2017-04-05 Pedro Alves <palves@redhat.com>
+
+ * remote-utils.c (remote_prepare, remote_open): Constify.
+ * remote-utils.h (remote_prepare, remote_open): Constify.
+ * server.c (captured_main): Constify 'port' handling.
+
2017-04-04 Simon Marchi <simon.marchi@ericsson.com>
* Makefile.in (clean): Clear .deps.
diff --git a/gdb/gdbserver/remote-utils.c b/gdb/gdbserver/remote-utils.c
index 6a2cc04..37a6402 100644
--- a/gdb/gdbserver/remote-utils.c
+++ b/gdb/gdbserver/remote-utils.c
@@ -217,9 +217,9 @@ handle_accept_event (int err, gdb_client_data client_data)
NAME is the filename used for communication. */
void
-remote_prepare (char *name)
+remote_prepare (const char *name)
{
- char *port_str;
+ const char *port_str;
#ifdef USE_WIN32API
static int winsock_initialized;
#endif
@@ -284,9 +284,9 @@ remote_prepare (char *name)
NAME is the filename used for communication. */
void
-remote_open (char *name)
+remote_open (const char *name)
{
- char *port_str;
+ const char *port_str;
port_str = strchr (name, ':');
#ifdef USE_WIN32API
diff --git a/gdb/gdbserver/remote-utils.h b/gdb/gdbserver/remote-utils.h
index 9db46be..b3eab3b 100644
--- a/gdb/gdbserver/remote-utils.h
+++ b/gdb/gdbserver/remote-utils.h
@@ -35,8 +35,8 @@ int putpkt (char *buf);
int putpkt_binary (char *buf, int len);
int putpkt_notif (char *buf);
int getpkt (char *buf);
-void remote_prepare (char *name);
-void remote_open (char *name);
+void remote_prepare (const char *name);
+void remote_open (const char *name);
void remote_close (void);
void write_ok (char *buf);
void write_enn (char *buf);
diff --git a/gdb/gdbserver/server.c b/gdb/gdbserver/server.c
index 4bc7f71..51f6a28 100644
--- a/gdb/gdbserver/server.c
+++ b/gdb/gdbserver/server.c
@@ -3511,7 +3511,8 @@ captured_main (int argc, char *argv[])
{
int bad_attach;
int pid;
- char *arg_end, *port;
+ char *arg_end;
+ const char *port = NULL;
char **next_arg = &argv[1];
volatile int multi_mode = 0;
volatile int attach = 0;
@@ -3608,7 +3609,8 @@ captured_main (int argc, char *argv[])
{
/* "-" specifies a stdio connection and is a form of port
specification. */
- *next_arg = STDIO_CONNECTION_NAME;
+ port = STDIO_CONNECTION_NAME;
+ next_arg++;
break;
}
else if (strcmp (*next_arg, "--disable-randomization") == 0)
@@ -3627,8 +3629,11 @@ captured_main (int argc, char *argv[])
continue;
}
- port = *next_arg;
- next_arg++;
+ if (port == NULL)
+ {
+ port = *next_arg;
+ next_arg++;
+ }
if (port == NULL || (!attach && !multi_mode && *next_arg == NULL))
{
gdbserver_usage (stderr);