From patchwork Wed Jul 10 01:51:34 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Marchi X-Patchwork-Id: 33643 Received: (qmail 17879 invoked by alias); 10 Jul 2019 01:51:39 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 17867 invoked by uid 89); 10 Jul 2019 01:51:39 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-16.5 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_SOFTFAIL autolearn=ham version=3.3.1 spammy=constantly, HContent-Transfer-Encoding:8bit X-HELO: barracuda.ebox.ca Received: from barracuda.ebox.ca (HELO barracuda.ebox.ca) (96.127.255.19) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 10 Jul 2019 01:51:38 +0000 Received: from smtp.ebox.ca (smtp.ebox.ca [96.127.255.82]) by barracuda.ebox.ca with ESMTP id jB1e5SnkDbfPjsAm (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 09 Jul 2019 21:51:36 -0400 (EDT) Received: from simark.lan (unknown [192.222.164.54]) by smtp.ebox.ca (Postfix) with ESMTP id 330FF441D65; Tue, 9 Jul 2019 21:51:36 -0400 (EDT) From: Simon Marchi To: gdb-patches@sourceware.org Cc: Simon Marchi Subject: [PATCH 1/2] Make some bpstat functions use bool Date: Tue, 9 Jul 2019 21:51:34 -0400 Message-Id: <20190710015135.28368-1-simon.marchi@polymtl.ca> MIME-Version: 1.0 X-IsSubscribed: yes Change return type to bool and adjust function comments. gdb/ChangeLog: * breakpoint.h (bpstat_explains_signal, bpstat_causes_stop, bpstat_should_step): Return bool, adjust comments. * breakpoint.c (bpstat_explains_signal, bpstat_causes_stop, bpstat_should_step): Likewise. --- gdb/breakpoint.c | 28 ++++++++++++++-------------- gdb/breakpoint.h | 12 ++++++------ 2 files changed, 20 insertions(+), 20 deletions(-) diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c index f780bed27ecf..fc0d72e2407a 100644 --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c @@ -4231,7 +4231,7 @@ bpstat_find_breakpoint (bpstat bsp, struct breakpoint *breakpoint) /* See breakpoint.h. */ -int +bool bpstat_explains_signal (bpstat bsp, enum gdb_signal sig) { for (; bsp != NULL; bsp = bsp->next) @@ -4241,17 +4241,17 @@ bpstat_explains_signal (bpstat bsp, enum gdb_signal sig) /* A moribund location can never explain a signal other than GDB_SIGNAL_TRAP. */ if (sig == GDB_SIGNAL_TRAP) - return 1; + return true; } else { if (bsp->breakpoint_at->ops->explains_signal (bsp->breakpoint_at, sig)) - return 1; + return true; } } - return 0; + return false; } /* Put in *NUM the breakpoint number of the first breakpoint we are @@ -5687,29 +5687,29 @@ bpstat_run_callbacks (bpstat bs_head) } } -/* Nonzero if we should step constantly (e.g. watchpoints on machines - without hardware support). This isn't related to a specific bpstat, - just to things like whether watchpoints are set. */ +/* See breakpoint.h. */ -int -bpstat_should_step (void) +bool +bpstat_should_step () { struct breakpoint *b; ALL_BREAKPOINTS (b) if (breakpoint_enabled (b) && b->type == bp_watchpoint && b->loc != NULL) - return 1; - return 0; + return true; + return false; } -int +/* See breakpoint.h. */ + +bool bpstat_causes_stop (bpstat bs) { for (; bs != NULL; bs = bs->next) if (bs->stop) - return 1; + return true; - return 0; + return false; } diff --git a/gdb/breakpoint.h b/gdb/breakpoint.h index 40834eff634f..dfe7d158beb0 100644 --- a/gdb/breakpoint.h +++ b/gdb/breakpoint.h @@ -1061,18 +1061,18 @@ extern void bpstat_run_callbacks (bpstat bs_head); /* Find the bpstat associated with a breakpoint. NULL otherwise. */ bpstat bpstat_find_breakpoint (bpstat, struct breakpoint *); -/* Nonzero if a signal that we got in target_wait() was due to +/* True if a signal that we got in target_wait() was due to circumstances explained by the bpstat; the signal is therefore not random. */ -extern int bpstat_explains_signal (bpstat, enum gdb_signal); +extern bool bpstat_explains_signal (bpstat, enum gdb_signal); -/* Nonzero is this bpstat causes a stop. */ -extern int bpstat_causes_stop (bpstat); +/* True if this bpstat causes a stop. */ +extern bool bpstat_causes_stop (bpstat); -/* Nonzero if we should step constantly (e.g. watchpoints on machines +/* True if we should step constantly (e.g. watchpoints on machines without hardware support). This isn't related to a specific bpstat, just to things like whether watchpoints are set. */ -extern int bpstat_should_step (void); +extern bool bpstat_should_step (); /* Print a message indicating what happened. Returns nonzero to say that only the source line should be printed after this (zero