From patchwork Mon Jun 9 14:15:52 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 1373 Received: (qmail 7752 invoked by alias); 9 Jun 2014 14:16:04 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 7708 invoked by uid 89); 9 Jun 2014 14:16:02 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.8 required=5.0 tests=AWL, BAYES_00, RP_MATCHES_RCVD, SPF_HELO_PASS, SPF_PASS, UNWANTED_LANGUAGE_BODY autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 09 Jun 2014 14:16:00 +0000 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s59EFxkQ016253 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Mon, 9 Jun 2014 10:15:59 -0400 Received: from barimba.redhat.com (ovpn-113-103.phx2.redhat.com [10.3.113.103]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s59EFwZv023035; Mon, 9 Jun 2014 10:15:58 -0400 From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [PATCH 1/3] constify to_rcmd Date: Mon, 9 Jun 2014 08:15:52 -0600 Message-Id: <1402323354-27308-2-git-send-email-tromey@redhat.com> In-Reply-To: <1402323354-27308-1-git-send-email-tromey@redhat.com> References: <1402323354-27308-1-git-send-email-tromey@redhat.com> This makes the "command" parameter of the to_rcmd target method const. 2014-06-09 Tom Tromey * target.h (struct target_ops) : Make "command" const. * target.c (debug_to_rcmd, default_rcmd): Update. * target-delegates.c: Rebuild. * remote.c (remote_rcmd): Update. * monitor.c (monitor_rcmd): Update. --- gdb/ChangeLog | 8 ++++++++ gdb/monitor.c | 2 +- gdb/remote.c | 4 ++-- gdb/target-delegates.c | 2 +- gdb/target.c | 7 ++++--- gdb/target.h | 2 +- 6 files changed, 17 insertions(+), 8 deletions(-) diff --git a/gdb/monitor.c b/gdb/monitor.c index 25742ac..4a57d5e 100644 --- a/gdb/monitor.c +++ b/gdb/monitor.c @@ -2282,7 +2282,7 @@ monitor_stop (struct target_ops *self, ptid_t ptid) ourseleves here cause of a nasty echo. */ static void -monitor_rcmd (struct target_ops *self, char *command, +monitor_rcmd (struct target_ops *self, const char *command, struct ui_file *outbuf) { char *p; diff --git a/gdb/remote.c b/gdb/remote.c index d5e5272..43e25ae 100644 --- a/gdb/remote.c +++ b/gdb/remote.c @@ -8988,7 +8988,7 @@ remote_search_memory (struct target_ops* ops, } static void -remote_rcmd (struct target_ops *self, char *command, +remote_rcmd (struct target_ops *self, const char *command, struct ui_file *outbuf) { struct remote_state *rs = get_remote_state (); @@ -9010,7 +9010,7 @@ remote_rcmd (struct target_ops *self, char *command, error (_("\"monitor\" command ``%s'' is too long."), command); /* Encode the actual command. */ - bin2hex ((gdb_byte *) command, p, strlen (command)); + bin2hex ((const gdb_byte *) command, p, strlen (command)); if (putpkt (rs->buf) < 0) error (_("Communication problem with target.")); diff --git a/gdb/target-delegates.c b/gdb/target-delegates.c index e6fbb44..522d52b 100644 --- a/gdb/target-delegates.c +++ b/gdb/target-delegates.c @@ -631,7 +631,7 @@ tdefault_stop (struct target_ops *self, ptid_t arg1) } static void -delegate_rcmd (struct target_ops *self, char *arg1, struct ui_file *arg2) +delegate_rcmd (struct target_ops *self, const char *arg1, struct ui_file *arg2) { self = self->beneath; self->to_rcmd (self, arg1, arg2); diff --git a/gdb/target.c b/gdb/target.c index f73ab3c..a9255d7 100644 --- a/gdb/target.c +++ b/gdb/target.c @@ -57,7 +57,7 @@ static int default_watchpoint_addr_within_range (struct target_ops *, static int default_region_ok_for_hw_watchpoint (struct target_ops *, CORE_ADDR, int); -static void default_rcmd (struct target_ops *, char *, struct ui_file *); +static void default_rcmd (struct target_ops *, const char *, struct ui_file *); static ptid_t default_get_ada_task_ptid (struct target_ops *self, long lwp, long tid); @@ -4006,7 +4006,7 @@ debug_to_stop (struct target_ops *self, ptid_t ptid) } static void -debug_to_rcmd (struct target_ops *self, char *command, +debug_to_rcmd (struct target_ops *self, const char *command, struct ui_file *outbuf) { debug_target.to_rcmd (&debug_target, command, outbuf); @@ -4080,7 +4080,8 @@ stack of targets currently in use (including the exec-file,\n\ core-file, and process, if any), as well as the symbol file name."; static void -default_rcmd (struct target_ops *self, char *command, struct ui_file *output) +default_rcmd (struct target_ops *self, const char *command, + struct ui_file *output) { error (_("\"monitor\" command not supported by this target.")); } diff --git a/gdb/target.h b/gdb/target.h index cd5a799..87d2a83 100644 --- a/gdb/target.h +++ b/gdb/target.h @@ -560,7 +560,7 @@ struct target_ops void (*to_stop) (struct target_ops *, ptid_t) TARGET_DEFAULT_IGNORE (); void (*to_rcmd) (struct target_ops *, - char *command, struct ui_file *output) + const char *command, struct ui_file *output) TARGET_DEFAULT_FUNC (default_rcmd); char *(*to_pid_to_exec_file) (struct target_ops *, int pid) TARGET_DEFAULT_RETURN (NULL);