From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from progateway7-pub.mail.pro1.eigbox.com (gproxy5-pub.mail.unifiedlayer.com [67.222.38.55]) by sourceware.org (Postfix) with ESMTPS id DDDD1385741D for ; Mon, 2 May 2022 22:15:57 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org DDDD1385741D 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 cmgw15.mail.unifiedlayer.com (unknown [10.0.90.130]) by progateway7.mail.pro1.eigbox.com (Postfix) with ESMTP id 07F3B1004810D for ; Mon, 2 May 2022 22:15:57 +0000 (UTC) Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with ESMTP id leKinvR1Bkku4leKinB4X4; Mon, 02 May 2022 22:15:56 +0000 X-Authority-Reason: nr=8 X-Authority-Analysis: v=2.4 cv=ANANYO9+ c=1 sm=1 tr=0 ts=6270581c 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=bzY7Wjf0EHz5VDR94REA: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=Eptduzbj1MHBKQk+lx9HdnXHAuSTvePeOyO0qb+mg2w=; b=t04i1aFeuVhi3BY/2snLOntyJQ W3moUhjySvYxX0eF01Oa713BWrMb1RxZXdjPhZWrKXdLr45OZZVH9pOYd9lItT+3xeK7L/P6in/tw OzMvBE5FrLeJyE23nHhsApaS9; 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-4u; Mon, 02 May 2022 16:15:56 -0600 From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [PATCH 01/18] Change print_recreate_thread to a method Date: Mon, 2 May 2022 16:15:36 -0600 Message-Id: <20220502221553.1394743-2-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-4u 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: 2 X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes X-Spam-Status: No, score=-3029.8 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:15:59 -0000 This changes print_recreate_thread to be a method on breakpoint. This function is only used as a helper by print_recreate methods, so I thought this transformation made sense. --- gdb/ada-lang.c | 2 +- gdb/break-catch-exec.c | 2 +- gdb/break-catch-fork.c | 2 +- gdb/break-catch-syscall.c | 2 +- gdb/break-catch-throw.c | 2 +- gdb/breakpoint.c | 22 +++++++++++----------- gdb/breakpoint.h | 21 +++++++++++---------- 7 files changed, 27 insertions(+), 26 deletions(-) diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c index 54bcd86ee7f..5f6f16716fe 100644 --- a/gdb/ada-lang.c +++ b/gdb/ada-lang.c @@ -12519,7 +12519,7 @@ ada_catchpoint::print_recreate (struct ui_file *fp) default: internal_error (__FILE__, __LINE__, _("unexpected catchpoint type")); } - print_recreate_thread (this, fp); + print_recreate_thread (fp); } /* See ada-lang.h. */ diff --git a/gdb/break-catch-exec.c b/gdb/break-catch-exec.c index ac4ea18ee65..2ae9ebf2e30 100644 --- a/gdb/break-catch-exec.c +++ b/gdb/break-catch-exec.c @@ -144,7 +144,7 @@ void exec_catchpoint::print_recreate (struct ui_file *fp) { gdb_printf (fp, "catch exec"); - print_recreate_thread (this, fp); + print_recreate_thread (fp); } /* This function attempts to parse an optional "if " clause diff --git a/gdb/break-catch-fork.c b/gdb/break-catch-fork.c index eb88e78ed3a..75e32af0b85 100644 --- a/gdb/break-catch-fork.c +++ b/gdb/break-catch-fork.c @@ -172,7 +172,7 @@ void fork_catchpoint::print_recreate (struct ui_file *fp) { gdb_printf (fp, "catch %s", is_vfork ? "vfork" : "fork"); - print_recreate_thread (this, fp); + print_recreate_thread (fp); } static void diff --git a/gdb/break-catch-syscall.c b/gdb/break-catch-syscall.c index 3b160bf9a04..ff2566b830c 100644 --- a/gdb/break-catch-syscall.c +++ b/gdb/break-catch-syscall.c @@ -331,7 +331,7 @@ syscall_catchpoint::print_recreate (struct ui_file *fp) gdb_printf (fp, " %d", s.number); } - print_recreate_thread (this, fp); + print_recreate_thread (fp); } /* Returns non-zero if 'b' is a syscall catchpoint. */ diff --git a/gdb/break-catch-throw.c b/gdb/break-catch-throw.c index 4b79e0ffcba..8742bc9c861 100644 --- a/gdb/break-catch-throw.c +++ b/gdb/break-catch-throw.c @@ -338,7 +338,7 @@ exception_catchpoint::print_recreate (struct ui_file *fp) gdb_printf (fp, "rethrow"); break; } - print_recreate_thread (this, fp); + print_recreate_thread (fp); } /* Implement the "allocate_location" method for throw and catch diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c index 7241b7b6985..3a2d37e8462 100644 --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c @@ -9335,7 +9335,7 @@ ranged_breakpoint::print_recreate (struct ui_file *fp) gdb_printf (fp, "break-range %s, %s", event_location_to_string (location.get ()), event_location_to_string (location_range_end.get ())); - print_recreate_thread (this, fp); + print_recreate_thread (fp); } /* Find the address where the end of the breakpoint range should be @@ -9739,7 +9739,7 @@ watchpoint::print_recreate (struct ui_file *fp) } gdb_printf (fp, " %s", exp_string.get ()); - print_recreate_thread (this, fp); + print_recreate_thread (fp); } /* Implement the "explains_signal" method for watchpoints. */ @@ -9927,7 +9927,7 @@ masked_watchpoint::print_recreate (struct ui_file *fp) gdb_printf (fp, " %s mask 0x%s", exp_string.get (), phex (hw_wp_mask, sizeof (CORE_ADDR))); - print_recreate_thread (this, fp); + print_recreate_thread (fp); } /* Tell whether the given watchpoint is a masked hardware watchpoint. */ @@ -11807,7 +11807,7 @@ ordinary_breakpoint::print_recreate (struct ui_file *fp) if (loc == NULL && extra_string != NULL) gdb_printf (fp, " %s", extra_string.get ()); - print_recreate_thread (this, fp); + print_recreate_thread (fp); } std::vector @@ -12055,7 +12055,7 @@ tracepoint::print_recreate (struct ui_file *fp) _("unhandled tracepoint type %d"), (int) type); gdb_printf (fp, " %s", event_location_to_string (location.get ())); - print_recreate_thread (this, fp); + print_recreate_thread (fp); if (pass_count) gdb_printf (fp, " passcount %d\n", pass_count); @@ -12112,7 +12112,7 @@ dprintf_breakpoint::print_recreate (struct ui_file *fp) gdb_printf (fp, "dprintf %s,%s", event_location_to_string (location.get ()), extra_string.get ()); - print_recreate_thread (this, fp); + print_recreate_thread (fp); } /* Implement the "after_condition_true" method for dprintf. @@ -14044,13 +14044,13 @@ get_tracepoint_by_number (const char **arg, } void -print_recreate_thread (struct breakpoint *b, struct ui_file *fp) +breakpoint::print_recreate_thread (struct ui_file *fp) const { - if (b->thread != -1) - gdb_printf (fp, " thread %d", b->thread); + if (thread != -1) + gdb_printf (fp, " thread %d", thread); - if (b->task != 0) - gdb_printf (fp, " task %d", b->task); + if (task != 0) + gdb_printf (fp, " task %d", task); gdb_printf (fp, "\n"); } diff --git a/gdb/breakpoint.h b/gdb/breakpoint.h index 1322bc1b9b9..7d4e8740cf0 100644 --- a/gdb/breakpoint.h +++ b/gdb/breakpoint.h @@ -586,15 +586,6 @@ struct breakpoint_ops int, int, int, unsigned); }; -/* Helper for breakpoint_ops->print_recreate implementations. Prints - the "thread" or "task" condition of B, and then a newline. - - Necessary because most breakpoint implementations accept - thread/task conditions at the end of the spec line, like "break foo - thread 1", which needs outputting before any breakpoint-type - specific extra command necessary for B's recreation. */ -extern void print_recreate_thread (struct breakpoint *b, struct ui_file *fp); - enum watchpoint_triggered { /* This watchpoint definitely did not trigger. */ @@ -742,7 +733,6 @@ struct breakpoint /* Nothing to do. */ } - /* Return a range of this breakpoint's locations. */ bp_location_range locations (); @@ -846,6 +836,17 @@ struct breakpoint /* Same as py_bp_object, but for Scheme. */ gdbscm_breakpoint_object *scm_bp_object = NULL; + +protected: + + /* Helper for breakpoint_ops->print_recreate implementations. Prints + the "thread" or "task" condition of B, and then a newline. + + Necessary because most breakpoint implementations accept + thread/task conditions at the end of the spec line, like "break foo + thread 1", which needs outputting before any breakpoint-type + specific extra command necessary for B's recreation. */ + void print_recreate_thread (struct ui_file *fp) const; }; /* The structure to be inherit by all kinds of breakpoints (real -- 2.34.1