2001-07-07 Ben Elliston <bje@redhat.com>
[deliverable/binutils-gdb.git] / gdb / breakpoint.c
index 7edba895620bd0678eba9da12fb62f4296a126cb..ed152bede86684be38d33c3f41e3e7cb314dc886 100644 (file)
@@ -1889,7 +1889,7 @@ print_it_typical (bpstat bs)
 #ifdef UI_OUT
       annotate_breakpoint (bs->breakpoint_at->number);
       ui_out_text (uiout, "\nBreakpoint ");
-      if (interpreter_p && strncmp (interpreter_p, "mi", 2) == 0)
+      if (ui_out_is_mi_like_p (uiout))
        ui_out_field_string (uiout, "reason", "breakpoint-hit");
       ui_out_field_int (uiout, "bkptno", bs->breakpoint_at->number);
       ui_out_text (uiout, ", ");
@@ -2034,7 +2034,7 @@ print_it_typical (bpstat bs)
        {
          annotate_watchpoint (bs->breakpoint_at->number);
 #ifdef UI_OUT
-         if (interpreter_p && strncmp (interpreter_p, "mi", 2) == 0)
+         if (ui_out_is_mi_like_p (uiout))
            ui_out_field_string (uiout, "reason", "watchpoint-trigger");
          mention (bs->breakpoint_at);
          ui_out_tuple_begin (uiout, "value");
@@ -2064,7 +2064,7 @@ print_it_typical (bpstat bs)
 
     case bp_read_watchpoint:
 #ifdef UI_OUT
-      if (interpreter_p && strncmp (interpreter_p, "mi", 2) == 0)
+      if (ui_out_is_mi_like_p (uiout))
        ui_out_field_string (uiout, "reason", "read-watchpoint-trigger");
       mention (bs->breakpoint_at);
       ui_out_tuple_begin (uiout, "value");
@@ -2088,7 +2088,7 @@ print_it_typical (bpstat bs)
       if (bs->old_val != NULL)     
        {
          annotate_watchpoint (bs->breakpoint_at->number);
-         if (interpreter_p && strncmp (interpreter_p, "mi", 2) == 0)
+         if (ui_out_is_mi_like_p (uiout))
            ui_out_field_string (uiout, "reason", "access-watchpoint-trigger");
          mention (bs->breakpoint_at);
          ui_out_tuple_begin (uiout, "value");
@@ -2102,7 +2102,7 @@ print_it_typical (bpstat bs)
       else 
        {
          mention (bs->breakpoint_at);
-         if (interpreter_p && strncmp (interpreter_p, "mi", 2) == 0)
+         if (ui_out_is_mi_like_p (uiout))
            ui_out_field_string (uiout, "reason", "access-watchpoint-trigger");
          ui_out_tuple_begin (uiout, "value");
          ui_out_text (uiout, "\nValue = ");
@@ -2139,7 +2139,7 @@ print_it_typical (bpstat bs)
 
     case bp_finish:
 #ifdef UI_OUT
-      if (interpreter_p && strncmp (interpreter_p, "mi", 2) == 0)
+      if (ui_out_is_mi_like_p (uiout))
        ui_out_field_string (uiout, "reason", "function-finished");
 #endif
       return PRINT_UNKNOWN;
@@ -2147,7 +2147,7 @@ print_it_typical (bpstat bs)
 
     case bp_until:
 #ifdef UI_OUT
-      if (interpreter_p && strncmp (interpreter_p, "mi", 2) == 0)
+      if (ui_out_is_mi_like_p (uiout))
        ui_out_field_string (uiout, "reason", "location-reached");
 #endif
       return PRINT_UNKNOWN;
@@ -2354,7 +2354,7 @@ watchpoint_check (PTR p)
         will be deleted already. So we have no choice but print the
         information here. */
 #ifdef UI_OUT
-      if (interpreter_p && strncmp (interpreter_p, "mi", 2) == 0)
+      if (ui_out_is_mi_like_p (uiout))
        ui_out_field_string (uiout, "reason", "watchpoint-scope");
       ui_out_text (uiout, "\nWatchpoint ");
       ui_out_field_int (uiout, "wpnum", bs->breakpoint_at->number);
@@ -2409,7 +2409,12 @@ bpstat_stop_status (CORE_ADDR *pc, int not_a_breakpoint)
   "Error evaluating expression for watchpoint %d\n";
   char message[sizeof (message1) + 30 /* slop */ ];
 
-  /* Get the address where the breakpoint would have been.  */
+  /* Get the address where the breakpoint would have been.  
+     The "not_a_breakpoint" argument is meant to distinguish 
+     between a breakpoint trap event and a trace/singlestep
+     trap event.  For a trace/singlestep trap event, we would
+     not want to subtract DECR_PC_AFTER_BREAK from the PC. */
+
   bp_addr = *pc - (not_a_breakpoint && !SOFTWARE_SINGLE_STEP_P () ? 
                    0 : DECR_PC_AFTER_BREAK);
 
@@ -3476,7 +3481,7 @@ print_one_breakpoint (struct breakpoint *b,
 #ifdef UI_OUT
   /* Output the count also if it is zero, but only if this is
      mi. FIXME: Should have a better test for this. */
-  if (interpreter_p && strncmp (interpreter_p, "mi", 2) == 0)
+  if (ui_out_is_mi_like_p (uiout))
     if (show_breakpoint_hit_counts && b->hit_count == 0)
       ui_out_field_int (uiout, "times", b->hit_count);
 #endif
@@ -3591,36 +3596,41 @@ breakpoint_1 (int bnum, int allflag)
 
 #ifdef UI_OUT
   if (addressprint)
-    ui_out_table_begin (uiout, 6, "BreakpointTable");
+    ui_out_table_begin (uiout, 6, nr_printable_breakpoints, "BreakpointTable");
   else
-    ui_out_table_begin (uiout, 5, "BreakpointTable");
+    ui_out_table_begin (uiout, 5, nr_printable_breakpoints, "BreakpointTable");
 #endif /* UI_OUT */
 
 #ifdef UI_OUT
   if (nr_printable_breakpoints > 0)
-    {
-      annotate_breakpoints_headers ();
-      annotate_field (0);
-      ui_out_table_header (uiout, 3, ui_left, "Num");  /* 1 */
-      annotate_field (1);
-      ui_out_table_header (uiout, 14, ui_left, "Type");        /* 2 */
-      annotate_field (2);
-      ui_out_table_header (uiout, 4, ui_left, "Disp"); /* 3 */
-      annotate_field (3);
-      ui_out_table_header (uiout, 3, ui_left, "Enb");  /* 4 */
-      if (addressprint)
+    annotate_breakpoints_headers ();
+  if (nr_printable_breakpoints > 0)
+    annotate_field (0);
+  ui_out_table_header (uiout, 3, ui_left, "number", "Num");            /* 1 */
+  if (nr_printable_breakpoints > 0)
+    annotate_field (1);
+  ui_out_table_header (uiout, 14, ui_left, "type", "Type");            /* 2 */
+  if (nr_printable_breakpoints > 0)
+    annotate_field (2);
+  ui_out_table_header (uiout, 4, ui_left, "disp", "Disp");             /* 3 */
+  if (nr_printable_breakpoints > 0)
+    annotate_field (3);
+  ui_out_table_header (uiout, 3, ui_left, "enabled", "Enb");   /* 4 */
+  if (addressprint)
        {
-         annotate_field (4);
+         if (nr_printable_breakpoints > 0)
+           annotate_field (4);
          if (TARGET_ADDR_BIT <= 32)
-           ui_out_table_header (uiout, 10, ui_left, "Address");        /* 5 */
+           ui_out_table_header (uiout, 10, ui_left, "addr", "Address");/* 5 */
          else
-           ui_out_table_header (uiout, 18, ui_left, "Address");        /* 5 */
+           ui_out_table_header (uiout, 18, ui_left, "addr", "Address");/* 5 */
        }
-      annotate_field (5);
-      ui_out_table_header (uiout, 40, ui_noalign, "What");     /* 6 */
-      ui_out_table_body (uiout);
-      annotate_breakpoints_table ();
-    }
+  if (nr_printable_breakpoints > 0)
+    annotate_field (5);
+  ui_out_table_header (uiout, 40, ui_noalign, "what", "What"); /* 6 */
+  ui_out_table_body (uiout);
+  if (nr_printable_breakpoints > 0)
+    annotate_breakpoints_table ();
 #else
   if (nr_printable_breakpoints > 0)
     {
@@ -3657,6 +3667,11 @@ breakpoint_1 (int bnum, int allflag)
          print_one_breakpoint (b, &last_addr);
       }
   
+
+#ifdef UI_OUT
+  ui_out_table_end (uiout);
+#endif /* UI_OUT */
+
   if (nr_printable_breakpoints == 0)
     {
 #ifdef UI_OUT
@@ -3680,9 +3695,6 @@ breakpoint_1 (int bnum, int allflag)
        set_next_address (last_addr);
     }
 
-#ifdef UI_OUT
-  ui_out_table_end (uiout);
-#endif /* UI_OUT */
   /* FIXME? Should this be moved up so that it is only called when
      there have been breakpoints? */
   annotate_breakpoints_table_end ();
@@ -4497,7 +4509,7 @@ mention (struct breakpoint *b)
 #endif
     case bp_breakpoint:
 #ifdef UI_OUT
-      if (interpreter_p && strncmp (interpreter_p, "mi", 2) == 0)
+      if (ui_out_is_mi_like_p (uiout))
        {
          say_where = 0;
          break;
@@ -4508,7 +4520,7 @@ mention (struct breakpoint *b)
       break;
     case bp_hardware_breakpoint:
 #ifdef UI_OUT
-      if (interpreter_p && strncmp (interpreter_p, "mi", 2) == 0)
+      if (ui_out_is_mi_like_p (uiout))
        {
          say_where = 0;
          break;
@@ -4571,7 +4583,7 @@ mention (struct breakpoint *b)
   do_cleanups (old_chain);
 #endif
 #ifdef UI_OUT
-  if (interpreter_p && strncmp (interpreter_p, "mi", 2) == 0)
+  if (ui_out_is_mi_like_p (uiout))
     return;
 #endif
   printf_filtered ("\n");
This page took 0.026891 seconds and 4 git commands to generate.