2012-03-13 Hui Zhu <teawater@gmail.com>
authorPedro Alves <palves@redhat.com>
Tue, 13 Mar 2012 13:30:42 +0000 (13:30 +0000)
committerPedro Alves <palves@redhat.com>
Tue, 13 Mar 2012 13:30:42 +0000 (13:30 +0000)
    Pedro Alves  <palves@redhat.com>

* breakpoint.c (init_breakpoint_sal): New flags parameter.  Handle
CREATE_BREAKPOINT_FLAGS_INSERTED.
(create_breakpoint_sal, create_breakpoints_sal)
(base_breakpoint_create_breakpoints_sal)
(tracepoint_create_breakpoints_sal)
(strace_marker_create_breakpoints_sal): New flags parameter.  Pass
down.
(break_command_1, handle_gnu_v3_exceptions, trace_command)
(ftrace_command, strace_command): Adjust.
(create_tracepoint_from_upload): Pass
CREATE_BREAKPOINT_FLAGS_INSERTED.
* breakpoint.h (enum breakpoint_create_flags): New.
(create_breakpoint): New flags parameter.
* mi/mi-cmd-break.c (mi_cmd_break_insert): Adjust.
* python/py-breakpoint.c (bppy_init): Adjust.
* python/py-finishbreakpoint.c (bpfinishpy_init): Adjust.
* spu-tdep.c (spu_catch_start): Adjust.

gdb/ChangeLog
gdb/breakpoint.c
gdb/breakpoint.h
gdb/mi/mi-cmd-break.c
gdb/python/py-breakpoint.c
gdb/python/py-finishbreakpoint.c
gdb/spu-tdep.c

index 8cb4567..c422451 100644 (file)
@@ -1,3 +1,24 @@
+2012-03-13  Hui Zhu  <teawater@gmail.com>
+           Pedro Alves  <palves@redhat.com>
+
+       * breakpoint.c (init_breakpoint_sal): New flags parameter.  Handle
+       CREATE_BREAKPOINT_FLAGS_INSERTED.
+       (create_breakpoint_sal, create_breakpoints_sal)
+       (base_breakpoint_create_breakpoints_sal)
+       (tracepoint_create_breakpoints_sal)
+       (strace_marker_create_breakpoints_sal): New flags parameter.  Pass
+       down.
+       (break_command_1, handle_gnu_v3_exceptions, trace_command)
+       (ftrace_command, strace_command): Adjust.
+       (create_tracepoint_from_upload): Pass
+       CREATE_BREAKPOINT_FLAGS_INSERTED.
+       * breakpoint.h (enum breakpoint_create_flags): New.
+       (create_breakpoint): New flags parameter.
+       * mi/mi-cmd-break.c (mi_cmd_break_insert): Adjust.
+       * python/py-breakpoint.c (bppy_init): Adjust.
+       * python/py-finishbreakpoint.c (bpfinishpy_init): Adjust.
+       * spu-tdep.c (spu_catch_start): Adjust.
+
 2012-03-13  Pedro Alves  <palves@redhat.com>
            Hui Zhu  <teawater@gmail.com>
            Yao Qi  <yao@codesourcery.com>
index baccfb3..d35704d 100644 (file)
@@ -112,7 +112,7 @@ static void create_breakpoints_sal_default (struct gdbarch *,
                                            enum bpdisp, int, int,
                                            int,
                                            const struct breakpoint_ops *,
-                                           int, int, int);
+                                           int, int, int, unsigned);
 
 static void decode_linespec_default (struct breakpoint *, char **,
                                     struct symtabs_and_lines *);
