gdb/mi: make current_token a field of mi_interp
[binutils-gdb.git] / gdb / breakpoint.h
index b0ca4e98eb4012015d67f60d3ee612bff5408547..1a73d08a88723093706b816fd8a1058d4d9e6258 100644 (file)
@@ -1,5 +1,5 @@
 /* Data structures associated with breakpoints in GDB.
-   Copyright (C) 1992-2022 Free Software Foundation, Inc.
+   Copyright (C) 1992-2023 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -35,6 +35,7 @@
 #include "gdbsupport/refcounted-object.h"
 #include "gdbsupport/safe-iterator.h"
 #include "cli/cli-script.h"
+#include "target/waitstatus.h"
 
 struct block;
 struct gdbpy_breakpoint_object;
@@ -314,15 +315,15 @@ enum bp_loc_type
 {
   bp_loc_software_breakpoint,
   bp_loc_hardware_breakpoint,
+  bp_loc_software_watchpoint,
   bp_loc_hardware_watchpoint,
+  bp_loc_tracepoint,
   bp_loc_other                 /* Miscellaneous...  */
 };
 
-class bp_location : public refcounted_object
+class bp_location : public refcounted_object, public intrusive_list_node<bp_location>
 {
 public:
-  bp_location () = default;
-
   /* Construct a bp_location with the type inferred from OWNER's
      type.  */
   explicit bp_location (breakpoint *owner);
@@ -332,10 +333,6 @@ public:
 
   virtual ~bp_location () = default;
 
-  /* Chain pointer to the next breakpoint location for
-     the same parent breakpoint.  */
-  bp_location *next = NULL;
-
   /* Type of this breakpoint location.  */
   bp_loc_type loc_type {};
 
@@ -501,7 +498,7 @@ public:
   struct symtab *symtab = NULL;
 
   /* The symbol found by the location parser, if any.  This may be used to
-     ascertain when an event location was set at a different location than
+     ascertain when a location spec was set at a different location than
      the one originally selected by parsing, e.g., inlined symbols.  */
   const struct symbol *symbol = NULL;
 
@@ -512,6 +509,10 @@ public:
 
   /* The objfile the symbol or minimal symbol were found in.  */
   const struct objfile *objfile = NULL;
+
+  /* Return a string representation of the bp_location.
+     This is only meant to be used in debug messages.  */
+  std::string to_string () const;
 };
 
 /* A policy class for bp_location reference counting.  */
