[PATCH] Move declaration of breakpoint_chain to the header.

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

[PATCH] Move declaration of breakpoint_chain to the header.

Sourceware - gdb-patches mailing list
TUI was using it.

gdb/ChangeLog:

2019-10-07  Christian Biesinger  <[hidden email]>

        * 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(-)

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];
--
2.23.0.581.g78d2f28ef7-goog

Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] Move declaration of breakpoint_chain to the header.

Tom Tromey-2
>>>>> "Christian" == Christian Biesinger via gdb-patches <[hidden email]> writes:

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

Christian> 2019-10-07  Christian Biesinger  <[hidden email]>

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
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] Move declaration of breakpoint_chain to the header.

Sourceware - gdb-patches mailing list
On Wed, Oct 9, 2019 at 12:43 PM Tom Tromey <[hidden email]> wrote:

>
> >>>>> "Christian" == Christian Biesinger via gdb-patches <[hidden email]> writes:
>
> Christian> TUI was using it.
> Christian> gdb/ChangeLog:
>
> Christian> 2019-10-07  Christian Biesinger  <[hidden email]>
>
> 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