]> Git Repo - binutils.git/blobdiff - gdb/breakpoint.c
* breakpoint.c (breakpoint_1): Annotate each field of the headers.
[binutils.git] / gdb / breakpoint.c
index 457ca912cd2ea92c2b968ba7590434da7ebb2d37..b9efd0546b07ba6a23df80aecc3b0e907e590017 100644 (file)
@@ -196,6 +196,16 @@ int default_breakpoint_line;
 
 /* Flag indicating extra verbosity for xgdb.  */
 extern int xgdb_verbose;
+
+static void
+breakpoints_changed ()
+{
+  if (annotation_level > 1)
+    {
+      target_terminal_ours ();
+      printf_unfiltered ("\n\032\032breakpoints-invalid\n");
+    }
+}
 \f
 /* *PP is a string denoting a breakpoint.  Get the number of the breakpoint.
    Advance *PP after the string and any trailing whitespace.
@@ -335,6 +345,7 @@ End with a line saying just \"end\".\n", bnum);
        l = read_command_lines ();
        free_command_lines (&b->commands);
        b->commands = l;
+       breakpoints_changed ();
        return;
       }
   error ("No breakpoint number %d.", bnum);
@@ -1528,14 +1539,49 @@ breakpoint_1 (bnum, allflag)
          continue;
 
        if (!found_a_breakpoint++)
-         printf_filtered ("Num Type           Disp Enb %sWhat\n",
-                          addressprint ? "Address    " : "");
-
-       printf_filtered ("%-3d %-14s %-4s %-3c ",
-                        b->number,
-                        bptypes[(int)b->type],
-                        bpdisps[(int)b->disposition],
-                        bpenables[(int)b->enable]);
+         {
+           if (annotation_level > 1)
+             printf_filtered ("\n\032\032breakpoints-headers\n");
+
+           if (annotation_level > 1)
+             printf_filtered ("\n\032\032field 0\n");
+           printf_filtered ("Num ");
+           if (annotation_level > 1)
+             printf_filtered ("\n\032\032field 1\n");
+           printf_filtered ("Type           ");
+           if (annotation_level > 1)
+             printf_filtered ("\n\032\032field 2\n");
+           printf_filtered ("Disp ");
+           if (annotation_level > 1)
+             printf_filtered ("\n\032\032field 3\n");
+           printf_filtered ("Enb ");
+           if (addressprint)
+             {
+               if (annotation_level > 1)
+                 printf_filtered ("\n\032\032field 4\n");
+               printf_filtered ("Address    ");
+             }
+           if (annotation_level > 1)
+             printf_filtered ("\n\032\032field 5\n");
+           printf_filtered ("What\n");
+
+           if (annotation_level > 1)
+             printf_filtered ("\n\032\032breakpoints-table\n");
+         }
+
+       if (annotation_level > 1)
+         printf_filtered ("\n\032\032record\n\n\032\032field 0\n");
+       printf_filtered ("%-3d ", b->number);
+       if (annotation_level > 1)
+         printf_filtered ("\n\032\032field 1\n");
+       printf_filtered ("%-14s ", bptypes[(int)b->type]);
+       if (annotation_level > 1)
+         printf_filtered ("\n\032\032field 2\n");
+       printf_filtered ("%-4s ", bpdisps[(int)b->disposition]);
+       if (annotation_level > 1)
+         printf_filtered ("\n\032\032field 3\n");
+       printf_filtered ("%-3c ", bpenables[(int)b->enable]);
+
        strcpy (wrap_indent, "                           ");
        if (addressprint)
          strcat (wrap_indent, "           ");
@@ -1543,6 +1589,11 @@ breakpoint_1 (bnum, allflag)
          {
          case bp_watchpoint:
          case bp_hardware_watchpoint:
+           /* Field 4, the address, is omitted (which makes the columns
+              not line up too nicely with the headers, but the effect
+              is relatively readable).  */
+           if (annotation_level > 1)
+             printf_filtered ("\n\032\032field 5\n");
            print_expression (b->exp, gdb_stdout);
            break;
 
@@ -1556,7 +1607,19 @@ breakpoint_1 (bnum, allflag)
          case bp_watchpoint_scope:
          case bp_call_dummy:
            if (addressprint)
-             printf_filtered ("%s ", local_hex_string_custom ((unsigned long) b->address, "08l"));
+             {
+               if (annotation_level > 1)
+                 printf_filtered ("\n\032\032field 4\n");
+               /* FIXME-32x64: need a print_address_numeric with
+                   field width */
+               printf_filtered
+                 ("%s ",
+                  local_hex_string_custom
+                  ((unsigned long) b->address, "08l"));
+             }
+
+           if (annotation_level > 1)
+             printf_filtered ("\n\032\032field 5\n");
 
            last_addr = b->address;
            if (b->source_file)
@@ -1581,26 +1644,45 @@ breakpoint_1 (bnum, allflag)
 
        if (b->frame)
          {
+           if (annotation_level > 1)
+             printf_filtered ("\n\032\032field 6\n");
+
            printf_filtered ("\tstop only in stack frame at ");
            print_address_numeric (b->frame, gdb_stdout);
            printf_filtered ("\n");
          }
+
        if (b->cond)
          {
+           if (annotation_level > 1)
+             printf_filtered ("\n\032\032field 7\n");
+
            printf_filtered ("\tstop only if ");
            print_expression (b->cond, gdb_stdout);
            printf_filtered ("\n");
          }