@@ -8274,7 +8274,8 @@ init_breakpoint_sal (struct breakpoint *b, struct gdbarch *gdbarch,
                     enum bptype type, enum bpdisp disposition,
                     int thread, int task, int ignore_count,
                     const struct breakpoint_ops *ops, int from_tty,
-                    int enabled, int internal, int display_canonical)
+                    int enabled, int internal, unsigned flags,
+                    int display_canonical)
 {
   int i;
 
@@ -8320,6 +8321,9 @@ init_breakpoint_sal (struct breakpoint *b, struct gdbarch *gdbarch,
          b->enable_state = enabled ? bp_enabled : bp_disabled;
          b->disposition = disposition;
 
+         if ((flags & CREATE_BREAKPOINT_FLAGS_INSERTED) != 0)
+           b->loc->inserted = 1;
+
          if (type == bp_static_tracepoint)
            {
              struct tracepoint *t = (struct tracepoint *) b;
@@ -8363,6 +8367,8 @@ init_breakpoint_sal (struct breakpoint *b, struct gdbarch *gdbarch,
       else
        {
          loc = add_location_to_breakpoint (b, &sal);
+         if ((flags & CREATE_BREAKPOINT_FLAGS_INSERTED) != 0)
+           loc->inserted = 1;
        }
 
       if (bp_loc_is_permanent (loc))
@@ -8395,7 +8401,8 @@ create_breakpoint_sal (struct gdbarch *gdbarch,
                       enum bptype type, enum bpdisp disposition,
                       int thread, int task, int ignore_count,
                       const struct breakpoint_ops *ops, int from_tty,
-                      int enabled, int internal, int display_canonical)
+                      int enabled, int internal, unsigned flags,
+                      int display_canonical)
 {
   struct breakpoint *b;
   struct cleanup *old_chain;
@@ -8418,7 +8425,8 @@ create_breakpoint_sal (struct gdbarch *gdbarch,
                       type, disposition,
                       thread, task, ignore_count,
                       ops, from_tty,
-                      enabled, internal, display_canonical);
+                      enabled, internal, flags,
+                      display_canonical);
   discard_cleanups (old_chain);
 
   install_breakpoint (internal, b, 0);
@@ -8446,7 +8454,7 @@ create_breakpoints_sal (struct gdbarch *gdbarch,
                        enum bptype type, enum bpdisp disposition,
                        int thread, int task, int ignore_count,
                        const struct breakpoint_ops *ops, int from_tty,
-                       int enabled, int internal)
+                       int enabled, int internal, unsigned flags)
 {
   int i;
   struct linespec_sals *lsal;
@@ -8470,7 +8478,7 @@ create_breakpoints_sal (struct gdbarch *gdbarch,
                             filter_string,
                             cond_string, type, disposition,
                             thread, task, ignore_count, ops,
-                            from_tty, enabled, internal,
+                            from_tty, enabled, internal, flags,
                             canonical->special_display);
       discard_cleanups (inner);
     }
@@ -8730,7 +8738,8 @@ create_breakpoint (struct gdbarch *gdbarch,
                   int ignore_count,
                   enum auto_boolean pending_break_support,
                   const struct breakpoint_ops *ops,
-                  int from_tty, int enabled, int internal)
+                  int from_tty, int enabled, int internal,
+                  unsigned flags)
 {
   volatile struct gdb_exception e;
   char *copy_arg = NULL;
@@ -8870,7 +8879,7 @@ create_breakpoint (struct gdbarch *gdbarch,
                                   cond_string, type_wanted,
                                   tempflag ? disp_del : disp_donttouch,
                                   thread, task, ignore_count, ops,
-                                  from_tty, enabled, internal);
+                                  from_tty, enabled, internal, flags);
     }
   else
     {
@@ -8946,7 +8955,8 @@ break_command_1 (char *arg, int flag, int from_tty)
                     &bkpt_breakpoint_ops,
                     from_tty,
                     1 /* enabled */,
-                    0 /* internal */);
+                    0 /* internal */,
+                    0);
 }
 
 /* Helper function for break_command_1 and disassemble_command.  */