@@ -561,14 +562,15 @@ enum print_stop_action
 
 struct breakpoint_ops
 {
-  /* Create SALs from location, storing the result in linespec_result.
+  /* Create SALs from location spec, storing the result in
+     linespec_result.
 
      For an explanation about the arguments, see the function
-     `create_sals_from_location_default'.
+     `create_sals_from_location_spec_default'.
 
      This function is called inside `create_breakpoint'.  */
-  void (*create_sals_from_location) (struct event_location *location,
-                                    struct linespec_result *canonical);
+  void (*create_sals_from_location_spec) (location_spec *locspec,
+                                         struct linespec_result *canonical);
 
   /* This method will be responsible for creating a breakpoint given its SALs.
      Usually, it just calls `create_breakpoints_sal' (for ordinary
@@ -581,9 +583,8 @@ struct breakpoint_ops
                                  struct linespec_result *,
                                  gdb::unique_xmalloc_ptr<char>,
                                  gdb::unique_xmalloc_ptr<char>,
-                                 enum bptype, enum bpdisp, int, int,
-                                 int, const struct breakpoint_ops *,
-                                 int, int, int, unsigned);
+                                 enum bptype, enum bpdisp, int, int, int,
+                                 int, int, int, int, unsigned);
 };
 
 enum watchpoint_triggered
@@ -606,9 +607,9 @@ enum watchpoint_triggered
 
 extern bool target_exact_watchpoints;
 
-/* bp_location linked list range.  */
-
-using bp_location_range = next_range<bp_location>;
+using bp_location_list = intrusive_list<bp_location>;
+using bp_location_iterator = bp_location_list::iterator;
+using bp_location_range = iterator_range<bp_location_iterator>;
 
 /* Note that the ->silent field is not currently used by any commands
    (though the code is in there if it was to be, and set_raw_breakpoint
@@ -616,15 +617,89 @@ using bp_location_range = next_range<bp_location>;
    useful for a hack I had to put in; I'm going to leave it in because
    I can see how there might be times when it would indeed be useful */
 
-/* This is for all kinds of breakpoints.  */
+/* Abstract base class representing all kinds of breakpoints.  */
 
-struct breakpoint
+struct breakpoint : public intrusive_list_node<breakpoint>
 {
-  virtual ~breakpoint () = default;
+  breakpoint (struct gdbarch *gdbarch_, enum bptype bptype,
+             bool temp = true, const char *cond_string = nullptr);
+
+  DISABLE_COPY_AND_ASSIGN (breakpoint);
+
+  virtual ~breakpoint () = 0;
 
   /* Allocate a location for this breakpoint.  */
   virtual struct bp_location *allocate_location ();
 
+  /* Return a range of this breakpoint's locations.  */
+  bp_location_range locations () const;
+
+  /* Add LOC to the location list of this breakpoint, sorted by address
+     (using LOC.ADDRESS).
+
+     LOC must have this breakpoint as its owner.  LOC must not already be linked
+     in a location list.  */
+  void add_location (bp_location &loc);
+
+  /* Remove LOC from this breakpoint's location list.  The name is a bit funny
+     because remove_location is already taken, and means something else.
+
+     LOC must be have this breakpoints as its owner.  LOC must be linked in this
+     breakpoint's location list.  */
+  void unadd_location (bp_location &loc);
+
+  /* Clear the location list of this breakpoint.  */
+  void clear_locations ()
+  { m_locations.clear (); }
+
+  /* Split all locations of this breakpoint that are bound to PSPACE out of its
+     location list to a separate list and return that list.  If
+     PSPACE is nullptr, hoist out all locations.  */
+  bp_location_list steal_locations (program_space *pspace);
+
+  /* Return true if this breakpoint has a least one location.  */
+  bool has_locations () const
+  { return !m_locations.empty (); }
+
+  /* Return true if this breakpoint has a single location.  */
+  bool has_single_location () const
+  {
+    if (!this->has_locations ())
+      return false;
+
+    return std::next (m_locations.begin ()) == m_locations.end ();
+  }
+
+  /* Return true if this breakpoint has multiple locations.  */
+  bool has_multiple_locations () const
+  {
+    if (!this->has_locations ())
+      return false;
+
+    return std::next (m_locations.begin ()) != m_locations.end ();
+  }
+
+  /* Return a reference to the first location of this breakpoint.  */
+  bp_location &first_loc ()
+  {
+    gdb_assert (this->has_locations ());
+    return m_locations.front ();
+  }
+
+  /* Return a reference to the first location of this breakpoint.  */
+  const bp_location &first_loc () const
+  {
+    gdb_assert (this->has_locations ());
+    return m_locations.front ();
+  }
+
+  /* Return a reference to the last location of this breakpoint.  */
+  const bp_location &last_loc () const
+  {
+    gdb_assert (this->has_locations ());
+    return m_locations.back ();
+  }
+
   /* Reevaluate a breakpoint.  This is necessary after symbols change
      (e.g., an executable or DSO was loaded, or the inferior just
      started).  */
@@ -657,7 +732,8 @@ struct breakpoint
                              const target_waitstatus &ws);
 
   /* Check internal conditions of the breakpoint referred to by BS.
-     If we should not stop for this breakpoint, set BS->stop to 0.  */
+     If we should not stop for this breakpoint, set BS->stop to
+     false.  */
   virtual void check_status (struct bpstat *bs)
   {
     /* Always stop.  */
@@ -668,19 +744,14 @@ struct breakpoint
      the breakpoint or watchpoint needs one debug register.  */
   virtual int resources_needed (const struct bp_location *);
 
-  /* Tell whether we can downgrade from a hardware watchpoint to a software
-     one.  If not, the user will not be able to enable the watchpoint when
-     there are not enough hardware resources available.  */
-  virtual int works_in_software_mode () const;
-
   /* The normal print routine for this breakpoint, called when we
      hit it.  */
-  virtual enum print_stop_action print_it (struct bpstat *bs);
+  virtual enum print_stop_action print_it (const bpstat *bs) const;
 
   /* Display information about this breakpoint, for "info
      breakpoints".  Returns false if this method should use the
      default behavior.  */
-  virtual bool print_one (struct bp_location **)
+  virtual bool print_one (const bp_location **) const
   {
     return false;
   }
@@ -689,7 +760,7 @@ struct breakpoint
      breakpoint description in "info breakpoints".
 
      In the example below, the "address range" line was printed
-     by print_one_detail_ranged_breakpoint.
+     by ranged_breakpoint::print_one_detail.
 
      (gdb) info breakpoints
      Num     Type           Disp Enb Address    What
@@ -704,26 +775,16 @@ struct breakpoint
 
   /* Display information about this breakpoint after setting it
      (roughly speaking; this is called from "mention").  */
-  virtual void print_mention ();
+  virtual void print_mention () const;
 
   /* Print to FP the CLI command that recreates this breakpoint.  */
-  virtual void print_recreate (struct ui_file *fp);
-
-  /* Given the location (second parameter), this method decodes it and
-     returns the SAL locations related to it.  For ordinary
-     breakpoints, it calls `decode_line_full'.  If SEARCH_PSPACE is
-     not NULL, symbol search is restricted to just that program space.
-
-     This function is called inside `location_to_sals'.  */
-  virtual std::vector<symtab_and_line> decode_location
-    (struct event_location *location,
-     struct program_space *search_pspace);
+  virtual void print_recreate (struct ui_file *fp) const;
 
   /* Return true if this breakpoint explains a signal.  See
      bpstat_explains_signal.  */
-  virtual int explains_signal (enum gdb_signal)
+  virtual bool explains_signal (enum gdb_signal)
   {
-    return 1;
+    return true;
   }
 
   /* Called after evaluating the breakpoint's condition,
@@ -733,10 +794,6 @@ struct breakpoint
     /* Nothing to do.  */
   }
 
-  /* Return a range of this breakpoint's locations.  */
-  bp_location_range locations ();
-
-  breakpoint *next = NULL;
   /* Type of breakpoint.  */
   bptype type = bp_none;
   /* Zero means disabled; remember the info but don't break here.  */
@@ -746,9 +803,6 @@ struct breakpoint
   /* Number assigned to distinguish breakpoints.  */
   int number = 0;
 
-  /* Location(s) associated with this high-level breakpoint.  */
-  bp_location *loc = NULL;
-
   /* True means a silent breakpoint (don't print frame info if we stop
      here).  */
   bool silent = false;
@@ -774,23 +828,23 @@ struct breakpoint
      non-thread-specific ordinary breakpoints this is NULL.  */
   program_space *pspace = NULL;
 
-  /* Location we used to set the breakpoint.  */
-  event_location_up location;
+  /* The location specification we used to set the breakpoint.  */
+  location_spec_up locspec;
 
   /* The filter that should be passed to decode_line_full when
      re-setting this breakpoint.  This may be NULL.  */
   gdb::unique_xmalloc_ptr<char> filter;
 
-  /* For a ranged breakpoint, the location we used to find the end of
-     the range.  */
-  event_location_up location_range_end;
+  /* For a ranged breakpoint, the location specification we used to
+     find the end of the range.  */
+  location_spec_up locspec_range_end;
 
   /* Architecture we used to set the breakpoint.  */
-  struct gdbarch *gdbarch = NULL;
+  struct gdbarch *gdbarch;
   /* Language we used to set the breakpoint.  */
-  enum language language = language_unknown;
+  enum language language;
   /* Input radix we used to set the breakpoint.  */
-  int input_radix = 0;
+  int input_radix;
   /* String form of the breakpoint condition (malloc'd), or NULL if
      there is no condition.  */
   gdb::unique_xmalloc_ptr<char> cond_string;
@@ -803,15 +857,19 @@ struct breakpoint
      using watchpoints on local variables (might the concept of a
      related breakpoint be useful elsewhere, if not just call it the
      watchpoint_scope breakpoint or something like that.  FIXME).  */
-  breakpoint *related_breakpoint = NULL;
+  breakpoint *related_breakpoint;
 
   /* Thread number for thread-specific breakpoint, or -1 if don't
      care.  */
   int thread = -1;
 
-  /* Ada task number for task-specific breakpoint, or 0 if don't
+  /* Inferior number for inferior-specific breakpoint, or -1 if this
+     breakpoint is for all inferiors.  */
+  int inferior = -1;
+
+  /* Ada task number for task-specific breakpoint, or -1 if don't
      care.  */
-  int task = 0;
+  int task = -1;
 
   /* Count of the number of times this breakpoint was taken, dumped
      with the info, but not used for anything else.  Useful for seeing
@@ -844,13 +902,39 @@ protected:
      thread 1", which needs outputting before any breakpoint-type
      specific extra command necessary for B's recreation.  */
   void print_recreate_thread (struct ui_file *fp) const;
+
+  /* Location(s) associated with this high-level breakpoint.  */
+  bp_location_list m_locations;
 };
 
