From patchwork Fri Nov 11 22:57:44 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 60459 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 3E95F38582AB for ; Fri, 11 Nov 2022 22:59:08 +0000 (GMT) X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from qproxy6-pub.mail.unifiedlayer.com (qproxy6-pub.mail.unifiedlayer.com [69.89.23.12]) by sourceware.org (Postfix) with ESMTPS id 110EB3858D35 for ; Fri, 11 Nov 2022 22:58:50 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 110EB3858D35 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=tromey.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=tromey.com Received: from outbound-ss-820.bluehost.com (outbound-ss-820.bluehost.com [69.89.24.241]) by qproxy6.mail.unifiedlayer.com (Postfix) with ESMTP id 675AC802A305 for ; Fri, 11 Nov 2022 22:58:49 +0000 (UTC) Received: from cmgw14.mail.unifiedlayer.com (unknown [10.0.90.129]) by progateway2.mail.pro1.eigbox.com (Postfix) with ESMTP id 43CE310048CA6 for ; Fri, 11 Nov 2022 22:57:55 +0000 (UTC) Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with ESMTP id tcyBoXs9uBFF9tcyBorh4Y; Fri, 11 Nov 2022 22:57:55 +0000 X-Authority-Reason: nr=8 X-Authority-Analysis: v=2.4 cv=PYI6Ogtd c=1 sm=1 tr=0 ts=636ed373 a=ApxJNpeYhEAb1aAlGBBbmA==:117 a=ApxJNpeYhEAb1aAlGBBbmA==:17 a=dLZJa+xiwSxG16/P+YVxDGlgEgI=:19 a=9xFQ1JgjjksA:10:nop_rcvd_month_year a=Qbun_eYptAEA:10:endurance_base64_authed_username_1 a=lo8-1qLP4o7oEXbQV4gA:9 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tromey.com; s=default; h=Content-Transfer-Encoding:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=fj0p3KREkdneZIdYMEI5rCGglj3T/3YXMd3OP5og+2o=; b=xWWfDKTENJVONWgcPjxw2v/1Y4 3Vx71IUdIZonPStrXEN49vahfzYO6rOFbdtBn6wrtAUZded+TC4rKZbG0hRoBy+e4jKUlwSZcEmSv kG+9REVTpE7ft7u51Mz8oydL+; Received: from 97-122-76-186.hlrn.qwest.net ([97.122.76.186]:59376 helo=localhost.localdomain) by box5379.bluehost.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1otcyA-000NMv-R3; Fri, 11 Nov 2022 15:57:54 -0700 From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [PATCH 2/2] Use bool in bpstat Date: Fri, 11 Nov 2022 15:57:44 -0700 Message-Id: <20221111225744.1978830-3-tom@tromey.com> X-Mailer: git-send-email 2.34.3 In-Reply-To: <20221111225744.1978830-1-tom@tromey.com> References: <20221111225744.1978830-1-tom@tromey.com> MIME-Version: 1.0 X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - box5379.bluehost.com X-AntiAbuse: Original Domain - sourceware.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - tromey.com X-BWhitelist: no X-Source-IP: 97.122.76.186 X-Source-L: No X-Exim-ID: 1otcyA-000NMv-R3 X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: 97-122-76-186.hlrn.qwest.net (localhost.localdomain) [97.122.76.186]:59376 X-Source-Auth: tom+tromey.com X-Email-Count: 3 X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes X-Spam-Status: No, score=-3028.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, GIT_PATCH_0, JMQ_SPF_NEUTRAL, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces+patchwork=sourceware.org@sourceware.org Sender: "Gdb-patches" This changes bpstat to use 'bool' rather than 'char', and updates the uses. --- gdb/break-catch-load.c | 2 +- gdb/break-catch-throw.c | 4 ++-- gdb/breakpoint.c | 38 +++++++++++++++++++------------------- gdb/breakpoint.h | 11 ++++++----- gdb/extension.c | 4 ++-- gdb/extension.h | 2 +- 6 files changed, 31 insertions(+), 30 deletions(-) diff --git a/gdb/break-catch-load.c b/gdb/break-catch-load.c index 617ee2b694d..58764218401 100644 --- a/gdb/break-catch-load.c +++ b/gdb/break-catch-load.c @@ -134,7 +134,7 @@ solib_catchpoint::check_status (struct bpstat *bs) } } - bs->stop = 0; + bs->stop = false; bs->print_it = print_it_noop; } diff --git a/gdb/break-catch-throw.c b/gdb/break-catch-throw.c index 6557ee71449..66432552db6 100644 --- a/gdb/break-catch-throw.c +++ b/gdb/break-catch-throw.c @@ -172,7 +172,7 @@ exception_catchpoint::check_status (struct bpstat *bs) std::string type_name; this->breakpoint::check_status (bs); - if (bs->stop == 0) + if (!bs->stop) return; if (self->pattern == NULL) @@ -200,7 +200,7 @@ exception_catchpoint::check_status (struct bpstat *bs) if (name != nullptr) { if (self->pattern->exec (name, 0, NULL, 0) != 0) - bs->stop = 0; + bs->stop = false; } } diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c index 490708938ec..e7fec0eefd9 100644 --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c @@ -5127,7 +5127,7 @@ bpstat_check_location (const struct bp_location *bl, } /* Determine if the watched values have actually changed, and we - should stop. If not, set BS->stop to 0. */ + should stop. If not, set BS->stop to false. */ static void bpstat_check_watchpoint (bpstat *bs) @@ -5194,7 +5194,7 @@ bpstat_check_watchpoint (bpstat *bs) break; case WP_IGNORE: bs->print_it = print_it_noop; - bs->stop = 0; + bs->stop = false; break; case WP_VALUE_CHANGED: if (b->type == bp_read_watchpoint) @@ -5261,7 +5261,7 @@ bpstat_check_watchpoint (bpstat *bs) updated it, so this trap must be for a write. Ignore it. */ bs->print_it = print_it_noop; - bs->stop = 0; + bs->stop = false; } } break; @@ -5272,7 +5272,7 @@ bpstat_check_watchpoint (bpstat *bs) /* Don't stop: write watchpoints shouldn't fire if the value hasn't changed. */ bs->print_it = print_it_noop; - bs->stop = 0; + bs->stop = false; } /* Stop. */ break; @@ -5288,7 +5288,7 @@ bpstat_check_watchpoint (bpstat *bs) watchpoint triggered after all. So don't print anything for this watchpoint. */ bs->print_it = print_it_noop; - bs->stop = 0; + bs->stop = false; } } } @@ -5331,7 +5331,7 @@ bpstat_check_breakpoint_conditions (bpstat *bs, thread_info *thread) infrun_debug_printf ("incorrect frame %s not %s, not stopping", get_stack_frame_id (get_current_frame ()).to_string ().c_str (), b->frame_id.to_string ().c_str ()); - bs->stop = 0; + bs->stop = false; return; } @@ -5342,7 +5342,7 @@ bpstat_check_breakpoint_conditions (bpstat *bs, thread_info *thread) || (b->task != 0 && b->task != ada_get_task_number (thread))) { infrun_debug_printf ("incorrect thread or task, not stopping"); - bs->stop = 0; + bs->stop = false; return; } @@ -5432,7 +5432,7 @@ bpstat_check_breakpoint_conditions (bpstat *bs, thread_info *thread) if (cond != nullptr && !condition_result) { infrun_debug_printf ("condition_result = false, not stopping"); - bs->stop = 0; + bs->stop = false; return; } else if (b->ignore_count > 0) @@ -5440,7 +5440,7 @@ bpstat_check_breakpoint_conditions (bpstat *bs, thread_info *thread) infrun_debug_printf ("ignore count %d, not stopping", b->ignore_count); b->ignore_count--; - bs->stop = 0; + bs->stop = false; /* Increase the hit count even though we don't stop. */ ++(b->hit_count); gdb::observers::breakpoint_modified.notify (b); @@ -5503,8 +5503,8 @@ build_bpstat_chain (const address_space *aspace, CORE_ADDR bp_addr, /* Assume we stop. Should we find a watchpoint that is not actually triggered, or if the condition of the breakpoint evaluates as false, we'll reset 'stop' to 0. */ - bs->stop = 1; - bs->print = 1; + bs->stop = true; + bs->print = true; /* If this is a scope breakpoint, mark the associated watchpoint as triggered so that we will handle the @@ -5530,8 +5530,8 @@ build_bpstat_chain (const address_space *aspace, CORE_ADDR bp_addr, { bpstat *bs = new bpstat (loc, &bs_link); /* For hits of moribund locations, we should just proceed. */ - bs->stop = 0; - bs->print = 0; + bs->stop = false; + bs->print = false; bs->print_it = print_it_noop; } } @@ -5608,11 +5608,11 @@ bpstat_stop_status (const address_space *aspace, } gdb::observers::breakpoint_modified.notify (b); if (b->silent) - bs->print = 0; + bs->print = false; bs->commands = b->commands; if (command_line_is_silent (bs->commands ? bs->commands.get () : NULL)) - bs->print = 0; + bs->print = false; b->after_condition_true (bs); } @@ -11754,11 +11754,11 @@ internal_breakpoint::check_status (bpstat *bs) events. This allows the user to get control and place breakpoints in initializer routines for dynamically loaded objects (among other things). */ - bs->stop = stop_on_solib_events; - bs->print = stop_on_solib_events; + bs->stop = stop_on_solib_events != 0; + bs->print = stop_on_solib_events != 0; } else - bs->stop = 0; + bs->stop = false; } enum print_stop_action @@ -12005,7 +12005,7 @@ dprintf_breakpoint::after_condition_true (struct bpstat *bs) /* dprintf's never cause a stop. This wasn't set in the check_status hook instead because that would make the dprintf's condition not be evaluated. */ - bs->stop = 0; + bs->stop = false; /* Run the command list here. Take ownership of it instead of copying. We never want these commands to run later in diff --git a/gdb/breakpoint.h b/gdb/breakpoint.h index 360fa760577..305c50c1c34 100644 --- a/gdb/breakpoint.h +++ b/gdb/breakpoint.h @@ -664,7 +664,8 @@ struct breakpoint const target_waitstatus &ws); /* Check internal conditions of the breakpoint referred to by BS. - If we should not stop for this breakpoint, set BS->stop to 0. */ + If we should not stop for this breakpoint, set BS->stop to + false. */ virtual void check_status (struct bpstat *bs) { /* Always stop. */ @@ -1312,11 +1313,11 @@ struct bpstat /* Old value associated with a watchpoint. */ value_ref_ptr old_val; - /* Nonzero if this breakpoint tells us to print the frame. */ - char print; + /* True if this breakpoint tells us to print the frame. */ + bool print; - /* Nonzero if this breakpoint tells us to stop. */ - char stop; + /* True if this breakpoint tells us to stop. */ + bool stop; /* Tell bpstat_print and print_bp_stop_message how to print stuff associated with this element of the bpstat chain. */ diff --git a/gdb/extension.c b/gdb/extension.c index 8cbd80f45d5..ca6305a3f43 100644 --- a/gdb/extension.c +++ b/gdb/extension.c @@ -597,7 +597,7 @@ get_breakpoint_cond_ext_lang (struct breakpoint *b, /* Return whether a stop condition for breakpoint B says to stop. True is also returned if there is no stop condition for B. */ -int +bool breakpoint_ext_lang_cond_says_stop (struct breakpoint *b) { enum ext_lang_bp_stop stop = EXT_LANG_BP_STOP_UNSET; @@ -626,7 +626,7 @@ breakpoint_ext_lang_cond_says_stop (struct breakpoint *b) } } - return stop == EXT_LANG_BP_STOP_NO ? 0 : 1; + return stop != EXT_LANG_BP_STOP_NO; } /* ^C/SIGINT support. diff --git a/gdb/extension.h b/gdb/extension.h index 72cff218f5b..7586b3c9eca 100644 --- a/gdb/extension.h +++ b/gdb/extension.h @@ -300,7 +300,7 @@ extern void preserve_ext_lang_values (struct objfile *, htab_t copied_types); extern const struct extension_language_defn *get_breakpoint_cond_ext_lang (struct breakpoint *b, enum extension_language skip_lang); -extern int breakpoint_ext_lang_cond_says_stop (struct breakpoint *); +extern bool breakpoint_ext_lang_cond_says_stop (struct breakpoint *); /* If a method with name METHOD_NAME is to be invoked on an object of type TYPE, then all extension languages are searched for implementations of