+
        if (b->ignore_count)
-         printf_filtered ("\tignore next %d hits\n", b->ignore_count);
+         {
+           if (annotation_level > 1)
+             printf_filtered ("\n\032\032field 8\n");
+
+           printf_filtered ("\tignore next %d hits\n", b->ignore_count);
+         }
+
        if ((l = b->commands))
-         while (l)
-           {
-             fputs_filtered ("\t", gdb_stdout);
-             fputs_filtered (l->line, gdb_stdout);
-             fputs_filtered ("\n", gdb_stdout);
-             l = l->next;
-           }
+         {
+           if (annotation_level > 1)
+             printf_filtered ("\n\032\032field 9\n");
+
+           while (l)
+             {
+               fputs_filtered ("\t", gdb_stdout);
+               fputs_filtered (l->line, gdb_stdout);
+               fputs_filtered ("\n", gdb_stdout);
+               l = l->next;
+             }
+         }
       }
 
   if (!found_a_breakpoint)
@@ -1615,6 +1697,9 @@ breakpoint_1 (bnum, allflag)
        that a comparison of an unsigned with -1 is always false.  */
     if (last_addr != (CORE_ADDR)-1)
       set_next_address (last_addr);
+
+  if (annotation_level > 1)
+    printf_filtered ("\n\032\032breakpoints-table-end\n");
 }
 
 /* ARGSUSED */
@@ -1766,6 +1851,7 @@ set_raw_breakpoint (sal)
     }
 
   check_duplicates (sal.pc);
+  breakpoints_changed ();
 
   return b;
 }
@@ -2226,7 +2312,7 @@ watch_command (arg, from_tty)
       b->watchpoint_frame = FRAME_FP (frame);
     }
   else
-    b->watchpoint_frame = NULL;
+    b->watchpoint_frame = (CORE_ADDR)0;
 
   if (can_use_hardware_watchpoint (b))
     b->type = bp_hardware_watchpoint;
@@ -2293,7 +2379,7 @@ can_use_hardware_watchpoint (b)
       if (!(v->lval == lval_memory)
          || v->lval == not_lval
          || (v->lval != not_lval
-             && v->modifiable == false))
+             && v->modifiable == 0))
        return 0;
       else
        if (v->lval == lval_memory)
@@ -2771,6 +2857,7 @@ clear_command (arg, from_tty)
 
       if (found->next) from_tty = 1; /* Always report if deleted more than one */
       if (from_tty) printf_unfiltered ("Deleted breakpoint%s ", found->next ? "s" : "");
+      breakpoints_changed ();
       while (found)
        {
          if (from_tty) printf_unfiltered ("%d ", found->number);
@@ -2854,11 +2941,7 @@ delete_breakpoint (bpt)
   if (bpt->source_file != NULL)
     free (bpt->source_file);
 
-  if (xgdb_verbose && bpt->type == bp_breakpoint)
-    {
-      target_terminal_ours_for_output ();
-      printf_unfiltered ("breakpoint #%d deleted\n", bpt->number);
-    }
+  breakpoints_changed ();
 
   /* Be sure no bpstat's are pointing at it after it's been freed.  */
   /* FIXME, how can we find all bpstat's?
@@ -2962,6 +3045,10 @@ breakpoint_re_set_one (bint)
              check_duplicates (b->address);
 
              mention (b);
+
+             /* Might be better to do this just once per breakpoint_re_set,
+                rather than once for every breakpoint.  */
+             breakpoints_changed ();
            }
          b->enable = save_enable;      /* Restore it, this worked. */
        }
@@ -3067,6 +3154,7 @@ set_ignore_count (bptnum, count, from_tty)
        else
          printf_filtered ("Will ignore next %d crossings of breakpoint %d.",
                  count, bptnum);
+       breakpoints_changed ();
        return;
       }
 
@@ -3105,6 +3193,7 @@ ignore_command (args, from_tty)
                    longest_to_int (value_as_long (parse_and_eval (p))),
                    from_tty);
   printf_filtered ("\n");
+  breakpoints_changed ();
 }
 \f
 /* Call FUNCTION on each of the breakpoints
@@ -3153,8 +3242,7 @@ enable_breakpoint (bpt)
   
   bpt->enable = enabled;
 
-  if (xgdb_verbose && bpt->type == bp_breakpoint)
-    printf_unfiltered ("breakpoint #%d enabled\n", bpt->number);
+  breakpoints_changed ();
 
   check_duplicates (bpt->address);
   if (bpt->type == bp_watchpoint || bpt->type == bp_hardware_watchpoint)
@@ -3222,8 +3310,7 @@ disable_breakpoint (bpt)
 
   bpt->enable = disabled;
 
-  if (xgdb_verbose && bpt->type == bp_breakpoint)
-    printf_filtered ("breakpoint #%d disabled\n", bpt->number);
+  breakpoints_changed ();
 
   check_duplicates (bpt->address);
 }
@@ -3258,6 +3345,7 @@ enable_once_breakpoint (bpt)
   bpt->disposition = disable;
 
   check_duplicates (bpt->address);
+  breakpoints_changed ();
 }
 
 /* ARGSUSED */
@@ -3277,6 +3365,7 @@ enable_delete_breakpoint (bpt)
   bpt->disposition = delete;
 
   check_duplicates (bpt->address);
+  breakpoints_changed ();
 }
 
 /* ARGSUSED */
This page took 0.033801 seconds and 4 git commands to generate.