-/* The structure to be inherit by all kinds of breakpoints (real
-   breakpoints, i.e., user "break" breakpoints, internal and momentary
-   breakpoints, etc.).  */
-struct base_breakpoint : public breakpoint
+/* Abstract base class representing code breakpoints.  User "break"
+   breakpoints, internal and momentary breakpoints, etc.  IOW, any
+   kind of breakpoint whose locations are created from SALs.  */
+struct code_breakpoint : public breakpoint
 {
+  using breakpoint::breakpoint;
+
+  /* Create a breakpoint with SALS as locations.  Use LOCATION as a
+     description of the location, and COND_STRING as condition
+     expression.  If LOCATION is NULL then create an "address
+     location" from the address in the SAL.  */
+  code_breakpoint (struct gdbarch *gdbarch, bptype type,
+                  gdb::array_view<const symtab_and_line> sals,
+                  location_spec_up &&locspec,
+                  gdb::unique_xmalloc_ptr<char> filter,
+                  gdb::unique_xmalloc_ptr<char> cond_string,
+                  gdb::unique_xmalloc_ptr<char> extra_string,
+                  enum bpdisp disposition,
+                  int thread, int task, int inferior, int ignore_count,
+                  int from_tty,
+                  int enabled, unsigned flags,
+                  int display_canonical);
+
+  ~code_breakpoint () override = 0;
+
+  /* Add a location for SAL to this breakpoint.  */
+  bp_location *add_location (const symtab_and_line &sal);
+
   void re_set () override;
   int insert_location (struct bp_location *) override;
   int remove_location (struct bp_location *,
@@ -859,15 +943,42 @@ struct base_breakpoint : public breakpoint
                      const address_space *aspace,
                      CORE_ADDR bp_addr,
                      const target_waitstatus &ws) override;
-  std::vector<symtab_and_line> decode_location
-       (struct event_location *location,
-       struct program_space *search_pspace) override;
+
+protected:
+
+  /* Given the location spec, this method decodes it and returns the
+     SAL locations related to it.  For ordinary breakpoints, it calls
+     `decode_line_full'.  If SEARCH_PSPACE is not NULL, symbol search
+     is restricted to just that program space.
+
+     This function is called inside `location_spec_to_sals'.  */
+  virtual std::vector<symtab_and_line> decode_location_spec
+    (location_spec *locspec,
+     struct program_space *search_pspace);
+
+  /* Helper method that does the basic work of re_set.  */
+  void re_set_default ();
+
+  /* Find the SaL locations corresponding to the given LOCATION.
+     On return, FOUND will be 1 if any SaL was found, zero otherwise.  */
+
+  std::vector<symtab_and_line> location_spec_to_sals
+       (location_spec *locspec,
+       struct program_space *search_pspace,
+       int *found);
+
+  /* Helper for breakpoint and tracepoint breakpoint->mention
+     callbacks.  */
+  void say_where () const;
 };
 
