From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14703 invoked by alias); 14 Nov 2007 17:10:09 -0000 Received: (qmail 14695 invoked by uid 22791); 14 Nov 2007 17:10:08 -0000 X-Spam-Check-By: sourceware.org Received: from mail.codesourcery.com (HELO mail.codesourcery.com) (65.74.133.4) by sourceware.org (qpsmtpd/0.31) with ESMTP; Wed, 14 Nov 2007 17:10:02 +0000 Received: (qmail 11250 invoked from network); 14 Nov 2007 17:09:59 -0000 Received: from unknown (HELO 172.16.unknown.plus.ru) (vladimir@127.0.0.2) by mail.codesourcery.com with ESMTPA; 14 Nov 2007 17:09:59 -0000 From: Vladimir Prus To: gdb-patches@sources.redhat.com Subject: Make bp_location usage const Date: Wed, 14 Nov 2007 17:10:00 -0000 User-Agent: KMail/1.9.6 MIME-Version: 1.0 Content-Type: Multipart/Mixed; boundary="Boundary-00=_jvyOHyTWjr7yyCE" Message-Id: <200711142009.55721.vladimir@codesourcery.com> Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2007-11/txt/msg00273.txt.bz2 --Boundary-00=_jvyOHyTWjr7yyCE Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Content-Disposition: inline Content-length: 236 Many parts of breakpoint.c make only read-only use of breakpoint location list. However, it's somewhat hard to gather from the code. This patch adds 'const' qualifiers in a number of places to make this really obvious. OK? - Volodya --Boundary-00=_jvyOHyTWjr7yyCE Content-Type: text/x-diff; charset="utf-8"; name="const_bp_location.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="const_bp_location.diff" Content-length: 3739 commit 27e15cd23711a14c73736baf532b7129098b32b0 Author: Vladimir Prus Date: Wed Nov 14 20:07:38 2007 +0300 Apply const qualifier to some users of bp_location. * breakpoint.h (struct bpstats): Make the breakpoint_at field point at const bp_location. * breakpoint.c (bpstat_alloc): Accept const bp_location. (breakpoint_here_p, breakpoint_inserted_here_p) (software_breakpoint_inserted_here_p) (breakpoint_thread_match, bpstat_stop_status): Use const bp_location for iteration. (print_it_typical, print_bp_stop_message): Use const bp_location variable. diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c index b67851d..d067405 100644 --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c @@ -109,7 +109,7 @@ static void breakpoints_info (char *, int); static void breakpoint_1 (int, int); -static bpstat bpstat_alloc (struct bp_location *, bpstat); +static bpstat bpstat_alloc (const struct bp_location *, bpstat); static int breakpoint_cond_eval (void *); @@ -1733,7 +1733,7 @@ breakpoint_init_inferior (enum inf_context context) enum breakpoint_here breakpoint_here_p (CORE_ADDR pc) { - struct bp_location *bpt; + const struct bp_location *bpt; int any_breakpoint_here = 0; ALL_BP_LOCATIONS (bpt) @@ -1768,7 +1768,7 @@ breakpoint_here_p (CORE_ADDR pc) int breakpoint_inserted_here_p (CORE_ADDR pc) { - struct bp_location *bpt; + const struct bp_location *bpt; ALL_BP_LOCATIONS (bpt) { @@ -1801,7 +1801,7 @@ breakpoint_inserted_here_p (CORE_ADDR pc) int software_breakpoint_inserted_here_p (CORE_ADDR pc) { - struct bp_location *bpt; + const struct bp_location *bpt; int any_breakpoint_here = 0; ALL_BP_LOCATIONS (bpt) @@ -1834,7 +1834,7 @@ software_breakpoint_inserted_here_p (CORE_ADDR pc) int breakpoint_thread_match (CORE_ADDR pc, ptid_t ptid) { - struct bp_location *bpt; + const struct bp_location *bpt; int thread; thread = pid_to_thread_id (ptid); @@ -2159,7 +2159,7 @@ print_it_typical (bpstat bs) { struct cleanup *old_chain, *ui_out_chain; struct breakpoint *b; - struct bp_location *bl; + const struct bp_location *bl; struct ui_stream *stb; stb = ui_out_stream_new (uiout); old_chain = make_cleanup_ui_out_stream_delete (stb); @@ -2440,7 +2440,7 @@ print_bp_stop_message (bpstat bs) case print_it_normal: { - struct bp_location *bl = bs->breakpoint_at; + const struct bp_location *bl = bs->breakpoint_at; struct breakpoint *b = bl ? bl->owner : NULL; /* Normal case. Call the breakpoint's print_it method, or @@ -2520,7 +2520,7 @@ breakpoint_cond_eval (void *exp) /* Allocate a new bpstat and chain it to the current one. */ static bpstat -bpstat_alloc (struct bp_location *bl, bpstat cbs /* Current "bs" value */ ) +bpstat_alloc (const struct bp_location *bl, bpstat cbs /* Current "bs" value */ ) { bpstat bs; @@ -2749,7 +2749,7 @@ bpstat bpstat_stop_status (CORE_ADDR bp_addr, ptid_t ptid) { struct breakpoint *b = NULL; - struct bp_location *bl; + const struct bp_location *bl; /* True if we've hit a breakpoint (as opposed to a watchpoint). */ int real_breakpoint = 0; /* Root of the chain of bpstat's */ diff --git a/gdb/breakpoint.h b/gdb/breakpoint.h index 7919d3f..f13d41b 100644 --- a/gdb/breakpoint.h +++ b/gdb/breakpoint.h @@ -642,7 +642,7 @@ struct bpstats place, and a bpstat reflects the fact that both have been hit. */ bpstat next; /* Breakpoint that we are at. */ - struct bp_location *breakpoint_at; + const struct bp_location *breakpoint_at; /* Commands left to be done. */ struct command_line *commands; /* Old value associated with a watchpoint. */ --Boundary-00=_jvyOHyTWjr7yyCE--