2012-11-09 Yao Qi <yao@codesourcery.com>
[deliverable/binutils-gdb.git] / gdb / breakpoint.c
index b841bcddae9171e51c9e0caca3cbf14046234ded..3763a04247518d110cb98ce25a38f9d4f4ac2640 100644 (file)
@@ -261,6 +261,8 @@ static void disable_trace_command (char *, int);
 
 static void trace_pass_command (char *, int);
 
+static void set_tracepoint_count (int num);
+
 static int is_masked_watchpoint (const struct breakpoint *b);
 
 static struct bp_location **get_first_locp_gte_addr (CORE_ADDR address);
@@ -1844,11 +1846,10 @@ update_watchpoint (struct watchpoint *b, int reparse)
                      && TYPE_CODE (vtype) != TYPE_CODE_ARRAY))
                {
                  CORE_ADDR addr;
-                 int len, type;
+                 int type;
                  struct bp_location *loc, **tmp;
 
                  addr = value_address (v);
-                 len = TYPE_LENGTH (value_type (v));
                  type = hw_write;
                  if (b->base.type == bp_read_watchpoint)
                    type = hw_read;
@@ -1863,7 +1864,7 @@ update_watchpoint (struct watchpoint *b, int reparse)
 
                  loc->pspace = frame_pspace;
                  loc->address = addr;
-                 loc->length = len;
+                 loc->length = TYPE_LENGTH (value_type (v));
                  loc->watchpoint_type = type;
                }
            }
