From patchwork Thu Sep 21 05:10:17 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 23052 Received: (qmail 74378 invoked by alias); 21 Sep 2017 05:42:11 -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 74211 invoked by uid 89); 21 Sep 2017 05:42:11 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-26.1 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, RCVD_IN_SORBS_SPAM, SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: gproxy2-pub.mail.unifiedlayer.com Received: from gproxy2-pub.mail.unifiedlayer.com (HELO gproxy2-pub.mail.unifiedlayer.com) (69.89.18.3) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 21 Sep 2017 05:42:09 +0000 Received: from CMOut01 (unknown [10.0.90.82]) by gproxy2.mail.unifiedlayer.com (Postfix) with ESMTP id 1707A1E0D6B for ; Wed, 20 Sep 2017 23:41:22 -0600 (MDT) Received: from box522.bluehost.com ([74.220.219.122]) by CMOut01 with id C5hK1w0012f2jeq015hNPw; Wed, 20 Sep 2017 23:41:22 -0600 X-Authority-Analysis: v=2.2 cv=K4VSJ2eI c=1 sm=1 tr=0 a=GsOEXm/OWkKvwdLVJsfwcA==:117 a=GsOEXm/OWkKvwdLVJsfwcA==:17 a=2JCJgTwv5E4A:10 a=zstS-IiYAAAA:8 a=UaK4YpL-sP2PjaZeatsA:9 a=nMPXlMfcd15qJsK4:21 a=8lzJ6ZJhPVocArVx:21 a=4G6NA9xxw8l3yy4pmD5M:22 Received: from 75-166-76-94.hlrn.qwest.net ([75.166.76.94]:36574 helo=bapiya.Home) by box522.bluehost.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.87) (envelope-from ) id 1dutl1-00118R-Vm; Wed, 20 Sep 2017 23:10:40 -0600 From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [RFA 61/67] Constify some commands in breakpoint.c Date: Wed, 20 Sep 2017 23:10:17 -0600 Message-Id: <20170921051023.19023-62-tom@tromey.com> In-Reply-To: <20170921051023.19023-1-tom@tromey.com> References: <20170921051023.19023-1-tom@tromey.com> X-BWhitelist: no X-Exim-ID: 1dutl1-00118R-Vm X-Source-Sender: 75-166-76-94.hlrn.qwest.net (bapiya.Home) [75.166.76.94]:36574 X-Source-Auth: tom+tromey.com X-Email-Count: 66 X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTIyLmJsdWVob3N0LmNvbQ== X-Local-Domain: yes This also makes delete_command static; but now I wonder if it is used in Insight and should not be touched. ChangeLog 2017-09-20 Tom Tromey * breakpoint.h (delete_command): Don't declare. * breakpoint.c (delete_command, enable_once_command) (enable_count_command, enable_delete_command, breakpoint_1) (maintenance_info_breakpoints, stopin_command, stopat_command) (delete_command, delete_trace_command, save_breakpoints) (save_breakpoints_command, save_tracepoints_command): Constify. --- gdb/ChangeLog | 9 +++++++++ gdb/breakpoint.c | 45 ++++++++++++++------------------------------- gdb/breakpoint.h | 4 ---- 3 files changed, 23 insertions(+), 35 deletions(-) diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c index 1073418..59cb354 100644 --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c @@ -94,12 +94,6 @@ enum exception_event_kind /* Prototypes for local functions. */ -static void enable_delete_command (char *, int); - -static void enable_once_command (char *, int); - -static void enable_count_command (char *, int); - static void disable_command (char *, int); static void enable_command (char *, int); @@ -184,9 +178,6 @@ static void info_breakpoints_command (char *, int); static void info_watchpoints_command (char *, int); -static int breakpoint_1 (char *, int, - int (*) (const struct breakpoint *)); - static int breakpoint_cond_eval (void *); static void cleanup_executing_breakpoints (void *); @@ -202,8 +193,6 @@ static enum print_stop_action print_bp_stop_message (bpstat bs); static int watchpoint_check (void *); -static void maintenance_info_breakpoints (char *, int); - static int hw_breakpoint_used_count (void); static int hw_watchpoint_use_count (struct breakpoint *); @@ -221,10 +210,6 @@ static void enable_breakpoint_disp (struct breakpoint *, enum bpdisp, static void stop_command (char *arg, int from_tty); -static void stopin_command (char *arg, int from_tty); - -static void stopat_command (char *arg, int from_tty); - static void tcatch_command (char *arg, int from_tty); static void free_bp_location (struct bp_location *loc); @@ -278,8 +263,6 @@ static void insert_breakpoint_locations (void); static void info_tracepoints_command (char *, int); -static void delete_trace_command (char *, int); - static void enable_trace_command (char *, int); static void disable_trace_command (char *, int); @@ -6679,7 +6662,7 @@ pending_breakpoint_p (struct breakpoint *b) breakpoints listed. */ static int -breakpoint_1 (char *args, int allflag, +breakpoint_1 (const char *args, int allflag, int (*filter) (const struct breakpoint *)) { struct breakpoint *b; @@ -6864,7 +6847,7 @@ info_watchpoints_command (char *args, int from_tty) } static void -maintenance_info_breakpoints (char *args, int from_tty) +maintenance_info_breakpoints (const char *args, int from_tty) { breakpoint_1 (args, 1, NULL); @@ -9795,7 +9778,7 @@ Usage: stop in \n\ } static void -stopin_command (char *arg, int from_tty) +stopin_command (const char *arg, int from_tty) { int badInput = 0; @@ -9803,7 +9786,7 @@ stopin_command (char *arg, int from_tty) badInput = 1; else if (*arg != '*') { - char *argptr = arg; + const char *argptr = arg; int hasColon = 0; /* Look for a ':'. If this is a line number specification, then @@ -9828,7 +9811,7 @@ stopin_command (char *arg, int from_tty) } static void -stopat_command (char *arg, int from_tty) +stopat_command (const char *arg, int from_tty) { int badInput = 0; @@ -9836,7 +9819,7 @@ stopat_command (char *arg, int from_tty) badInput = 1; else { - char *argptr = arg; + const char *argptr = arg; int hasColon = 0; /* Look for a ':'. If there is a '::' then get out, otherwise @@ -13568,7 +13551,7 @@ iterate_over_related_breakpoints (struct breakpoint *b, while (related != b); } -void +static void delete_command (char *arg, int from_tty) { struct breakpoint *b, *b_tmp; @@ -14596,7 +14579,7 @@ enable_command (char *args, int from_tty) } static void -enable_once_command (char *args, int from_tty) +enable_once_command (const char *args, int from_tty) { map_breakpoint_numbers (args, [&] (breakpoint *b) @@ -14610,7 +14593,7 @@ enable_once_command (char *args, int from_tty) } static void -enable_count_command (char *args, int from_tty) +enable_count_command (const char *args, int from_tty) { int count; @@ -14631,7 +14614,7 @@ enable_count_command (char *args, int from_tty) } static void -enable_delete_command (char *args, int from_tty) +enable_delete_command (const char *args, int from_tty) { map_breakpoint_numbers (args, [&] (breakpoint *b) @@ -15014,7 +14997,7 @@ disable_trace_command (char *args, int from_tty) /* Remove a tracepoint (or all if no argument). */ static void -delete_trace_command (char *arg, int from_tty) +delete_trace_command (const char *arg, int from_tty) { struct breakpoint *b, *b_tmp; @@ -15208,7 +15191,7 @@ print_recreate_thread (struct breakpoint *b, struct ui_file *fp) non-zero. */ static void -save_breakpoints (char *filename, int from_tty, +save_breakpoints (const char *filename, int from_tty, int (*filter) (const struct breakpoint *)) { struct breakpoint *tp; @@ -15326,7 +15309,7 @@ save_breakpoints (char *filename, int from_tty, /* The `save breakpoints' command. */ static void -save_breakpoints_command (char *args, int from_tty) +save_breakpoints_command (const char *args, int from_tty) { save_breakpoints (args, from_tty, NULL); } @@ -15334,7 +15317,7 @@ save_breakpoints_command (char *args, int from_tty) /* The `save tracepoints' command. */ static void -save_tracepoints_command (char *args, int from_tty) +save_tracepoints_command (const char *args, int from_tty) { save_breakpoints (args, from_tty, is_tracepoint); } diff --git a/gdb/breakpoint.h b/gdb/breakpoint.h index 154ff3a..ff49cd2 100644 --- a/gdb/breakpoint.h +++ b/gdb/breakpoint.h @@ -1521,10 +1521,6 @@ extern int is_catchpoint (struct breakpoint *); extern void add_solib_catchpoint (const char *arg, int is_load, int is_temp, int enabled); -/* Enable breakpoints and delete when hit. Called with ARG == NULL - deletes all breakpoints. */ -extern void delete_command (char *arg, int from_tty); - /* Create and insert a new software single step breakpoint for the current thread. May be called multiple times; each time will add a new location to the set of potential addresses the next instruction