-/* An instance of this type is used to represent a watchpoint.  */
+/* An instance of this type is used to represent a watchpoint,
+   a.k.a. a data breakpoint.  */
 
 struct watchpoint : public breakpoint
 {
+  using breakpoint::breakpoint;
+
   void re_set () override;
   int insert_location (struct bp_location *) override;
   int remove_location (struct bp_location *,
@@ -878,11 +989,16 @@ struct watchpoint : public breakpoint
                      const target_waitstatus &ws) override;
   void check_status (struct bpstat *bs) override;
   int resources_needed (const struct bp_location *) override;
-  int works_in_software_mode () const override;
-  enum print_stop_action print_it (struct bpstat *bs) override;
-  void print_mention () override;
-  void print_recreate (struct ui_file *fp) override;
-  int explains_signal (enum gdb_signal) override;
+
+  /* Tell whether we can downgrade from a hardware watchpoint to a software
+     one.  If not, the user will not be able to enable the watchpoint when
+     there are not enough hardware resources available.  */
+  virtual bool works_in_software_mode () const;
+
+  enum print_stop_action print_it (const bpstat *bs) const override;
+  void print_mention () const override;
+  void print_recreate (struct ui_file *fp) const override;
+  bool explains_signal (enum gdb_signal) override;
 
   /* String form of exp to use for displaying to the user (malloc'd),
      or NULL if none.  */
@@ -954,34 +1070,31 @@ extern bool is_exception_catchpoint (breakpoint *bp);
 /* An instance of this type is used to represent all kinds of
    tracepoints.  */
 
-struct tracepoint : public breakpoint
+struct tracepoint : public code_breakpoint
 {
-  void re_set () override;
+  using code_breakpoint::code_breakpoint;
+
   int breakpoint_hit (const struct bp_location *bl,
                      const address_space *aspace, CORE_ADDR bp_addr,
                      const target_waitstatus &ws) override;
   void print_one_detail (struct ui_out *uiout) const override;
-  void print_mention () override;
-  void print_recreate (struct ui_file *fp) override;
-  std::vector<symtab_and_line> decode_location
-       (struct event_location *location,
-       struct program_space *search_pspace) override;
-
+  void print_mention () const override;
+  void print_recreate (struct ui_file *fp) const override;
 
   /* Number of times this tracepoint should single-step and collect
      additional data.  */
-  long step_count;
+  long step_count = 0;
 
   /* Number of times this tracepoint should be hit before
      disabling/ending.  */
-  int pass_count;
+  int pass_count = 0;
 
   /* The number of the tracepoint on the target.  */
-  int number_on_target;
+  int number_on_target = 0;
 
   /* The total space taken by all the trace frames for this
      tracepoint.  */
-  ULONGEST traceframe_usage;
+  ULONGEST traceframe_usage = 0;
 
   /* The static tracepoint marker id, if known.  */
   std::string static_trace_marker_id;
@@ -992,7 +1105,18 @@ struct tracepoint : public breakpoint
      the array of markers we found for the given marker ID for which
      this static tracepoint corresponds.  When resetting breakpoints,
      we will use this index to try to find the same marker again.  */
-  int static_trace_marker_id_idx;
+  int static_trace_marker_id_idx = 0;
+};
+
+/* The abstract base class for catchpoints.  */
+
+struct catchpoint : public breakpoint
+{
+  /* If TEMP is true, then make the breakpoint temporary.  If
+     COND_STRING is not NULL, then store it in the breakpoint.  */
+  catchpoint (struct gdbarch *gdbarch, bool temp, const char *cond_string);
+
+  ~catchpoint () override = 0;
 };
 
 \f
@@ -1176,10 +1300,8 @@ extern bool bpstat_causes_stop (bpstat *);
    just to things like whether watchpoints are set.  */
 extern bool bpstat_should_step ();
 
-/* Print a message indicating what happened.  Returns nonzero to
-   say that only the source line should be printed after this (zero
-   return means print the frame as well as the source line).  */
-extern enum print_stop_action bpstat_print (bpstat *, int);
+/* Print a message indicating what happened.  */
+extern enum print_stop_action bpstat_print (bpstat *bs, target_waitkind kind);
 
 /* Put in *NUM the breakpoint number of the first breakpoint we are
    stopped at.  *BSP upon return is a bpstat which points to the
@@ -1192,6 +1314,20 @@ extern enum print_stop_action bpstat_print (bpstat *, int);
    Return 1 otherwise.  */
 extern int bpstat_num (bpstat **, int *);
 
+/* If BS indicates a breakpoint and this breakpoint has several code locations,
+   return the location number of BS, otherwise return 0.  */
+
+extern int bpstat_locno (const bpstat *bs);
+
+/* Print BS breakpoint number optionally followed by a . and breakpoint locno.
+
+   For a breakpoint with only one code location, outputs the signed field
+   "bkptno" breakpoint number of BS (as returned by bpstat_num).
+   If BS has several code locations, outputs a '.' character followed by
+   the signed field "locno" (as returned by bpstat_locno).  */
+
+extern void print_num_locno (const bpstat *bs, struct ui_out *);
+
 /* Perform actions associated with the stopped inferior.  Actually, we
    just use this for breakpoint commands.  Perhaps other actions will
    go here later, but this is executed at a late time (from the
@@ -1263,11 +1399,11 @@ struct bpstat
     /* Old value associated with a watchpoint.  */
     value_ref_ptr old_val;
 
-    /* Nonzero if this breakpoint tells us to print the frame.  */
-    char print;
+    /* True if this breakpoint tells us to print the frame.  */
+    bool print;
 
-    /* Nonzero if this breakpoint tells us to stop.  */
-    char stop;
+    /* True if this breakpoint tells us to stop.  */
+    bool stop;
 
     /* Tell bpstat_print and print_bp_stop_message how to print stuff
        associated with this element of the bpstat chain.  */
@@ -1345,7 +1481,7 @@ extern void until_break_command (const char *, int, int);
 /* Initialize a struct bp_location.  */
 
 extern void update_breakpoint_locations
-  (struct breakpoint *b,
+  (code_breakpoint *b,
    struct program_space *filter_pspace,
    gdb::array_view<const symtab_and_line> sals,
    gdb::array_view<const symtab_and_line> sals_end);
@@ -1395,7 +1531,7 @@ extern void awatch_command_wrapper (const char *, int, bool);
 extern void rwatch_command_wrapper (const char *, int, bool);
 extern void tbreak_command (const char *, int);
 
-extern const struct breakpoint_ops base_breakpoint_ops;
+extern const struct breakpoint_ops code_breakpoint_ops;
 
 /* Arguments to pass as context to some catch command handlers.  */
 #define CATCH_PERMANENT ((void *) (uintptr_t) 0)
@@ -1412,41 +1548,25 @@ extern void
                     void *user_data_catch,
                     void *user_data_tcatch);
 
-/* Initialize a breakpoint struct for Ada exception catchpoints.  */
-
-extern void
-  init_ada_exception_breakpoint (struct breakpoint *b,
-                                struct gdbarch *gdbarch,
-                                struct symtab_and_line sal,
-                                const char *addr_string,
-                                int tempflag,
-                                int enabled,
-                                int from_tty);
-
-/* Initialize a new breakpoint of the bp_catchpoint kind.  If TEMP
-   is true, then make the breakpoint temporary.  If COND_STRING is
-   not NULL, then store it in the breakpoint.  */
-
-extern void init_catchpoint (struct breakpoint *b,
-                            struct gdbarch *gdbarch, bool temp,
-                            const char *cond_string);
-
 /* Add breakpoint B on the breakpoint list, and notify the user, the
    target and breakpoint_created observers of its existence.  If
    INTERNAL is non-zero, the breakpoint number will be allocated from
    the internal breakpoint count.  If UPDATE_GLL is non-zero,
-   update_global_location_list will be called.  */
+   update_global_location_list will be called.
+
+   Takes ownership of B, and returns a non-owning reference to it.  */
 
-extern void install_breakpoint (int internal, std::unique_ptr<breakpoint> &&b,
-                               int update_gll);
+extern breakpoint *install_breakpoint
+  (int internal, std::unique_ptr<breakpoint> &&b, int update_gll);
 
-/* Returns the breakpoint ops appropriate for use with with LOCATION and
-   according to IS_TRACEPOINT.  Use this to ensure, for example, that you pass
-   the correct ops to create_breakpoint for probe locations.  If LOCATION is
-   NULL, returns base_breakpoint_ops.  */
+/* Returns the breakpoint ops appropriate for use with with LOCSPEC
+   and according to IS_TRACEPOINT.  Use this to ensure, for example,
+   that you pass the correct ops to create_breakpoint for probe
+   location specs.  If LOCSPEC is NULL, returns
+   code_breakpoint_ops.  */
 
-extern const struct breakpoint_ops *breakpoint_ops_for_event_location
-  (const struct event_location *location, bool is_tracepoint);
+extern const struct breakpoint_ops *breakpoint_ops_for_location_spec
+  (const location_spec *locspec, bool is_tracepoint);
 
 /* Flags that can be passed down to create_breakpoint, etc., to affect
    breakpoint creation in several ways.  */
@@ -1458,15 +1578,15 @@ enum breakpoint_create_flags
     CREATE_BREAKPOINT_FLAGS_INSERTED = 1 << 0
   };
 