@@ -5176,7 +5177,7 @@ bpstat_stop_status (struct address_space *aspace,
          if (b->type == bp_hardware_watchpoint && bl != b->loc)
            break;
 
-         if (bl->shlib_disabled)
+         if (!bl->enabled || bl->shlib_disabled)
            continue;
 
          if (!bpstat_check_location (bl, aspace, bp_addr, ws))
@@ -5690,7 +5691,7 @@ print_breakpoint_location (struct breakpoint *b,
       if (ui_out_is_mi_like_p (uiout))
        {
          struct symtab_and_line sal = find_pc_line (loc->address, 0);
-         char *fullname = symtab_to_fullname (sal.symtab);
+         const char *fullname = symtab_to_fullname (sal.symtab);
          
          if (fullname)
            ui_out_field_string (uiout, "fullname", fullname);
@@ -8320,6 +8321,8 @@ install_breakpoint (int internal, struct breakpoint *b, int update_gll)
 {
   add_to_breakpoint_chain (b);
   set_breakpoint_number (internal, b);
+  if (is_tracepoint (b))
+    set_tracepoint_count (breakpoint_count);
   if (!internal)
     mention (b);
   observer_notify_breakpoint_created (b);
@@ -11767,7 +11770,7 @@ compare_breakpoints (const void *a, const void *b)
      the number 0.  */
   if (ua < ub)
     return -1;
-  return ub > ub ? 1 : 0;
+  return ua > ub ? 1 : 0;
 }
 
 /* Delete breakpoints by address or line.  */
@@ -12463,7 +12466,7 @@ update_global_location_list (int should_insert)
       struct bp_location **loc_first_p;
       b = loc->owner;
 
-      if (!should_be_inserted (loc)
+      if (!unduplicated_should_be_inserted (loc)
          || !breakpoint_address_is_meaningful (b)
          /* Don't detect duplicate for tracepoint locations because they are
           never duplicated.  See the comments in field `duplicate' of
@@ -13823,7 +13826,7 @@ update_static_tracepoint (struct breakpoint *b, struct symtab_and_line sal)
 
          if (ui_out_is_mi_like_p (uiout))
            {
-             char *fullname = symtab_to_fullname (sal2.symtab);
+             const char *fullname = symtab_to_fullname (sal2.symtab);
 
              if (fullname)
                ui_out_field_string (uiout, "fullname", fullname);
@@ -14719,7 +14722,8 @@ show_breakpoint_cmd (char *args, int from_tty)
    GDB itself.  */
 
 static void
-invalidate_bp_value_on_memory_change (CORE_ADDR addr, int len,
+invalidate_bp_value_on_memory_change (struct inferior *inferior,
+                                     CORE_ADDR addr, ssize_t len,
                                      const bfd_byte *data)
 {
   struct breakpoint *bp;
@@ -14972,7 +14976,7 @@ catch_syscall_completer (struct cmd_list_element *cmd,
 {
   const char **list = get_syscall_names ();
   VEC (char_ptr) *retlist
-    = (list == NULL) ? NULL : complete_on_enum (list, text, word);
+    = (list == NULL) ? NULL : complete_on_enum (list, word, word);
 
   xfree (list);
   return retlist;
@@ -14999,35 +15003,33 @@ trace_command (char *arg, int from_tty)
   else
     ops = &tracepoint_breakpoint_ops;
 
-  if (create_breakpoint (get_current_arch (),
-                        arg,
-                        NULL, 0, NULL, 1 /* parse arg */,
-                        0 /* tempflag */,
-                        bp_tracepoint /* type_wanted */,
-                        0 /* Ignore count */,
-                        pending_break_support,
-                        ops,
-                        from_tty,
-                        1 /* enabled */,
-                        0 /* internal */, 0))
-    set_tracepoint_count (breakpoint_count);
+  create_breakpoint (get_current_arch (),
+                    arg,
+                    NULL, 0, NULL, 1 /* parse arg */,
+                    0 /* tempflag */,
+                    bp_tracepoint /* type_wanted */,
+                    0 /* Ignore count */,
+                    pending_break_support,
+                    ops,
+                    from_tty,
+                    1 /* enabled */,
+                    0 /* internal */, 0);
 }
 
 static void
 ftrace_command (char *arg, int from_tty)
 {
-  if (create_breakpoint (get_current_arch (),
-                        arg,
-                        NULL, 0, NULL, 1 /* parse arg */,
-                        0 /* tempflag */,
-                        bp_fast_tracepoint /* type_wanted */,
-                        0 /* Ignore count */,
-                        pending_break_support,
-                        &tracepoint_breakpoint_ops,
-                        from_tty,
-                        1 /* enabled */,
-                        0 /* internal */, 0))
-    set_tracepoint_count (breakpoint_count);
+  create_breakpoint (get_current_arch (),
+                    arg,
+                    NULL, 0, NULL, 1 /* parse arg */,
+                    0 /* tempflag */,
+                    bp_fast_tracepoint /* type_wanted */,
+                    0 /* Ignore count */,
+                    pending_break_support,
+                    &tracepoint_breakpoint_ops,
+                    from_tty,
+                    1 /* enabled */,
+                    0 /* internal */, 0);
 }
 
 /* strace command implementation.  Creates a static tracepoint.  */
@@ -15044,18 +15046,17 @@ strace_command (char *arg, int from_tty)
   else
     ops = &tracepoint_breakpoint_ops;
 
-  if (create_breakpoint (get_current_arch (),
-                        arg,
-                        NULL, 0, NULL, 1 /* parse arg */,
-                        0 /* tempflag */,
-                        bp_static_tracepoint /* type_wanted */,
-                        0 /* Ignore count */,
-                        pending_break_support,
-                        ops,
-                        from_tty,
-                        1 /* enabled */,
-                        0 /* internal */, 0))
-    set_tracepoint_count (breakpoint_count);
+  create_breakpoint (get_current_arch (),
+                    arg,
+                    NULL, 0, NULL, 1 /* parse arg */,
+                    0 /* tempflag */,
+                    bp_static_tracepoint /* type_wanted */,
+                    0 /* Ignore count */,
+                    pending_break_support,
+                    ops,
+                    from_tty,
+                    1 /* enabled */,
+                    0 /* internal */, 0);
 }
 
 /* Set up a fake reader function that gets command lines from a linked
@@ -15124,8 +15125,6 @@ create_tracepoint_from_upload (struct uploaded_tp *utp)
                          CREATE_BREAKPOINT_FLAGS_INSERTED))
     return NULL;
 
-  set_tracepoint_count (breakpoint_count);
-  
   /* Get the tracepoint we just created.  */
   tp = get_tracepoint (tracepoint_count);
   gdb_assert (tp != NULL);
@@ -15245,7 +15244,7 @@ static void
 trace_pass_set_count (struct tracepoint *tp, int count, int from_tty)
 {
   tp->pass_count = count;
-  observer_notify_tracepoint_modified (tp->base.number);
+  observer_notify_breakpoint_modified (&tp->base);
   if (from_tty)
     printf_filtered (_("Setting tracepoint %d's passcount to %d\n"),
                     tp->base.number, count);
@@ -15347,7 +15346,6 @@ get_tracepoint_by_number (char **arg,
                          struct get_number_or_range_state *state,
                          int optional_p)
 {
-  extern int tracepoint_count;
   struct breakpoint *t;
   int tpnum;
   char *instring = arg == NULL ? NULL : *arg;
This page took 0.032358 seconds and 4 git commands to generate.