public inbox for gdb-cvs@sourceware.org
help / color / mirror / Atom feed
From: Simon Marchi <simark@sourceware.org>
To: gdb-cvs@sourceware.org
Subject: [binutils-gdb] breakpoint: Make is_*point functions return bool
Date: Thu, 11 Jul 2019 01:21:00 -0000	[thread overview]
Message-ID: <20190711012121.99912.qmail@sourceware.org> (raw)

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=f2478a7e8b145a55c343bc7a62c53b021062229e

commit f2478a7e8b145a55c343bc7a62c53b021062229e
Author: Simon Marchi <simon.marchi@efficios.com>
Date:   Wed Jul 10 21:20:38 2019 -0400

    breakpoint: Make is_*point functions return bool
    
    This includes changing the FILTER parameters of two functions
    accordingly.  I also tried to normalize the function comments to our
    current standards.
    
    gdb/ChangeLog:
    
    	* breakpoint.c (is_hardware_watchpoint): Remove
    	forward-declaration.
    	(is_masked_watchpoint): Change return type to bool.
    	(is_tracepoint): Likewise.
    	(is_breakpoint): Likewise.
    	(is_hardware_watchpoint): Likewise.
    	(is_watchpoint): Likewise.
    	(is_no_memory_software_watchpoint): Likewise.
    	(is_catchpoint): Likewise.
    	(breakpoint_1): Make FILTER parameter's return type bool.
    	is_masked_watchpoint): Change return type to bool.
    	(save_breakpoints): Make FILTER parameter's return type bool.
    	* breakpoint.h (is_breakpoint): Change return type to bool.
    	(is_watchpoint): Likewise.
    	(is_catchpoint): Likewise.
    	(is_tracepoint): Likewise.

Diff:
---
 gdb/ChangeLog    | 19 +++++++++++++++++++
 gdb/breakpoint.c | 42 ++++++++++++++++++------------------------
 gdb/breakpoint.h | 16 ++++++++++------
 3 files changed, 47 insertions(+), 30 deletions(-)

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 5f3303d..0121791 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,22 @@
+2019-07-10  Simon Marchi  <simon.marchi@efficios.com>
+
+	* breakpoint.c (is_hardware_watchpoint): Remove
+	forward-declaration.
+	(is_masked_watchpoint): Change return type to bool.
+	(is_tracepoint): Likewise.
+	(is_breakpoint): Likewise.
+	(is_hardware_watchpoint): Likewise.
+	(is_watchpoint): Likewise.
+	(is_no_memory_software_watchpoint): Likewise.
+	(is_catchpoint): Likewise.
+	(breakpoint_1): Make FILTER parameter's return type bool.
+	is_masked_watchpoint): Change return type to bool.
+	(save_breakpoints): Make FILTER parameter's return type bool.
+	* breakpoint.h (is_breakpoint): Change return type to bool.
+	(is_watchpoint): Likewise.
+	(is_catchpoint): Likewise.
+	(is_tracepoint): Likewise.
+
 2019-07-10  Tom Tromey  <tom@tromey.com>
 
 	* defs.h: Don't include gdbarch.h.
diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
index 09c2a27..87ec7b8 100644
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -217,15 +217,13 @@ static void update_global_location_list (enum ugll_insert_mode);
 
 static void update_global_location_list_nothrow (enum ugll_insert_mode);
 
-static int is_hardware_watchpoint (const struct breakpoint *bpt);
-
 static void insert_breakpoint_locations (void);
 
 static void trace_pass_command (const char *, int);
 
 static void set_tracepoint_count (int num);
 
-static int is_masked_watchpoint (const struct breakpoint *b);
+static bool is_masked_watchpoint (const struct breakpoint *b);
 
 static struct bp_location **get_first_locp_gte_addr (CORE_ADDR address);
 
@@ -1037,7 +1035,9 @@ is_longjmp_type (bptype type)
   return type == bp_longjmp || type == bp_exception;
 }
 
-int
+/* See breakpoint.h.  */
+
+bool
 is_tracepoint (const struct breakpoint *b)
 {
   return is_tracepoint_type (b->type);
@@ -1493,12 +1493,9 @@ breakpoint_xfer_memory (gdb_byte *readbuf, gdb_byte *writebuf,
   }
 }
 
-\f
-
-/* Return true if BPT is either a software breakpoint or a hardware
-   breakpoint.  */
+/* See breakpoint.h.  */
 
