[ARM] PR ld/21402, only override the symbol dynamic decision on undefined weak symbol.
[deliverable/binutils-gdb.git] / gdb / breakpoint.h
index 18b284f5876e5139975edaa560251a8c3caab236..ff49cd2ab4bc04e02f5da2ebe4d2a95710984f43 100644 (file)
@@ -28,6 +28,8 @@
 #include "probe.h"
 #include "location.h"
 #include <vector>
+#include "common/array-view.h"
+#include "cli/cli-script.h"
 
 struct value;
 struct block;
@@ -512,10 +514,6 @@ enum print_stop_action
 
 struct breakpoint_ops
 {
-  /* Destructor.  Releases everything from SELF (but not SELF
-     itself).  */
-  void (*dtor) (struct breakpoint *self);
-
   /* Allocate a location for this breakpoint.  */
   struct bp_location * (*allocate_location) (struct breakpoint *);
 
@@ -608,21 +606,22 @@ struct breakpoint_ops
      This function is called inside `create_breakpoint'.  */
   void (*create_breakpoints_sal) (struct gdbarch *,
                                  struct linespec_result *,
-                                 char *, char *,
+                                 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);
 
   /* Given the location (second parameter), this method decodes it and
-     provides the SAL locations related to it.  For ordinary
+     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'.  */
-  void (*decode_location) (struct breakpoint *b,
-                          const struct event_location *location,
-                          struct program_space *search_pspace,
-                          struct symtabs_and_lines *sals);
+  std::vector<symtab_and_line> (*decode_location)
+    (struct breakpoint *b,
+     const struct event_location *location,
+     struct program_space *search_pspace);
 
   /* Return true if this breakpoint explains a signal.  See
      bpstat_explains_signal.  */
@@ -658,10 +657,9 @@ enum watchpoint_triggered
 typedef struct bp_location *bp_location_p;
 DEF_VEC_P(bp_location_p);
 
-/* A reference-counted struct command_line.  This lets multiple
-   breakpoints share a single command list.  This is an implementation
+/* A reference-counted struct command_line. This is an implementation
    detail to the breakpoints module.  */
-struct counted_command_line;
+typedef std::shared_ptr<command_line> counted_command_line;
 
 /* Some targets (e.g., embedded PowerPC) need two debug registers to set
    a watchpoint over a memory region.  If this flag is true, GDB will use
@@ -680,46 +678,48 @@ extern int target_exact_watchpoints;
 
 struct breakpoint
 {
+  virtual ~breakpoint ();
+
   /* Methods associated with this breakpoint.  */
-  const struct breakpoint_ops *ops;
+  const breakpoint_ops *ops = NULL;
 
-  struct breakpoint *next;
+  breakpoint *next = NULL;
   /* Type of breakpoint.  */
-  enum bptype type;
+  bptype type = bp_none;
   /* Zero means disabled; remember the info but don't break here.  */
-  enum enable_state enable_state;
+  enum enable_state enable_state = bp_enabled;
   /* What to do with this breakpoint after we hit it.  */
-  enum bpdisp disposition;
+  bpdisp disposition = disp_del;
   /* Number assigned to distinguish breakpoints.  */
-  int number;
+  int number = 0;
 
   /* Location(s) associated with this high-level breakpoint.  */
-  struct bp_location *loc;
+  bp_location *loc = NULL;
 
-  /* Non-zero means a silent breakpoint (don't print frame info if we
-     stop here).  */
-  unsigned char silent;
-  /* Non-zero means display ADDR_STRING to the user verbatim.  */
-  unsigned char display_canonical;
+  /* True means a silent breakpoint (don't print frame info if we stop
+     here).  */
+  bool silent = false;
+  /* True means display ADDR_STRING to the user verbatim.  */
+  bool display_canonical = false;
   /* Number of stops at this breakpoint that should be continued
      automatically before really stopping.  */
-  int ignore_count;
+  int ignore_count = 0;
 
   /* Number of stops at this breakpoint before it will be
      disabled.  */
-  int enable_count;
+  int enable_count = 0;
 
   /* Chain of command lines to execute when this breakpoint is
      hit.  */
-  struct counted_command_line *commands;
+  counted_command_line commands;
   /* Stack depth (address of frame).  If nonzero, break only if fp
      equals this.  */
-  struct frame_id frame_id;
+  struct frame_id frame_id = null_frame_id;
 
   /* The program space used to set the breakpoint.  This is only set
      for breakpoints which are specific to a program space; for
      non-thread-specific ordinary breakpoints this is NULL.  */
-  struct program_space *pspace;
+  program_space *pspace = NULL;
 
   /* Location we used to set the breakpoint.  */
   event_location_up location;
@@ -727,70 +727,67 @@ struct breakpoint
   /* The filter that should be passed to decode_line_full when
      re-setting this breakpoint.  This may be NULL, but otherwise is
      allocated with xmalloc.  */
-  char *filter;
+  char *filter = NULL;
 
   /* For a ranged breakpoint, the location we used to find the end of
      the range.  */
   event_location_up location_range_end;
 
   /* Architecture we used to set the breakpoint.  */
-  struct gdbarch *gdbarch;
+  struct gdbarch *gdbarch = NULL;
   /* Language we used to set the breakpoint.  */
-  enum language language;
+  enum language language = language_unknown;
   /* Input radix we used to set the breakpoint.  */
-  int input_radix;
+  int input_radix = 0;
   /* String form of the breakpoint condition (malloc'd), or NULL if
      there is no condition.  */
-  char *cond_string;
+  char *cond_string = NULL;
 
   /* String form of extra parameters, or NULL if there are none.
      Malloc'd.  */
-  char *extra_string;
+  char *extra_string = NULL;
 
   /* Holds the address of the related watchpoint_scope breakpoint when
      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).  */
-  struct breakpoint *related_breakpoint;
+  breakpoint *related_breakpoint = NULL;
 
   /* Thread number for thread-specific breakpoint, or -1 if don't
      care.  */
-  int thread;
+  int thread = -1;
 
   /* Ada task number for task-specific breakpoint, or 0 if don't
      care.  */
-  int task;
+  int task = 0;
 
   /* Count of the number of times this breakpoint was taken, dumped
      with the info, but not used for anything else.  Useful for seeing
      how many times you hit a break prior to the program aborting, so
      you can back up to just before the abort.  */
-  int hit_count;
+  int hit_count = 0;
 
   /* Is breakpoint's condition not yet parsed because we found no
      location initially so had no context to parse the condition
      in.  */
-  int condition_not_parsed;
+  int condition_not_parsed = 0;
 
   /* With a Python scripting enabled GDB, store a reference to the
      Python object that has been associated with this breakpoint.
      This is always NULL for a GDB that is not script enabled.  It can
      sometimes be NULL for enabled GDBs as not all breakpoint types
      are tracked by the scripting language API.  */
-  struct gdbpy_breakpoint_object *py_bp_object;
+  gdbpy_breakpoint_object *py_bp_object = NULL;
 
   /* Same as py_bp_object, but for Scheme.  */
-  struct gdbscm_breakpoint_object *scm_bp_object;
+  gdbscm_breakpoint_object *scm_bp_object = NULL;
 };
 
-/* An instance of this type is used to represent a watchpoint.  It
-   includes a "struct breakpoint" as a kind of base class; users
-   downcast to "struct breakpoint *" when needed.  */
+/* An instance of this type is used to represent a watchpoint.  */
 
-struct watchpoint
+struct watchpoint : public breakpoint
 {
-  /* The base class.  */
-  struct breakpoint base;
+  ~watchpoint () override;
 
   /* String form of exp to use for displaying to the user (malloc'd),
      or NULL if none.  */
@@ -867,14 +864,10 @@ extern int is_breakpoint (const struct breakpoint *bpt);
 extern int is_watchpoint (const struct breakpoint *bpt);
 
 /* An instance of this type is used to represent all kinds of
-   tracepoints.  It includes a "struct breakpoint" as a kind of base
-   class; users downcast to "struct breakpoint *" when needed.  */
+   tracepoints.  */
 
-struct tracepoint
+struct tracepoint : public breakpoint
 {
-  /* The base class.  */
-  struct breakpoint base;
-
   /* Number of times this tracepoint should single-step and collect
      additional data.  */
   long step_count;
@@ -1088,6 +1081,13 @@ enum bp_print_how
 
 struct bpstats
   {
+    bpstats ();
+    bpstats (struct bp_location *bl, bpstat **bs_link_pointer);
+    ~bpstats ();
+
+    bpstats (const bpstats &);
+    bpstats &operator= (const bpstats &) = delete;
+
     /* Linked list because there can be more than one breakpoint at
        the same place, and a bpstat reflects the fact that all have
        been hit.  */
@@ -1117,7 +1117,7 @@ struct bpstats
     struct breakpoint *breakpoint_at;
 
     /* The associated command list.  */
-    struct counted_command_line *commands;
+    counted_command_line commands;
 
     /* Old value associated with a watchpoint.  */
     struct value *old_val;
@@ -1206,14 +1206,15 @@ extern int breakpoint_address_match (struct address_space *aspace1,
                                     struct address_space *aspace2,
                                     CORE_ADDR addr2);
 
-extern void until_break_command (char *, int, int);
+extern void until_break_command (const char *, int, int);
 
 /* Initialize a struct bp_location.  */
 
-extern void update_breakpoint_locations (struct breakpoint *b,
-                                        struct program_space *filter_pspace,
-                                        struct symtabs_and_lines sals,
-                                        struct symtabs_and_lines sals_end);
+extern void update_breakpoint_locations
+  (struct breakpoint *b,
+   struct program_space *filter_pspace,
+   gdb::array_view<const symtab_and_line> sals,
+   gdb::array_view<const symtab_and_line> sals_end);
 
 extern void breakpoint_re_set (void);
 
@@ -1254,9 +1255,9 @@ extern void break_command (char *, int);
 extern void hbreak_command_wrapper (char *, int);
 extern void thbreak_command_wrapper (char *, int);
 extern void rbreak_command_wrapper (char *, int);
-extern void watch_command_wrapper (char *, int, int);
-extern void awatch_command_wrapper (char *, int, int);
-extern void rwatch_command_wrapper (char *, int, int);
+extern void watch_command_wrapper (const char *, int, int);
+extern void awatch_command_wrapper (const char *, int, int);
+extern void rwatch_command_wrapper (const char *, int, int);
 extern void tbreak_command (char *, int);
 
 extern struct breakpoint_ops base_breakpoint_ops;
@@ -1287,7 +1288,7 @@ extern void
   init_ada_exception_breakpoint (struct breakpoint *b,
                                 struct gdbarch *gdbarch,
                                 struct symtab_and_line sal,
-                                char *addr_string,
+                                const char *addr_string,
                                 const struct breakpoint_ops *ops,
                                 int tempflag,
                                 int enabled,
@@ -1304,7 +1305,7 @@ extern void init_catchpoint (struct breakpoint *b,
    the internal breakpoint count.  If UPDATE_GLL is non-zero,
    update_global_location_list will be called.  */
 
-extern void install_breakpoint (int internal, struct breakpoint *b,
+extern void install_breakpoint (int internal, std::unique_ptr<breakpoint> &&b,
                                int update_gll);
 
 /* Flags that can be passed down to create_breakpoint, etc., to affect
@@ -1338,8 +1339,8 @@ enum breakpoint_create_flags
 
 extern int create_breakpoint (struct gdbarch *gdbarch,
                              const struct event_location *location,
-                             char *cond_string, int thread,
-                             char *extra_string,
+                             const char *cond_string, int thread,
+                             const char *extra_string,
                              int parse_extra,
                              int tempflag, enum bptype wanted_type,
                              int ignore_count,
@@ -1520,10 +1521,6 @@ extern int is_catchpoint (struct breakpoint *);
 extern void add_solib_catchpoint (const char *arg, int is_load, int is_temp,
                                   int enabled);
 
-/* Enable breakpoints and delete when hit.  Called with ARG == NULL
-   deletes all breakpoints.  */
-extern void delete_command (char *arg, int from_tty);
-
 /* Create and insert a new software single step breakpoint for the
    current thread.  May be called multiple times; each time will add a
    new location to the set of potential addresses the next instruction
This page took 0.030815 seconds and 4 git commands to generate.