-/* Set a breakpoint.  This function is shared between CLI and MI functions
-   for setting a breakpoint at LOCATION.
+/* Set a breakpoint.  This function is shared between CLI and MI
+   functions for setting a breakpoint at LOCSPEC.
 
    This function has two major modes of operations, selected by the
    PARSE_EXTRA parameter.
 
-   If PARSE_EXTRA is zero, LOCATION is just the breakpoint's location,
-   with condition, thread, and extra string specified by the COND_STRING,
-   THREAD, and EXTRA_STRING parameters.
+   If PARSE_EXTRA is zero, LOCSPEC is just the breakpoint's location
+   spec, with condition, thread, and extra string specified by the
+   COND_STRING, THREAD, and EXTRA_STRING parameters.
 
    If PARSE_EXTRA is non-zero, this function will attempt to extract
    the condition, thread, and extra string from EXTRA_STRING, ignoring
@@ -1483,8 +1603,9 @@ enum breakpoint_create_flags
    Returns true if any breakpoint was created; false otherwise.  */
 
 extern int create_breakpoint (struct gdbarch *gdbarch,
-                             struct event_location *location,
+                             struct location_spec *locspec,
                              const char *cond_string, int thread,
+                             int inferior,
                              const char *extra_string,
                              bool force_condition,
                              int parse_extra,
@@ -1621,8 +1742,23 @@ extern void breakpoint_set_commands (struct breakpoint *b,
 
 extern void breakpoint_set_silent (struct breakpoint *b, int silent);
 
+/* Set the thread for this breakpoint.  If THREAD is -1, make the
+   breakpoint work for any thread.  Passing a value other than -1 for
+   THREAD should only be done if b->task is 0; it is not valid to try and
+   set both a thread and task restriction on a breakpoint.  */
+
 extern void breakpoint_set_thread (struct breakpoint *b, int thread);
 
+/* Set the inferior for breakpoint B to INFERIOR.  If INFERIOR is -1, make
+   the breakpoint work for any inferior.  */
+
+extern void breakpoint_set_inferior (struct breakpoint *b, int inferior);
+
+/* Set the task for this breakpoint.  If TASK is -1, make the breakpoint
+   work for any task.  Passing a value other than -1 for TASK should only
+   be done if b->thread is -1; it is not valid to try and set both a thread
+   and task restriction on a breakpoint.  */
+
 extern void breakpoint_set_task (struct breakpoint *b, int task);
 
 /* Clear the "inserted" flag in all breakpoints.  */
@@ -1770,7 +1906,9 @@ public:
 
 /* Breakpoint linked list iterator.  */
 
-using breakpoint_iterator = next_iterator<breakpoint>;
+using breakpoint_list = intrusive_list<breakpoint>;
+
+using breakpoint_iterator = breakpoint_list::iterator;
 
 /* Breakpoint linked list range.  */
 
@@ -1794,8 +1932,8 @@ breakpoint_safe_range all_breakpoints_safe ();
 
 struct tracepoint_filter
 {
-  bool operator() (breakpoint *b)
-  { return is_tracepoint (b); }
+  bool operator() (breakpoint &b)
+  { return is_tracepoint (&b); }
 };
 
 /* Breakpoint linked list iterator, filtering to only keep tracepoints.  */
@@ -1849,6 +1987,11 @@ extern cmd_list_element *commands_cmd_element;
 
 extern bool fix_multi_location_breakpoint_output_globally;
 
+/* Whether to use the fixed output when printing information about
+   commands attached to a breakpoint.  */
+
+extern bool fix_breakpoint_script_output_globally;
+
 /* Deal with "catch catch", "catch throw", and "catch rethrow" commands and
    the MI equivalents.  Sets up to catch events of type EX_EVENT.  When
    TEMPFLAG is true only the next matching event is caught after which the
@@ -1865,4 +2008,22 @@ extern void catch_exception_event (enum exception_event_kind ex_event,
 
 extern void print_solib_event (bool is_catchpoint);
 
+/* Print a message describing any user-breakpoints set at PC.  This
+   concerns with logical breakpoints, so we match program spaces, not
+   address spaces.  */
+
+extern void describe_other_breakpoints (struct gdbarch *,
+                                       struct program_space *, CORE_ADDR,
+                                       struct obj_section *, int);
+
+/* Enable or disable a breakpoint location LOC.  ENABLE
+   specifies whether to enable or disable.  */
+
+extern void enable_disable_bp_location (bp_location *loc, bool enable);
+
+
+/* Notify interpreters and observers that breakpoint B was modified.  */
+
+extern void notify_breakpoint_modified (breakpoint *b);
+
 #endif /* !defined (BREAKPOINT_H) */