From patchwork Mon Oct 23 13:33:28 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yao Qi X-Patchwork-Id: 23763 Received: (qmail 5239 invoked by alias); 23 Oct 2017 13:33:40 -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 5215 invoked by uid 89); 23 Oct 2017 13:33:39 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-26.4 required=5.0 tests=BAYES_00, FREEMAIL_FROM, 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=homegrown, watched, H*r:sk:static. X-HELO: mail-wm0-f66.google.com Received: from mail-wm0-f66.google.com (HELO mail-wm0-f66.google.com) (74.125.82.66) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 23 Oct 2017 13:33:36 +0000 Received: by mail-wm0-f66.google.com with SMTP id t69so9578235wmt.2 for ; Mon, 23 Oct 2017 06:33:35 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id; bh=j+b/bal6XeMJHundrZTeJVLZAH4vLp3AsZCKkzODvM4=; b=IQAsuMCZKPdVA9UTN41A/UAciCS7YMApl17o6HDpVWHg79VVAB+w15oNNS3WT2qhyF SWkXXgaCP+/emW2/gzUY/sizZc6Oc+TON0yIiOOIksTlFD1QTdFgjFGyba3mDmM3oD+o qUOlYOvtNdu6gfV/0E1aj5/GrxCClL/s1y+3EGE55KfcJwSIcjxUs9kSR3y7IOI4tb+4 8YxCZs1ngLRRiZRBCYJwIIeV8fXmChPUWk15i9tR+fMPVqyG/19IVAWy/VUcMragUEhK guVTobl5NoxBmSM700gSO+W3Ax6kqcaorllx1iT5OzGGiSj3F3LZ5Bj6/yw9iXr9XCRB s/ew== X-Gm-Message-State: AMCzsaUg+gdGO6XQYwdXYbQSOzfPHO8VKjT0JCQjXWB7I3ut5Kq8sJ7A KRI0ga4fhCHlsaJ2Of3kqDSYHA== X-Google-Smtp-Source: ABhQp+RzjEYncJvdvqgielOa8pig7dVWbTT3sU0THvAP8HGQuS+KgegfJ9HiMNUL664NghhZXXbYOA== X-Received: by 10.28.71.90 with SMTP id u87mr3272303wma.91.1508765613433; Mon, 23 Oct 2017 06:33:33 -0700 (PDT) Received: from E107787-LIN.cambridge.arm.com (static.42.136.251.148.clients.your-server.de. [148.251.136.42]) by smtp.gmail.com with ESMTPSA id h185sm11100828wma.19.2017.10.23.06.33.32 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 23 Oct 2017 06:33:32 -0700 (PDT) From: Yao Qi X-Google-Original-From: Yao Qi To: gdb-patches@sourceware.org Subject: [PATCH 1/2] const-fy function parameter struct address_space *aspace Date: Mon, 23 Oct 2017 14:33:28 +0100 Message-Id: <1508765609-31149-1-git-send-email-yao.qi@linaro.org> X-IsSubscribed: yes This patch changes the parameter "struct address_space *aspace" to "const address_space *aspace" in many functions. gdb: 2017-10-22 Yao Qi * breakpoint.c (breakpoint_location_address_match): Change "struct address_space *" to "const address_space". (breakpoint_location_address_range_overlap): Likewise. (breakpoint_here_p): Likewise. (breakpoint_in_range_p): Likewise. (moribund_breakpoint_here_p): Likewise. (bp_location_inserted_here_p): Likewise. (software_breakpoint_inserted_here_p): Likewise. (hardware_breakpoint_inserted_here_p): Likewise. (hardware_watchpoint_inserted_in_range): Likewise. (bpstat_check_location): Likewise. (bpstat_stop_status): Likewise. (breakpoint_address_match): Likewise. (breakpoint_address_match_range): Likewise. (breakpoint_location_address_match): Likewise. (breakpoint_location_address_range_overlap): Likewise. (insert_single_step_breakpoint): Likewise. (breakpoint_has_location_inserted_here): Likewise. (single_step_breakpoint_inserted_here_p): Likewise. (pc_at_non_inline_function): Likewise. * breakpoint.h (bpstat_stop_status): Update declaration. (breakpoint_here_p): Likewise. (breakpoint_in_range_p): Likewise. (moribund_breakpoint_here_p): Likewise. (breakpoint_inserted_here_p): Likewise. (software_breakpoint_inserted_here_p): Likewise. (hardware_breakpoint_inserted_here_p): Likewise. (breakpoint_has_location_inserted_here): Likewise. (single_step_breakpoint_inserted_here_p): Likewise. (hardware_watchpoint_inserted_in_range): Likewise. (breakpoint_address_match): Likewise. (insert_single_step_breakpoint): Likewise. (pc_at_non_inline_function): Likewise. * gdbthread.h (thread_has_single_step_breakpoint_here): Likewise. * record.c (record_check_stopped_by_breakpoint): Likewise. * record.h (record_check_stopped_by_breakpoint): Likewise. * thread.c (thread_has_single_step_breakpoint_here): Likewise. --- gdb/breakpoint.c | 48 +++++++++++++++++++++++++----------------------- gdb/breakpoint.h | 29 +++++++++++++++-------------- gdb/gdbthread.h | 2 +- gdb/record.c | 3 ++- gdb/record.h | 2 +- gdb/thread.c | 2 +- 6 files changed, 45 insertions(+), 41 deletions(-) diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c index 32ceea7..fb9ceaf 100644 --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c @@ -158,11 +158,11 @@ static int watchpoint_locations_match (struct bp_location *loc1, struct bp_location *loc2); static int breakpoint_location_address_match (struct bp_location *bl, - struct address_space *aspace, + const struct address_space *aspace, CORE_ADDR addr); static int breakpoint_location_address_range_overlap (struct bp_location *, - struct address_space *, + const address_space *, CORE_ADDR, int); static void info_breakpoints_command (char *, int); @@ -4045,7 +4045,7 @@ breakpoint_init_inferior (enum inf_context context) the target, to advance the PC past the breakpoint. */ enum breakpoint_here -breakpoint_here_p (struct address_space *aspace, CORE_ADDR pc) +breakpoint_here_p (const address_space *aspace, CORE_ADDR pc) { struct bp_location *bl, **blp_tmp; int any_breakpoint_here = 0; @@ -4078,7 +4078,7 @@ breakpoint_here_p (struct address_space *aspace, CORE_ADDR pc) /* See breakpoint.h. */ int -breakpoint_in_range_p (struct address_space *aspace, +breakpoint_in_range_p (const address_space *aspace, CORE_ADDR addr, ULONGEST len) { struct bp_location *bl, **blp_tmp; @@ -4112,7 +4112,7 @@ breakpoint_in_range_p (struct address_space *aspace, /* Return true if there's a moribund breakpoint at PC. */ int -moribund_breakpoint_here_p (struct address_space *aspace, CORE_ADDR pc) +moribund_breakpoint_here_p (const address_space *aspace, CORE_ADDR pc) { struct bp_location *loc; int ix; @@ -4129,7 +4129,7 @@ moribund_breakpoint_here_p (struct address_space *aspace, CORE_ADDR pc) static int bp_location_inserted_here_p (struct bp_location *bl, - struct address_space *aspace, CORE_ADDR pc) + const address_space *aspace, CORE_ADDR pc) { if (bl->inserted && breakpoint_address_match (bl->pspace->aspace, bl->address, @@ -4148,7 +4148,7 @@ bp_location_inserted_here_p (struct bp_location *bl, /* Returns non-zero iff there's a breakpoint inserted at PC. */ int -breakpoint_inserted_here_p (struct address_space *aspace, CORE_ADDR pc) +breakpoint_inserted_here_p (const address_space *aspace, CORE_ADDR pc) { struct bp_location **blp, **blp_tmp = NULL; @@ -4170,7 +4170,7 @@ breakpoint_inserted_here_p (struct address_space *aspace, CORE_ADDR pc) inserted at PC. */ int -software_breakpoint_inserted_here_p (struct address_space *aspace, +software_breakpoint_inserted_here_p (const address_space *aspace, CORE_ADDR pc) { struct bp_location **blp, **blp_tmp = NULL; @@ -4192,7 +4192,7 @@ software_breakpoint_inserted_here_p (struct address_space *aspace, /* See breakpoint.h. */ int -hardware_breakpoint_inserted_here_p (struct address_space *aspace, +hardware_breakpoint_inserted_here_p (const address_space *aspace, CORE_ADDR pc) { struct bp_location **blp, **blp_tmp = NULL; @@ -4212,7 +4212,7 @@ hardware_breakpoint_inserted_here_p (struct address_space *aspace, } int -hardware_watchpoint_inserted_in_range (struct address_space *aspace, +hardware_watchpoint_inserted_in_range (const address_space *aspace, CORE_ADDR addr, ULONGEST len) { struct breakpoint *bpt; @@ -5064,7 +5064,7 @@ watchpoint_check (bpstat bs) static int bpstat_check_location (const struct bp_location *bl, - struct address_space *aspace, CORE_ADDR bp_addr, + const address_space *aspace, CORE_ADDR bp_addr, const struct target_waitstatus *ws) { struct breakpoint *b = bl->owner; @@ -5072,7 +5072,8 @@ bpstat_check_location (const struct bp_location *bl, /* BL is from an existing breakpoint. */ gdb_assert (b != NULL); - return b->ops->breakpoint_hit (bl, aspace, bp_addr, ws); + return b->ops->breakpoint_hit (bl, const_cast (aspace), + bp_addr, ws); } /* Determine if the watched values have actually changed, and we @@ -5421,7 +5422,7 @@ need_moribund_for_location_type (struct bp_location *loc) commands, FIXME??? fields. */ bpstat -bpstat_stop_status (struct address_space *aspace, +bpstat_stop_status (const address_space *aspace, CORE_ADDR bp_addr, ptid_t ptid, const struct target_waitstatus *ws) { @@ -6894,8 +6895,8 @@ watchpoint_locations_match (struct bp_location *loc1, /* See breakpoint.h. */ int -breakpoint_address_match (struct address_space *aspace1, CORE_ADDR addr1, - struct address_space *aspace2, CORE_ADDR addr2) +breakpoint_address_match (const address_space *aspace1, CORE_ADDR addr1, + const address_space *aspace2, CORE_ADDR addr2) { return ((gdbarch_has_global_breakpoints (target_gdbarch ()) || aspace1 == aspace2) @@ -6908,8 +6909,9 @@ breakpoint_address_match (struct address_space *aspace1, CORE_ADDR addr1, space doesn't really matter. */ static int -breakpoint_address_match_range (struct address_space *aspace1, CORE_ADDR addr1, - int len1, struct address_space *aspace2, +breakpoint_address_match_range (const address_space *aspace1, + CORE_ADDR addr1, + int len1, const address_space *aspace2, CORE_ADDR addr2) { return ((gdbarch_has_global_breakpoints (target_gdbarch ()) @@ -6924,7 +6926,7 @@ breakpoint_address_match_range (struct address_space *aspace1, CORE_ADDR addr1, static int breakpoint_location_address_match (struct bp_location *bl, - struct address_space *aspace, + const address_space *aspace, CORE_ADDR addr) { return (breakpoint_address_match (bl->pspace->aspace, bl->address, @@ -6943,7 +6945,7 @@ breakpoint_location_address_match (struct bp_location *bl, static int breakpoint_location_address_range_overlap (struct bp_location *bl, - struct address_space *aspace, + const address_space *aspace, CORE_ADDR addr, int len) { if (gdbarch_has_global_breakpoints (target_gdbarch ()) @@ -14537,7 +14539,7 @@ invalidate_bp_value_on_memory_change (struct inferior *inferior, void insert_single_step_breakpoint (struct gdbarch *gdbarch, - struct address_space *aspace, + const address_space *aspace, CORE_ADDR next_pc) { struct thread_info *tp = inferior_thread (); @@ -14587,7 +14589,7 @@ insert_single_step_breakpoints (struct gdbarch *gdbarch) int breakpoint_has_location_inserted_here (struct breakpoint *bp, - struct address_space *aspace, + const address_space *aspace, CORE_ADDR pc) { struct bp_location *loc; @@ -14604,7 +14606,7 @@ breakpoint_has_location_inserted_here (struct breakpoint *bp, PC. */ int -single_step_breakpoint_inserted_here_p (struct address_space *aspace, +single_step_breakpoint_inserted_here_p (const address_space *aspace, CORE_ADDR pc) { struct breakpoint *bpt; @@ -15314,7 +15316,7 @@ is_non_inline_function (struct breakpoint *b) have been inlined. */ int -pc_at_non_inline_function (struct address_space *aspace, CORE_ADDR pc, +pc_at_non_inline_function (const address_space *aspace, CORE_ADDR pc, const struct target_waitstatus *ws) { struct breakpoint *b; diff --git a/gdb/breakpoint.h b/gdb/breakpoint.h index 2b80ed9..c4e55ea 100644 --- a/gdb/breakpoint.h +++ b/gdb/breakpoint.h @@ -912,7 +912,7 @@ extern void bpstat_clear (bpstat *); is part of the bpstat is copied as well. */ extern bpstat bpstat_copy (bpstat); -extern bpstat bpstat_stop_status (struct address_space *aspace, +extern bpstat bpstat_stop_status (const address_space *aspace, CORE_ADDR pc, ptid_t ptid, const struct target_waitstatus *ws); @@ -1158,41 +1158,42 @@ enum breakpoint_here extern int program_breakpoint_here_p (struct gdbarch *gdbarch, CORE_ADDR address); -extern enum breakpoint_here breakpoint_here_p (struct address_space *, +extern enum breakpoint_here breakpoint_here_p (const address_space *, CORE_ADDR); /* Return true if an enabled breakpoint exists in the range defined by ADDR and LEN, in ASPACE. */ -extern int breakpoint_in_range_p (struct address_space *aspace, +extern int breakpoint_in_range_p (const address_space *aspace, CORE_ADDR addr, ULONGEST len); -extern int moribund_breakpoint_here_p (struct address_space *, CORE_ADDR); +extern int moribund_breakpoint_here_p (const address_space *, CORE_ADDR); -extern int breakpoint_inserted_here_p (struct address_space *, CORE_ADDR); +extern int breakpoint_inserted_here_p (const address_space *, + CORE_ADDR); extern int regular_breakpoint_inserted_here_p (struct address_space *, CORE_ADDR); -extern int software_breakpoint_inserted_here_p (struct address_space *, +extern int software_breakpoint_inserted_here_p (const address_space *, CORE_ADDR); /* Return non-zero iff there is a hardware breakpoint inserted at PC. */ -extern int hardware_breakpoint_inserted_here_p (struct address_space *, +extern int hardware_breakpoint_inserted_here_p (const address_space *, CORE_ADDR); /* Check whether any location of BP is inserted at PC. */ extern int breakpoint_has_location_inserted_here (struct breakpoint *bp, - struct address_space *aspace, + const address_space *aspace, CORE_ADDR pc); -extern int single_step_breakpoint_inserted_here_p (struct address_space *, +extern int single_step_breakpoint_inserted_here_p (const address_space *, CORE_ADDR); /* Returns true if there's a hardware watchpoint or access watchpoint inserted in the range defined by ADDR and LEN. */ -extern int hardware_watchpoint_inserted_in_range (struct address_space *, +extern int hardware_watchpoint_inserted_in_range (const address_space *, CORE_ADDR addr, ULONGEST len); @@ -1201,9 +1202,9 @@ extern int hardware_watchpoint_inserted_in_range (struct address_space *, if ASPACE1 matches ASPACE2. On targets that have global breakpoints, the address space doesn't really matter. */ -extern int breakpoint_address_match (struct address_space *aspace1, +extern int breakpoint_address_match (const address_space *aspace1, CORE_ADDR addr1, - struct address_space *aspace2, + const address_space *aspace2, CORE_ADDR addr2); extern void until_break_command (const char *, int, int); @@ -1519,7 +1520,7 @@ extern void add_solib_catchpoint (const char *arg, int is_load, int is_temp, new location to the set of potential addresses the next instruction is at. */ extern void insert_single_step_breakpoint (struct gdbarch *, - struct address_space *, + const address_space *, CORE_ADDR); /* Insert all software single step breakpoints for the current frame. @@ -1617,7 +1618,7 @@ extern struct breakpoint *iterate_over_breakpoints (int (*) (struct breakpoint * /* Nonzero if the specified PC cannot be a location where functions have been inlined. */ -extern int pc_at_non_inline_function (struct address_space *aspace, +extern int pc_at_non_inline_function (const address_space *aspace, CORE_ADDR pc, const struct target_waitstatus *ws); diff --git a/gdb/gdbthread.h b/gdb/gdbthread.h index aa34661..49fc80f 100644 --- a/gdb/gdbthread.h +++ b/gdb/gdbthread.h @@ -410,7 +410,7 @@ extern int thread_has_single_step_breakpoints_set (struct thread_info *tp); /* Check whether the thread has software single stepping breakpoints set at PC. */ extern int thread_has_single_step_breakpoint_here (struct thread_info *tp, - struct address_space *aspace, + const address_space *aspace, CORE_ADDR addr); /* Translate the global integer thread id (GDB's homegrown id, not the diff --git a/gdb/record.c b/gdb/record.c index 5ecdcfc..d1d7541 100644 --- a/gdb/record.c +++ b/gdb/record.c @@ -234,7 +234,8 @@ record_kill (struct target_ops *t) /* See record.h. */ int -record_check_stopped_by_breakpoint (struct address_space *aspace, CORE_ADDR pc, +record_check_stopped_by_breakpoint (const address_space *aspace, + CORE_ADDR pc, enum target_stop_reason *reason) { if (breakpoint_inserted_here_p (aspace, pc)) diff --git a/gdb/record.h b/gdb/record.h index a54a08f..3fc17e4 100644 --- a/gdb/record.h +++ b/gdb/record.h @@ -71,7 +71,7 @@ DEF_ENUM_FLAGS_TYPE (enum record_print_flag, record_print_flags); otherwise. */ extern int - record_check_stopped_by_breakpoint (struct address_space *aspace, + record_check_stopped_by_breakpoint (const address_space *aspace, CORE_ADDR pc, enum target_stop_reason *reason); diff --git a/gdb/thread.c b/gdb/thread.c index df04b4e..f614097 100644 --- a/gdb/thread.c +++ b/gdb/thread.c @@ -156,7 +156,7 @@ thread_has_single_step_breakpoints_set (struct thread_info *tp) int thread_has_single_step_breakpoint_here (struct thread_info *tp, - struct address_space *aspace, + const address_space *aspace, CORE_ADDR addr) { struct breakpoint *ss_bps = tp->control.single_step_breakpoints;