Move declaration of breakpoint_chain to the header.

Message ID 20191007184645.36075-1-cbiesinger@google.com
State New, archived
Headers

Commit Message

Terekhov, Mikhail via Gdb-patches Oct. 7, 2019, 6:46 p.m. UTC
  TUI was using it.

gdb/ChangeLog:

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

	* breakpoint.c (breakpoint_chain): Move comment to header.
	* breakpoint.h (breakpoint_chain): Declare.
	* tui/tui-winsource.c (tui_source_window_base::update_breakpoint_info):
	Remove declaration of breakpoint_chain.
---
 gdb/breakpoint.c        | 2 +-
 gdb/breakpoint.h        | 4 ++++
 gdb/tui/tui-winsource.c | 1 -
 3 files changed, 5 insertions(+), 2 deletions(-)
  

Comments

Tom Tromey Oct. 9, 2019, 5:43 p.m. UTC | #1
>>>>> "Christian" == Christian Biesinger via gdb-patches <gdb-patches@sourceware.org> writes:

Christian> TUI was using it.
Christian> gdb/ChangeLog:

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

Christian> 	* breakpoint.c (breakpoint_chain): Move comment to header.
Christian> 	* breakpoint.h (breakpoint_chain): Declare.
Christian> 	* tui/tui-winsource.c (tui_source_window_base::update_breakpoint_info):
Christian> 	Remove declaration of breakpoint_chain.

I think it would be preferable to change the TUI to use
iterate_over_bp_locations or iterate_over_breakpoints instead;
then make breakpoint_chain static.

Tom
  
Terekhov, Mikhail via Gdb-patches Oct. 9, 2019, 7:03 p.m. UTC | #2
On Wed, Oct 9, 2019 at 12:43 PM Tom Tromey <tom@tromey.com> wrote:
>
> >>>>> "Christian" == Christian Biesinger via gdb-patches <gdb-patches@sourceware.org> writes:
>
> Christian> TUI was using it.
> Christian> gdb/ChangeLog:
>
> Christian> 2019-10-07  Christian Biesinger  <cbiesinger@google.com>
>
> Christian>      * breakpoint.c (breakpoint_chain): Move comment to header.
> Christian>      * breakpoint.h (breakpoint_chain): Declare.
> Christian>      * tui/tui-winsource.c (tui_source_window_base::update_breakpoint_info):
> Christian>      Remove declaration of breakpoint_chain.
>
> I think it would be preferable to change the TUI to use
> iterate_over_bp_locations or iterate_over_breakpoints instead;
> then make breakpoint_chain static.

Thanks, I will send an updated version in a moment. It will be a patch
set because I'm also changing iterate_over_breakpoints to take a
function_view.

Christian
  

Patch

diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
index 0a70516338..fb2ef78c06 100644
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -519,7 +519,7 @@  bool target_exact_watchpoints = false;
   for (B = breakpoint_chain; B; B = B->next)  \
     if (is_tracepoint (B))
 
-/* Chains of all breakpoints defined.  */
+/* See breakpoint.h.  */
 
 struct breakpoint *breakpoint_chain;
 
diff --git a/gdb/breakpoint.h b/gdb/breakpoint.h
index 9791032c5e..4cd3c2547d 100644
--- a/gdb/breakpoint.h
+++ b/gdb/breakpoint.h
@@ -849,6 +849,10 @@  struct watchpoint : public breakpoint
   CORE_ADDR hw_wp_mask;
 };
 
+/* Chains of all breakpoints defined.  */
+
+extern struct breakpoint *breakpoint_chain;
+
 /* Given a function FUNC (struct breakpoint *B, void *DATA) and
    USER_DATA, call FUNC for every known breakpoint passing USER_DATA
    as argument.
diff --git a/gdb/tui/tui-winsource.c b/gdb/tui/tui-winsource.c
index 683856de81..78c314c0a7 100644
--- a/gdb/tui/tui-winsource.c
+++ b/gdb/tui/tui-winsource.c
@@ -402,7 +402,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];