@@ -10821,7 +10831,8 @@ handle_gnu_v3_exceptions (int tempflag, char *cond_string,
                     AUTO_BOOLEAN_TRUE /* pending */,
                     &gnu_v3_exception_catchpoint_ops, from_tty,
                     1 /* enabled */,
-                    0 /* internal */);
+                    0 /* internal */,
+                    0);
 
   return 1;
 }
@@ -12048,7 +12059,7 @@ base_breakpoint_create_breakpoints_sal (struct gdbarch *gdbarch,
                                        int task, int ignore_count,
                                        const struct breakpoint_ops *o,
                                        int from_tty, int enabled,
-                                       int internal)
+                                       int internal, unsigned flags)
 {
   internal_error_pure_virtual_called ();
 }
@@ -12250,13 +12261,13 @@ bkpt_create_breakpoints_sal (struct gdbarch *gdbarch,
                             int task, int ignore_count,
                             const struct breakpoint_ops *ops,
                             int from_tty, int enabled,
-                            int internal)
+                            int internal, unsigned flags)
 {
   create_breakpoints_sal_default (gdbarch, canonical, lsal,
                                  cond_string, type_wanted,
                                  disposition, thread, task,
                                  ignore_count, ops, from_tty,
-                                 enabled, internal);
+                                 enabled, internal, flags);
 }
 
 static void
@@ -12520,13 +12531,13 @@ tracepoint_create_breakpoints_sal (struct gdbarch *gdbarch,
                                   int task, int ignore_count,
                                   const struct breakpoint_ops *ops,
                                   int from_tty, int enabled,
-                                  int internal)
+                                  int internal, unsigned flags)
 {
   create_breakpoints_sal_default (gdbarch, canonical, lsal,
                                  cond_string, type_wanted,
                                  disposition, thread, task,
                                  ignore_count, ops, from_tty,
-                                 enabled, internal);
+                                 enabled, internal, flags);
 }
 
 static void
@@ -12569,7 +12580,7 @@ strace_marker_create_breakpoints_sal (struct gdbarch *gdbarch,
                                      int task, int ignore_count,
                                      const struct breakpoint_ops *ops,
                                      int from_tty, int enabled,
-                                     int internal)
+                                     int internal, unsigned flags)
 {
   int i;
 
@@ -12598,7 +12609,7 @@ strace_marker_create_breakpoints_sal (struct gdbarch *gdbarch,
                           addr_string, NULL,
                           cond_string, type_wanted, disposition,
                           thread, task, ignore_count, ops,
-                          from_tty, enabled, internal,
+                          from_tty, enabled, internal, flags,
                           canonical->special_display);
       /* Given that its possible to have multiple markers with
         the same string id, if the user is creating a static
@@ -13303,12 +13314,12 @@ create_breakpoints_sal_default (struct gdbarch *gdbarch,
                                int task, int ignore_count,
                                const struct breakpoint_ops *ops,
                                int from_tty, int enabled,
-                               int internal)
+                               int internal, unsigned flags)
 {
   create_breakpoints_sal (gdbarch, canonical, cond_string,
                          type_wanted, disposition,
                          thread, task, ignore_count, ops, from_tty,
-                         enabled, internal);
+                         enabled, internal, flags);
 }
 
 /* Decode the line represented by S by calling decode_line_full.  This is the
@@ -14179,7 +14190,7 @@ trace_command (char *arg, int from_tty)
                         &tracepoint_breakpoint_ops,
                         from_tty,
                         1 /* enabled */,
-                        0 /* internal */))
+                        0 /* internal */, 0))
     set_tracepoint_count (breakpoint_count);
 }
 
@@ -14196,7 +14207,7 @@ ftrace_command (char *arg, int from_tty)
                         &tracepoint_breakpoint_ops,
                         from_tty,
                         1 /* enabled */,
-                        0 /* internal */))
+                        0 /* internal */, 0))
     set_tracepoint_count (breakpoint_count);
 }
 
@@ -14224,7 +14235,7 @@ strace_command (char *arg, int from_tty)
                         ops,
                         from_tty,
                         1 /* enabled */,
