From accd0bcdfe6914193bba8dec9e6311e608b5c498 Mon Sep 17 00:00:00 2001 From: Yao Qi Date: Thu, 26 Oct 2017 09:46:16 +0100 Subject: const-fy function parameter struct address_space *aspace This patch changes the parameter "struct address_space *aspace" to "const address_space *aspace" in many functions. gdb: 2017-10-26 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/ChangeLog | 40 ++++++++++++++++++++++++++++++++++++++++ gdb/breakpoint.c | 48 +++++++++++++++++++++++++----------------------- gdb/breakpoint.h | 29 +++++++++++++++-------------- gdb/gdbthread.h | 2 +- gdb/record.c | 3 ++- gdb/record.h | 2 +- gdb/thread.c | 2 +- 7 files changed, 85 insertions(+), 41 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 3c71797..042c609 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,43 @@ +2017-10-26 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. + 2017-10-25 Yao Qi * aarch32-linux-nat.c (aarch32_gp_regcache_supply): Use diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c index e16cfb6..f0a8d49 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 ()) @@ -14536,7 +14538,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 (); @@ -14586,7 +14588,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; @@ -14603,7 +14605,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; @@ -15313,7 +15315,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; -- cgit v1.1