const-fy function parameter struct address_space *aspace
authorYao Qi <yao.qi@linaro.org>
Thu, 26 Oct 2017 08:46:16 +0000 (09:46 +0100)
committerYao Qi <yao.qi@linaro.org>
Thu, 26 Oct 2017 08:46:16 +0000 (09:46 +0100)
This patch changes the parameter "struct address_space *aspace" to "const
address_space *aspace" in many functions.

gdb:

2017-10-26  Yao Qi  <yao.qi@linaro.org>

* 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
gdb/breakpoint.c
gdb/breakpoint.h
gdb/gdbthread.h
gdb/record.c
gdb/record.h
gdb/thread.c

index 3c7179707e831cbe2a3967ff0987adcba2c95deb..042c60917c5c97a0a5974b805fc0b102585896c7 100644 (file)
@@ -1,3 +1,43 @@
+2017-10-26  Yao Qi  <yao.qi@linaro.org>
+
+       * 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  <yao.qi@linaro.org>
 
        * aarch32-linux-nat.c (aarch32_gp_regcache_supply): Use
index e16cfb69755856a6776bafc993aab9e5e8af0cf5..f0a8d496870eb18310069e7319cc3ffef199750e 100644 (file)
@@ -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<address_space *> (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;
index 2b80ed9f46a0b880bbfc54b8019410e36b5859ff..c4e55ea09aaa1412e454360f89f64b78a85a9be6 100644 (file)
@@ -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);
 \f
@@ -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);
 
index aa346610f15d10974f9665bf0b3b0b5b4354a4c9..49fc80f27d58229f203654b74cb81fa1e33ddc17 100644 (file)
@@ -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
index 5ecdcfc5f98834dc2e0742e1c26833a5eb91b419..d1d75414e1590871d20c3a5e0aa9d16cdb4f552f 100644 (file)
@@ -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))
index a54a08fb9cbb9d035481f1443371ead927963d0e..3fc17e410481f136955acc1a489738aac93e08ba 100644 (file)
@@ -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);
 
index df04b4ed6a1464549e754502aa7b3a1dfa1b694d..f6140979265b13e29fad0ec92d34927873b32256 100644 (file)
@@ -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;
This page took 0.060017 seconds and 4 git commands to generate.