From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 85545 invoked by alias); 10 Jul 2019 16:50:35 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 85537 invoked by uid 89); 10 Jul 2019 16:50:35 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-22.1 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.1 spammy=HDKIM-Filter:v2.10.3 X-HELO: mail.efficios.com Received: from mail.efficios.com (HELO mail.efficios.com) (167.114.142.138) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 10 Jul 2019 16:50:33 +0000 Received: from localhost (ip6-localhost [IPv6:::1]) by mail.efficios.com (Postfix) with ESMTP id EA4E32A4CD1 for ; Wed, 10 Jul 2019 12:50:30 -0400 (EDT) Received: from mail.efficios.com ([IPv6:::1]) by localhost (mail02.efficios.com [IPv6:::1]) (amavisd-new, port 10032) with ESMTP id Q0oviLrvZVas; Wed, 10 Jul 2019 12:50:30 -0400 (EDT) Received: from localhost (ip6-localhost [IPv6:::1]) by mail.efficios.com (Postfix) with ESMTP id 7CA762A4CCC; Wed, 10 Jul 2019 12:50:30 -0400 (EDT) DKIM-Filter: OpenDKIM Filter v2.10.3 mail.efficios.com 7CA762A4CCC DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=efficios.com; s=default; t=1562777430; bh=GaH33UVT0huriouRDW1tDvrHF/+2W14tT5SAfu23iFE=; h=From:To:Date:Message-Id:MIME-Version; b=kI6y/q7Cr1/UFCHTYFmn2nuBRAiik7fV6XDPTgL7nJwsP+bzWxUmekRGIrAdpH/da sjosY52jVZHnKpx1EDoY/aXH4IlYn2sKOEJAKoqw3hJYnhigVNxyXNSj7WECAcdCW3 KSRF8RodiU/A6Rp1WLHrttOQviRNXP4bj1uWcm2Qfy6IXGHHXbZRWdQ3zf11bRK8LE gZgMPxgJB75Cfx0p7izcmItcBjqqPipOfT3ND+qqj2tp52bo+5x0NEIrd09dQ10k9N BTuLzPZvvyKyXGmRLvs27xbNU7mwKazAFUR1CML4QfY2qdApr+x4syycVYq3R1Hwzo lT5QMprbKGOFA== Received: from mail.efficios.com ([IPv6:::1]) by localhost (mail02.efficios.com [IPv6:::1]) (amavisd-new, port 10026) with ESMTP id bzODhMRfP4v5; Wed, 10 Jul 2019 12:50:30 -0400 (EDT) Received: from smarchi-efficios.internal.efficios.com (192-222-181-218.qc.cable.ebox.net [192.222.181.218]) by mail.efficios.com (Postfix) with ESMTPSA id 585752A4CC7; Wed, 10 Jul 2019 12:50:30 -0400 (EDT) From: Simon Marchi To: gdb-patches@sourceware.org Cc: Simon Marchi Subject: [PATCH] breakpoint: Make is_*point functions return bool Date: Wed, 10 Jul 2019 16:50:00 -0000 Message-Id: <20190710165020.17677-1-simon.marchi@efficios.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-SW-Source: 2019-07/txt/msg00266.txt.bz2 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. --- gdb/breakpoint.c | 42 ++++++++++++++++++------------------------ gdb/breakpoint.h | 16 ++++++++++------ 2 files changed, 28 insertions(+), 30 deletions(-) diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c index 8ae7cd6e7ef0..097fc3e9c873 100644 --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c @@ -217,15 +217,13 @@ static void update_global_location_list (enum ugll_in= sert_mode); =20 static void update_global_location_list_nothrow (enum ugll_insert_mode); =20 -static int is_hardware_watchpoint (const struct breakpoint *bpt); - static void insert_breakpoint_locations (void); =20 static void trace_pass_command (const char *, int); =20 static void set_tracepoint_count (int num); =20 -static int is_masked_watchpoint (const struct breakpoint *b); +static bool is_masked_watchpoint (const struct breakpoint *b); =20 static struct bp_location **get_first_locp_gte_addr (CORE_ADDR address); =20 @@ -1037,7 +1035,9 @@ is_longjmp_type (bptype type) return type =3D=3D bp_longjmp || type =3D=3D bp_exception; } =20 -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, } } =20 -=0C - -/* Return true if BPT is either a software breakpoint or a hardware - breakpoint. */ +/* See breakpoint.h. */ =20 -int +bool is_breakpoint (const struct breakpoint *bpt) { return (bpt->type =3D=3D bp_breakpoint @@ -1508,7 +1505,7 @@ is_breakpoint (const struct breakpoint *bpt) =20 /* Return true if BPT is of any hardware watchpoint kind. */ =20 -static int +static bool is_hardware_watchpoint (const struct breakpoint *bpt) { return (bpt->type =3D=3D bp_hardware_watchpoint @@ -1516,10 +1513,9 @@ is_hardware_watchpoint (const struct breakpoint *bpt) || bpt->type =3D=3D bp_access_watchpoint); } =20 -/* Return true if BPT is of any watchpoint kind, hardware or - software. */ +/* See breakpoint.h. */ =20 -int +bool is_watchpoint (const struct breakpoint *bpt) { return (is_hardware_watchpoint (bpt) @@ -1604,7 +1600,7 @@ software_watchpoint_add_no_memory_location (struct br= eakpoint *b, /* Returns true if B is a software watchpoint that is not watching any memory (e.g., "watch $pc"). */ =20 -static int +static bool is_no_memory_software_watchpoint (struct breakpoint *b) { return (b->type =3D=3D bp_watchpoint @@ -4130,15 +4126,13 @@ hardware_watchpoint_inserted_in_range (const addres= s_space *aspace, } return 0; } -=0C =20 -/* bpstat stuff. External routines' interfaces are documented - in breakpoint.h. */ +/* See breakpoint.h. */ =20 -int -is_catchpoint (struct breakpoint *ep) +bool +is_catchpoint (struct breakpoint *b) { - return (ep->type =3D=3D bp_catchpoint); + return (b->type =3D=3D bp_catchpoint); } =20 /* Frees any storage that is part of a bpstat. Does not walk the @@ -6416,7 +6410,7 @@ pending_breakpoint_p (struct breakpoint *b) =20 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 =3D NULL; @@ -10435,7 +10429,7 @@ static struct breakpoint_ops masked_watchpoint_brea= kpoint_ops; =20 /* Tell whether the given watchpoint is a masked hardware watchpoint. */ =20 -static int +static bool is_masked_watchpoint (const struct breakpoint *b) { return b->ops =3D=3D &masked_watchpoint_breakpoint_ops; @@ -14901,11 +14895,11 @@ print_recreate_thread (struct breakpoint *b, stru= ct 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. */ =20 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 =3D 0; diff --git a/gdb/breakpoint.h b/gdb/breakpoint.h index dfe7d158beb0..a825be72228f 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. */ =20 -extern int is_breakpoint (const struct breakpoint *bpt); +extern bool is_breakpoint (const struct breakpoint *bpt); =20 -/* Returns true if BPT is really a watchpoint. */ +/* Return true if BPT is of any watchpoint kind, hardware or + software. */ =20 -extern int is_watchpoint (const struct breakpoint *bpt); +extern bool is_watchpoint (const struct breakpoint *bpt); =20 /* 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_st= op (void); =20 extern void disable_breakpoints_in_shlibs (void); =20 -/* 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); =20 /* 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 all_tracepoints (void); =20 -extern int is_tracepoint (const struct breakpoint *b); +/* Return true if B is of tracepoint kind. */ + +extern bool is_tracepoint (const struct breakpoint *b); =20 /* Return a vector of all static tracepoints defined at ADDR. */ extern std::vector static_tracepoints_here (CORE_ADDR addr); --=20 2.22.0