diff options
-rw-r--r-- | gdb/ChangeLog | 5 | ||||
-rw-r--r-- | gdb/breakpoint.c | 17 | ||||
-rw-r--r-- | gdb/breakpoint.h | 14 |
3 files changed, 36 insertions, 0 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 8aa3862..ca9fc15 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,8 @@ +2015-03-11 Sergio Durigan Junior <sergiodj@redhat.com> + + * breakpoint.c (breakpoint_find_if): New function. + * breakpoint.h (breakpoint_find_if): New prototype. + 2015-03-11 Gary Benson <gbenson@redhat.com> * remote-fileio.h (remote_fileio_to_host_stat): New declaration. diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c index 923523e..c0ab1d7 100644 --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c @@ -644,6 +644,23 @@ static struct cmd_list_element *breakpoint_set_cmdlist; static struct cmd_list_element *breakpoint_show_cmdlist; struct cmd_list_element *save_cmdlist; +/* See declaration at breakpoint.h. */ + +struct breakpoint * +breakpoint_find_if (int (*func) (struct breakpoint *b, void *d), + void *user_data) +{ + struct breakpoint *b = NULL; + + ALL_BREAKPOINTS (b) + { + if (func (b, user_data) != 0) + break; + } + + return b; +} + /* Return whether a breakpoint is an active enabled breakpoint. */ static int breakpoint_enabled (struct breakpoint *b) diff --git a/gdb/breakpoint.h b/gdb/breakpoint.h index 85c2240..b85939a 100644 --- a/gdb/breakpoint.h +++ b/gdb/breakpoint.h @@ -825,6 +825,20 @@ struct watchpoint CORE_ADDR hw_wp_mask; }; +/* Given a function FUNC (struct breakpoint *B, void *DATA) and + USER_DATA, call FUNC for every known breakpoint passing USER_DATA + as argument. + + If FUNC returns 1, the loop stops and the current + 'struct breakpoint' being processed is returned. If FUNC returns + zero, the loop continues. + + This function returns either a 'struct breakpoint' pointer or NULL. + It was based on BFD's bfd_sections_find_if function. */ + +extern struct breakpoint *breakpoint_find_if + (int (*func) (struct breakpoint *b, void *d), void *user_data); + /* Return true if BPT is either a software breakpoint or a hardware breakpoint. */ |