diff mbox

Change in binutils-gdb[master]: Make tui-winsource not use breakpoint_chain

Message ID 20191015084250.789D729ECF@gnutoolchain-gerrit.osci.io
State New
Headers show

Commit Message

Simon Marchi (Code Review) Oct. 15, 2019, 8:42 a.m. UTC
Christian Biesinger has uploaded a new patch set version (#3).

Change URL: https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/22
......................................................................

Make tui-winsource not use breakpoint_chain

That's an internal variable of breakpoint.c. Insted, use
iterate_over_breakpoints to update the breakpoint list.

gdb/ChangeLog:

2019-10-09  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
---
M gdb/breakpoint.c
M gdb/tui/tui-winsource.c
2 files changed, 5 insertions(+), 8 deletions(-)
diff mbox

Patch

diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
index 9bbb28f..2fd2438 100644
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -517,7 +517,7 @@ 
 
 /* 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.  */
 
diff --git a/gdb/tui/tui-winsource.c b/gdb/tui/tui-winsource.c
index f1c9f95..3fbc49f 100644
--- a/gdb/tui/tui-winsource.c
+++ b/gdb/tui/tui-winsource.c
@@ -401,8 +401,6 @@ 
 
   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 @@ 
          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 @@ 
 		      || 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 @@ 
 		    mode |= TUI_BP_HARDWARE;
 		}
 	    }
-        }
+	  return false;
+        });
       if (line->break_mode != mode)
         {
           line->break_mode = mode;