Make tui-winsource not use breakpoint_chain
authorChristian Biesinger <cbiesinger@google.com>
Mon, 7 Oct 2019 22:38:51 +0000 (17:38 -0500)
committerChristian Biesinger <cbiesinger@google.com>
Tue, 15 Oct 2019 13:30:00 +0000 (15:30 +0200)
That's an internal variable of breakpoint.c. Insted, use
iterate_over_breakpoints to update the breakpoint list.

gdb/ChangeLog:

2019-10-15  Christian Biesinger  <cbiesinger@google.com>

* breakpoint.c (breakpoint_chain): Make static.
* tui/tui-winsource.c: Call iterate_over_breakpoints instead
of accessing breakpoint_chain.

Change-Id: Ic259b2c3a4c1f5a47f34cfd7fccbdcf274417429

gdb/ChangeLog
gdb/breakpoint.c
gdb/tui/tui-winsource.c

index 39a83741f7f95087e0de1977cbc4ef78e008f053..9d3ec1fae5f90421814504206d73232e53e40839 100644 (file)
@@ -1,3 +1,9 @@
+2019-10-15  Christian Biesinger  <cbiesinger@google.com>
+
+       * breakpoint.c (breakpoint_chain): Make static.
+       * tui/tui-winsource.c: Call iterate_over_breakpoints instead
+       of accessing breakpoint_chain.
+
 2019-10-15  Christian Biesinger  <cbiesinger@google.com>
 
        * breakpoint.c (iterate_over_breakpoints): Change function pointer
index 9bbb28f5277c30a17b1058e9ee6de6242834fcac..2fd2438e61dcd55555e81168cb7fe9f7d3838e15 100644 (file)
@@ -517,7 +517,7 @@ bool target_exact_watchpoints = false;
 
 /* Chains of all breakpoints defined.  */
 
-struct breakpoint *breakpoint_chain;
+static struct breakpoint *breakpoint_chain;
 
 /* Array is sorted by bp_locations_compare - primarily by the ADDRESS.  */
 
index f1c9f958a99ec805dae096499020004a41eb2cc1..3fbc49fd77a4eca1e63bc2fa893e4148222210de 100644 (file)
@@ -401,8 +401,6 @@ tui_source_window_base::update_breakpoint_info
 
   for (i = 0; i < content.size (); i++)
     {
-      struct breakpoint *bp;
-      extern struct breakpoint *breakpoint_chain;
       struct tui_source_element *line;
 
       line = &content[i];
@@ -413,9 +411,7 @@ tui_source_window_base::update_breakpoint_info
          do with it.  Identify enable/disabled breakpoints as well as
          those that we already hit.  */
       tui_bp_flags mode = 0;
-      for (bp = breakpoint_chain;
-           bp != NULL;
-           bp = bp->next)
+      iterate_over_breakpoints ([&] (breakpoint *bp) -> bool
         {
          struct bp_location *loc;
 
@@ -423,7 +419,7 @@ tui_source_window_base::update_breakpoint_info
                      || line->line_or_addr.loa == LOA_ADDRESS);
 
          if (bp == being_deleted)
-           continue;
+           return false;
 
          for (loc = bp->loc; loc != NULL; loc = loc->next)
            {
@@ -441,7 +437,8 @@ tui_source_window_base::update_breakpoint_info
                    mode |= TUI_BP_HARDWARE;
                }
            }
-        }
+         return false;
+        });
       if (line->break_mode != mode)
         {
           line->break_mode = mode;