-int
+bool
 is_breakpoint (const struct breakpoint *bpt)
 {
   return (bpt->type == bp_breakpoint
@@ -1508,7 +1505,7 @@ is_breakpoint (const struct breakpoint *bpt)
 
 /* Return true if BPT is of any hardware watchpoint kind.  */
 
-static int
+static bool
 is_hardware_watchpoint (const struct breakpoint *bpt)
 {
   return (bpt->type == bp_hardware_watchpoint
@@ -1516,10 +1513,9 @@ is_hardware_watchpoint (const struct breakpoint *bpt)
 	  || bpt->type == bp_access_watchpoint);
 }
 
-/* Return true if BPT is of any watchpoint kind, hardware or
-   software.  */
+/* See breakpoint.h.  */
 
-int
+bool
 is_watchpoint (const struct breakpoint *bpt)
 {
   return (is_hardware_watchpoint (bpt)
@@ -1604,7 +1600,7 @@ software_watchpoint_add_no_memory_location (struct breakpoint *b,
 /* Returns true if B is a software watchpoint that is not watching any
    memory (e.g., "watch $pc").  */
 
-static int
+static bool
 is_no_memory_software_watchpoint (struct breakpoint *b)
 {
   return (b->type == bp_watchpoint
@@ -4130,15 +4126,13 @@ hardware_watchpoint_inserted_in_range (const address_space *aspace,
     }
   return 0;
 }
-\f
 
-/* bpstat stuff.  External routines' interfaces are documented
-   in breakpoint.h.  */
+/* See breakpoint.h.  */
 
-int
-is_catchpoint (struct breakpoint *ep)
+bool
+is_catchpoint (struct breakpoint *b)
 {
-  return (ep->type == bp_catchpoint);
+  return (b->type == bp_catchpoint);
 }
 
 /* Frees any storage that is part of a bpstat.  Does not walk the
@@ -6418,7 +6412,7 @@ pending_breakpoint_p (struct breakpoint *b)
 
 static int
 breakpoint_1 (const char *bp_num_list, bool show_internal,
-	      int (*filter) (const struct breakpoint *))
+	      bool (*filter) (const struct breakpoint *))
 {
   struct breakpoint *b;
   struct bp_location *last_loc = NULL;
@@ -10437,7 +10431,7 @@ static struct breakpoint_ops masked_watchpoint_breakpoint_ops;
 
 /* Tell whether the given watchpoint is a masked hardware watchpoint.  */
 
-static int
+static bool
 is_masked_watchpoint (const struct breakpoint *b)
 {
   return b->ops == &masked_watchpoint_breakpoint_ops;
@@ -14903,11 +14897,11 @@ print_recreate_thread (struct breakpoint *b, struct ui_file *fp)
 /* Save information on user settable breakpoints (watchpoints, etc) to
    a new script file named FILENAME.  If FILTER is non-NULL, call it
    on each breakpoint and only include the ones for which it returns
-   non-zero.  */
+   true.  */
 
 static void
 save_breakpoints (const char *filename, int from_tty,
-		  int (*filter) (const struct breakpoint *))
+		  bool (*filter) (const struct breakpoint *))
 {
   struct breakpoint *tp;
   int any = 0;
diff --git a/gdb/breakpoint.h b/gdb/breakpoint.h
index dfe7d15..a825be7 100644
--- a/gdb/breakpoint.h
+++ b/gdb/breakpoint.h
@@ -866,11 +866,12 @@ extern struct breakpoint *breakpoint_find_if
 /* Return true if BPT is either a software breakpoint or a hardware
    breakpoint.  */
 
-extern int is_breakpoint (const struct breakpoint *bpt);
+extern bool is_breakpoint (const struct breakpoint *bpt);
 
-/* Returns true if BPT is really a watchpoint.  */
+/* Return true if BPT is of any watchpoint kind, hardware or
+   software.  */
 
-extern int is_watchpoint (const struct breakpoint *bpt);
+extern bool is_watchpoint (const struct breakpoint *bpt);
 
 /* Return true if BPT is a C++ exception catchpoint (catch
    catch/throw/rethrow).  */
@@ -1554,8 +1555,9 @@ extern void remove_solib_event_breakpoints_at_next_stop (void);
 
 extern void disable_breakpoints_in_shlibs (void);
 
-/* This function returns TRUE if ep is a catchpoint.  */
-extern int is_catchpoint (struct breakpoint *);
+/* This function returns true if B is a catchpoint.  */
+
+extern bool is_catchpoint (struct breakpoint *b);
 
 /* Shared helper function (MI and CLI) for creating and installing
    a shared object event catchpoint.  */
@@ -1634,7 +1636,9 @@ extern struct tracepoint *
 /* Return a vector of all tracepoints currently defined.  */
 extern std::vector<breakpoint *> all_tracepoints (void);
 
-extern int is_tracepoint (const struct breakpoint *b);
+/* Return true if B is of tracepoint kind.  */
+
+extern bool is_tracepoint (const struct breakpoint *b);
 
 /* Return a vector of all static tracepoints defined at ADDR.  */
 extern std::vector<breakpoint *> static_tracepoints_here (CORE_ADDR addr);


                 reply	other threads:[~2019-07-11  1:21 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190711012121.99912.qmail@sourceware.org \
    --to=simark@sourceware.org \
    --cc=gdb-cvs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).