From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from outbound-ss-761.bluehost.com (outbound-ss-761.bluehost.com [74.220.211.250]) by sourceware.org (Postfix) with ESMTPS id 89CA83857431 for ; Mon, 2 May 2022 22:15:58 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 89CA83857431 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 cmgw10.mail.unifiedlayer.com (unknown [10.0.90.125]) by progateway8.mail.pro1.eigbox.com (Postfix) with ESMTP id E61871004604B for ; Mon, 2 May 2022 22:15:57 +0000 (UTC) Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with ESMTP id leKjn99ghQs3CleKjnD2At; Mon, 02 May 2022 22:15:57 +0000 X-Authority-Reason: nr=8 X-Authority-Analysis: v=2.4 cv=A+Opg4aG c=1 sm=1 tr=0 ts=6270581d a=ApxJNpeYhEAb1aAlGBBbmA==:117 a=ApxJNpeYhEAb1aAlGBBbmA==:17 a=dLZJa+xiwSxG16/P+YVxDGlgEgI=:19 a=oZkIemNP1mAA:10:nop_rcvd_month_year a=Qbun_eYptAEA:10:endurance_base64_authed_username_1 a=s2grQ44dXPYGCLxJkjwA: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=/PxAafELEQ0Kfk8zl+wMg+PIIa1Z7nGWUN6d4t1nVgM=; b=AWy6u4+iEavgEVrMk4T98BbisU 0aseLZT35CJ5+TAP18s8BQg7VKzbuVzobJcicPrSlqs96o1YkOxKABWAxuTDIg+IuUYRZCpV5855B lSiQm2K3i6W3hQlcp4k240o0Z; Received: from 71-211-158-194.hlrn.qwest.net ([71.211.158.194]:45572 helo=prentzel.Home) by box5379.bluehost.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1nleKi-002K6S-Vj; Mon, 02 May 2022 16:15:57 -0600 From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [PATCH 05/18] Constify breakpoint::print_it Date: Mon, 2 May 2022 16:15:40 -0600 Message-Id: <20220502221553.1394743-6-tom@tromey.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220502221553.1394743-1-tom@tromey.com> References: <20220502221553.1394743-1-tom@tromey.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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: 71.211.158.194 X-Source-L: No X-Exim-ID: 1nleKi-002K6S-Vj X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: 71-211-158-194.hlrn.qwest.net (prentzel.Home) [71.211.158.194]:45572 X-Source-Auth: tom+tromey.com X-Email-Count: 6 X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes X-Spam-Status: No, score=-3029.9 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, GIT_PATCH_0, JMQ_SPF_NEUTRAL, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) 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: , X-List-Received-Date: Mon, 02 May 2022 22:16:00 -0000 This constifies breakpoint::print_it. Doing this pointed out some code in ada-lang.c that can be simplified a little as well. --- gdb/ada-lang.c | 14 ++++++-------- gdb/break-catch-exec.c | 4 ++-- gdb/break-catch-fork.c | 4 ++-- gdb/break-catch-load.c | 4 ++-- gdb/break-catch-sig.c | 4 ++-- gdb/break-catch-syscall.c | 4 ++-- gdb/break-catch-throw.c | 4 ++-- gdb/breakpoint.c | 24 ++++++++++++------------ gdb/breakpoint.h | 4 ++-- 9 files changed, 32 insertions(+), 34 deletions(-) diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c index 5f6f16716fe..7d03e33bdaa 100644 --- a/gdb/ada-lang.c +++ b/gdb/ada-lang.c @@ -11969,8 +11969,7 @@ ada_unhandled_exception_name_addr_from_raise (void) Return zero if the address could not be computed, or if not relevant. */ static CORE_ADDR -ada_exception_name_addr_1 (enum ada_exception_catchpoint_kind ex, - struct breakpoint *b) +ada_exception_name_addr_1 (enum ada_exception_catchpoint_kind ex) { struct ada_inferior_data *data = get_ada_inferior_data (current_inferior ()); @@ -12068,14 +12067,13 @@ ada_exception_message (void) and zero is returned. */ static CORE_ADDR -ada_exception_name_addr (enum ada_exception_catchpoint_kind ex, - struct breakpoint *b) +ada_exception_name_addr (enum ada_exception_catchpoint_kind ex) { CORE_ADDR result = 0; try { - result = ada_exception_name_addr_1 (ex, b); + result = ada_exception_name_addr_1 (ex); } catch (const gdb_exception_error &e) @@ -12132,7 +12130,7 @@ struct ada_catchpoint : public base_breakpoint struct bp_location *allocate_location () override; void re_set () override; void check_status (struct bpstat *bs) override; - enum print_stop_action print_it (struct bpstat *bs) override; + enum print_stop_action print_it (const bpstat *bs) const override; bool print_one (struct bp_location **) override; void print_mention () override; void print_recreate (struct ui_file *fp) override; @@ -12297,7 +12295,7 @@ ada_catchpoint::check_status (bpstat *bs) catchpoint kinds. */ enum print_stop_action -ada_catchpoint::print_it (bpstat *bs) +ada_catchpoint::print_it (const bpstat *bs) const { struct ui_out *uiout = current_uiout; @@ -12328,7 +12326,7 @@ ada_catchpoint::print_it (bpstat *bs) case ada_catch_exception_unhandled: case ada_catch_handlers: { - const CORE_ADDR addr = ada_exception_name_addr (m_kind, this); + const CORE_ADDR addr = ada_exception_name_addr (m_kind); char exception_name[256]; if (addr != 0) diff --git a/gdb/break-catch-exec.c b/gdb/break-catch-exec.c index 2ae9ebf2e30..89fa3935b62 100644 --- a/gdb/break-catch-exec.c +++ b/gdb/break-catch-exec.c @@ -43,7 +43,7 @@ struct exec_catchpoint : public breakpoint const address_space *aspace, CORE_ADDR bp_addr, const target_waitstatus &ws) override; - enum print_stop_action print_it (struct bpstat *bs) override; + enum print_stop_action print_it (const bpstat *bs) const override; bool print_one (struct bp_location **) override; void print_mention () override; void print_recreate (struct ui_file *fp) override; @@ -81,7 +81,7 @@ exec_catchpoint::breakpoint_hit (const struct bp_location *bl, } enum print_stop_action -exec_catchpoint::print_it (bpstat *bs) +exec_catchpoint::print_it (const bpstat *bs) const { struct ui_out *uiout = current_uiout; diff --git a/gdb/break-catch-fork.c b/gdb/break-catch-fork.c index 75e32af0b85..bf4437e0f27 100644 --- a/gdb/break-catch-fork.c +++ b/gdb/break-catch-fork.c @@ -41,7 +41,7 @@ struct fork_catchpoint : public breakpoint const address_space *aspace, CORE_ADDR bp_addr, const target_waitstatus &ws) override; - enum print_stop_action print_it (struct bpstat *bs) override; + enum print_stop_action print_it (const bpstat *bs) const override; bool print_one (struct bp_location **) override; void print_mention () override; void print_recreate (struct ui_file *fp) override; @@ -98,7 +98,7 @@ fork_catchpoint::breakpoint_hit (const struct bp_location *bl, /* Implement the "print_it" method for fork catchpoints. */ enum print_stop_action -fork_catchpoint::print_it (bpstat *bs) +fork_catchpoint::print_it (const bpstat *bs) const { struct ui_out *uiout = current_uiout; diff --git a/gdb/break-catch-load.c b/gdb/break-catch-load.c index 7c927396e3a..d0ef182a49e 100644 --- a/gdb/break-catch-load.c +++ b/gdb/break-catch-load.c @@ -43,7 +43,7 @@ struct solib_catchpoint : public breakpoint CORE_ADDR bp_addr, const target_waitstatus &ws) override; void check_status (struct bpstat *bs) override; - enum print_stop_action print_it (struct bpstat *bs) override; + enum print_stop_action print_it (const bpstat *bs) const override; bool print_one (struct bp_location **) override; void print_mention () override; void print_recreate (struct ui_file *fp) override; @@ -127,7 +127,7 @@ solib_catchpoint::check_status (struct bpstat *bs) } enum print_stop_action -solib_catchpoint::print_it (bpstat *bs) +solib_catchpoint::print_it (const bpstat *bs) const { struct breakpoint *b = bs->breakpoint_at; struct ui_out *uiout = current_uiout; diff --git a/gdb/break-catch-sig.c b/gdb/break-catch-sig.c index 7f73b9e5981..77ecb466250 100644 --- a/gdb/break-catch-sig.c +++ b/gdb/break-catch-sig.c @@ -47,7 +47,7 @@ struct signal_catchpoint : public breakpoint const address_space *aspace, CORE_ADDR bp_addr, const target_waitstatus &ws) override; - enum print_stop_action print_it (struct bpstat *bs) override; + enum print_stop_action print_it (const bpstat *bs) const override; bool print_one (struct bp_location **) override; void print_mention () override; void print_recreate (struct ui_file *fp) override; @@ -183,7 +183,7 @@ signal_catchpoint::breakpoint_hit (const struct bp_location *bl, /* Implement the "print_it" method for signal catchpoints. */ enum print_stop_action -signal_catchpoint::print_it (bpstat *bs) +signal_catchpoint::print_it (const bpstat *bs) const { struct target_waitstatus last; const char *signal_name; diff --git a/gdb/break-catch-syscall.c b/gdb/break-catch-syscall.c index ff2566b830c..5b7cd1a9eb7 100644 --- a/gdb/break-catch-syscall.c +++ b/gdb/break-catch-syscall.c @@ -44,7 +44,7 @@ struct syscall_catchpoint : public breakpoint const address_space *aspace, CORE_ADDR bp_addr, const target_waitstatus &ws) override; - enum print_stop_action print_it (struct bpstat *bs) override; + enum print_stop_action print_it (const bpstat *bs) const override; bool print_one (struct bp_location **) override; void print_mention () override; void print_recreate (struct ui_file *fp) override; @@ -180,7 +180,7 @@ syscall_catchpoint::breakpoint_hit (const struct bp_location *bl, /* Implement the "print_it" method for syscall catchpoints. */ enum print_stop_action -syscall_catchpoint::print_it (bpstat *bs) +syscall_catchpoint::print_it (const bpstat *bs) const { struct ui_out *uiout = current_uiout; struct breakpoint *b = bs->breakpoint_at; diff --git a/gdb/break-catch-throw.c b/gdb/break-catch-throw.c index 8742bc9c861..6b3601a6fd0 100644 --- a/gdb/break-catch-throw.c +++ b/gdb/break-catch-throw.c @@ -68,7 +68,7 @@ static const struct exception_names exception_functions[] = struct exception_catchpoint : public base_breakpoint { void re_set () override; - enum print_stop_action print_it (struct bpstat *bs) override; + enum print_stop_action print_it (const bpstat *bs) const override; bool print_one (struct bp_location **) override; void print_mention () override; void print_recreate (struct ui_file *fp) override; @@ -228,7 +228,7 @@ exception_catchpoint::re_set () } enum print_stop_action -exception_catchpoint::print_it (bpstat *bs) +exception_catchpoint::print_it (const bpstat *bs) const { struct ui_out *uiout = current_uiout; int bp_temp; diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c index 41e827bfca7..e6158e6589b 100644 --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c @@ -259,7 +259,7 @@ static const struct breakpoint_ops tracepoint_probe_breakpoint_ops = struct ordinary_breakpoint : public base_breakpoint { int resources_needed (const struct bp_location *) override; - enum print_stop_action print_it (struct bpstat *bs) override; + enum print_stop_action print_it (const bpstat *bs) const override; void print_mention () override; void print_recreate (struct ui_file *fp) override; }; @@ -269,7 +269,7 @@ struct internal_breakpoint : public base_breakpoint { void re_set () override; void check_status (struct bpstat *bs) override; - enum print_stop_action print_it (struct bpstat *bs) override; + enum print_stop_action print_it (const bpstat *bs) const override; void print_mention () override; }; @@ -278,7 +278,7 @@ struct momentary_breakpoint : public base_breakpoint { void re_set () override; void check_status (struct bpstat *bs) override; - enum print_stop_action print_it (struct bpstat *bs) override; + enum print_stop_action print_it (const bpstat *bs) const override; void print_mention () override; }; @@ -302,7 +302,7 @@ struct ranged_breakpoint : public ordinary_breakpoint CORE_ADDR bp_addr, const target_waitstatus &ws) override; int resources_needed (const struct bp_location *) override; - enum print_stop_action print_it (struct bpstat *bs) override; + enum print_stop_action print_it (const bpstat *bs) const override; bool print_one (struct bp_location **) override; void print_one_detail (struct ui_out *) const override; void print_mention () override; @@ -9207,7 +9207,7 @@ ranged_breakpoint::resources_needed (const struct bp_location *bl) /* Implement the "print_it" method for ranged breakpoints. */ enum print_stop_action -ranged_breakpoint::print_it (bpstat *bs) +ranged_breakpoint::print_it (const bpstat *bs) const { struct bp_location *bl = loc; struct ui_out *uiout = current_uiout; @@ -9566,7 +9566,7 @@ watchpoint::works_in_software_mode () const } enum print_stop_action -watchpoint::print_it (bpstat *bs) +watchpoint::print_it (const bpstat *bs) const { struct breakpoint *b; enum print_stop_action result; @@ -9734,7 +9734,7 @@ struct masked_watchpoint : public watchpoint enum remove_bp_reason reason) override; int resources_needed (const struct bp_location *) override; bool works_in_software_mode () const override; - enum print_stop_action print_it (struct bpstat *bs) override; + enum print_stop_action print_it (const bpstat *bs) const override; void print_one_detail (struct ui_out *) const override; void print_mention () override; void print_recreate (struct ui_file *fp) override; @@ -9781,7 +9781,7 @@ masked_watchpoint::works_in_software_mode () const watchpoints. */ enum print_stop_action -masked_watchpoint::print_it (bpstat *bs) +masked_watchpoint::print_it (const bpstat *bs) const { struct breakpoint *b = bs->breakpoint_at; struct ui_out *uiout = current_uiout; @@ -11557,7 +11557,7 @@ breakpoint::resources_needed (const struct bp_location *bl) } enum print_stop_action -breakpoint::print_it (bpstat *bs) +breakpoint::print_it (const bpstat *bs) const { internal_error_pure_virtual_called (); } @@ -11686,7 +11686,7 @@ ordinary_breakpoint::resources_needed (const struct bp_location *bl) } enum print_stop_action -ordinary_breakpoint::print_it (bpstat *bs) +ordinary_breakpoint::print_it (const bpstat *bs) const { const struct bp_location *bl; int bp_temp; @@ -11827,7 +11827,7 @@ internal_breakpoint::check_status (bpstat *bs) } enum print_stop_action -internal_breakpoint::print_it (bpstat *bs) +internal_breakpoint::print_it (const bpstat *bs) const { switch (type) { @@ -11894,7 +11894,7 @@ momentary_breakpoint::check_status (bpstat *bs) } enum print_stop_action -momentary_breakpoint::print_it (bpstat *bs) +momentary_breakpoint::print_it (const bpstat *bs) const { return PRINT_UNKNOWN; } diff --git a/gdb/breakpoint.h b/gdb/breakpoint.h index bbacbca15fb..194452a3ee3 100644 --- a/gdb/breakpoint.h +++ b/gdb/breakpoint.h @@ -670,7 +670,7 @@ struct breakpoint /* The normal print routine for this breakpoint, called when we hit it. */ - virtual enum print_stop_action print_it (struct bpstat *bs); + virtual enum print_stop_action print_it (const bpstat *bs) const; /* Display information about this breakpoint, for "info breakpoints". Returns false if this method should use the @@ -879,7 +879,7 @@ struct watchpoint : public breakpoint there are not enough hardware resources available. */ virtual bool works_in_software_mode () const; - enum print_stop_action print_it (struct bpstat *bs) override; + enum print_stop_action print_it (const bpstat *bs) const override; void print_mention () override; void print_recreate (struct ui_file *fp) override; bool explains_signal (enum gdb_signal) override; -- 2.34.1