-                        0 /* internal */))
+                        0 /* internal */, 0))
     set_tracepoint_count (breakpoint_count);
 }
 
@@ -14289,7 +14300,8 @@ create_tracepoint_from_upload (struct uploaded_tp *utp)
                          &tracepoint_breakpoint_ops,
                          0 /* from_tty */,
                          utp->enabled /* enabled */,
-                         0 /* internal */))
+                         0 /* internal */,
+                         CREATE_BREAKPOINT_FLAGS_INSERTED))
     return NULL;
 
   set_tracepoint_count (breakpoint_count);
index b92b72c..e0eeeaa 100644 (file)
@@ -550,7 +550,7 @@ struct breakpoint_ops
                                  struct linespec_sals *, char *,
                                  enum bptype, enum bpdisp, int, int,
                                  int, const struct breakpoint_ops *,
-                                 int, int, int);
+                                 int, int, int, unsigned);
 
   /* Given the address string (second parameter), this method decodes it
      and provides the SAL locations related to it.  For ordinary breakpoints,
@@ -1190,6 +1190,16 @@ extern void
 extern void install_breakpoint (int internal, struct breakpoint *b,
                                int update_gll);
 
+/* Flags that can be passed down to create_breakpoint, etc., to affect
+   breakpoint creation in several ways.  */
+
+enum breakpoint_create_flags
+  {
+    /* We're adding a breakpoint to our tables that is already
+       inserted in the target.  */
+    CREATE_BREAKPOINT_FLAGS_INSERTED = 1 << 0
+  };
+
 extern int create_breakpoint (struct gdbarch *gdbarch, char *arg,
                              char *cond_string, int thread,
                              int parse_condition_and_thread,
@@ -1199,7 +1209,7 @@ extern int create_breakpoint (struct gdbarch *gdbarch, char *arg,
                              const struct breakpoint_ops *ops,
                              int from_tty,
                              int enabled,
-                             int internal);
+                             int internal, unsigned flags);
 
 extern void insert_breakpoints (void);
 
index b3a3e32..478527b 100644 (file)
@@ -168,7 +168,7 @@ mi_cmd_break_insert (char *command, char **argv, int argc)
                     temp_p, type_wanted,
                     ignore_count,
                     pending ? AUTO_BOOLEAN_TRUE : AUTO_BOOLEAN_FALSE,
-                    &bkpt_breakpoint_ops, 0, enabled, 0);
+                    &bkpt_breakpoint_ops, 0, enabled, 0, 0);
   do_cleanups (back_to);
 
 }
index c13fb95..b2c625f 100644 (file)
@@ -628,7 +628,7 @@ bppy_init (PyObject *self, PyObject *args, PyObject *kwargs)
                               0,
                               AUTO_BOOLEAN_TRUE,
                               &bkpt_breakpoint_ops,
-                              0, 1, internal_bp);
+                              0, 1, internal_bp, 0);
            break;
          }
         case bp_watchpoint:
index bfbf9c3..b67b163 100644 (file)
@@ -288,7 +288,7 @@ bpfinishpy_init (PyObject *self, PyObject *args, PyObject *kwargs)
                          0,
                          AUTO_BOOLEAN_TRUE,
                          &bkpt_breakpoint_ops,
-                         0, 1, internal_bp);
+                         0, 1, internal_bp, 0);
     }
   GDB_PY_SET_HANDLE_EXCEPTION (except);
   
index 17dae90..78ba007 100644 (file)
@@ -1947,7 +1947,7 @@ spu_catch_start (struct objfile *objfile)
                     0 /* ignore_count */,
                     AUTO_BOOLEAN_FALSE /* pending_break_support */,
                     &bkpt_breakpoint_ops /* ops */, 0 /* from_tty */,
-                    1 /* enabled */, 0 /* internal  */);
+                    1 /* enabled */, 0 /* internal  */, 0);
 }