From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2126) id 473F1385803E; Fri, 6 May 2022 18:10:01 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 473F1385803E Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Tom Tromey To: gdb-cvs@sourceware.org Subject: [binutils-gdb] Change print_recreate_thread to a method X-Act-Checkin: binutils-gdb X-Git-Author: Tom Tromey X-Git-Refname: refs/heads/master X-Git-Oldrev: dd9cd55e990bcc9f8448cac38d242d53974b3604 X-Git-Newrev: 04d0163c3ff280a2ec7d4e06594da750ef8f96d5 Message-Id: <20220506181001.473F1385803E@sourceware.org> Date: Fri, 6 May 2022 18:10:01 +0000 (GMT) X-BeenThere: gdb-cvs@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 May 2022 18:10:01 -0000 https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3D04d0163c3ff2= 80a2ec7d4e06594da750ef8f96d5 commit 04d0163c3ff280a2ec7d4e06594da750ef8f96d5 Author: Tom Tromey Date: Sat Apr 30 07:49:11 2022 -0600 Change print_recreate_thread to a method =20 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. Diff: --- 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); } =20 /* 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); } =20 /* 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); } =20 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); } =20 - print_recreate_thread (this, fp); + print_recreate_thread (fp); } =20 /* 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 *f= p) gdb_printf (fp, "rethrow"); break; } - print_recreate_thread (this, fp); + print_recreate_thread (fp); } =20 /* 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); } =20 /* Find the address where the end of the breakpoint range should be @@ -9739,7 +9739,7 @@ watchpoint::print_recreate (struct ui_file *fp) } =20 gdb_printf (fp, " %s", exp_string.get ()); - print_recreate_thread (this, fp); + print_recreate_thread (fp); } =20 /* Implement the "explains_signal" method for watchpoints. */ @@ -9927,7 +9927,7 @@ masked_watchpoint::print_recreate (struct ui_file *fp) =20 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); } =20 /* Tell whether the given watchpoint is a masked hardware watchpoint. */ @@ -11807,7 +11807,7 @@ ordinary_breakpoint::print_recreate (struct ui_file= *fp) if (loc =3D=3D NULL && extra_string !=3D NULL) gdb_printf (fp, " %s", extra_string.get ()); =20 - print_recreate_thread (this, fp); + print_recreate_thread (fp); } =20 std::vector @@ -12055,7 +12055,7 @@ tracepoint::print_recreate (struct ui_file *fp) _("unhandled tracepoint type %d"), (int) type); =20 gdb_printf (fp, " %s", event_location_to_string (location.get ())); - print_recreate_thread (this, fp); + print_recreate_thread (fp); =20 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); } =20 /* Implement the "after_condition_true" method for dprintf. @@ -14044,13 +14044,13 @@ get_tracepoint_by_number (const char **arg, } =20 void -print_recreate_thread (struct breakpoint *b, struct ui_file *fp) +breakpoint::print_recreate_thread (struct ui_file *fp) const { - if (b->thread !=3D -1) - gdb_printf (fp, " thread %d", b->thread); + if (thread !=3D -1) + gdb_printf (fp, " thread %d", thread); =20 - if (b->task !=3D 0) - gdb_printf (fp, " task %d", b->task); + if (task !=3D 0) + gdb_printf (fp, " task %d", task); =20 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); }; =20 -/* 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 *f= p); - enum watchpoint_triggered { /* This watchpoint definitely did not trigger. */ @@ -742,7 +733,6 @@ struct breakpoint /* Nothing to do. */ } =20 - /* Return a range of this breakpoint's locations. */ bp_location_range locations (); =20 @@ -846,6 +836,17 @@ struct breakpoint =20 /* Same as py_bp_object, but for Scheme. */ gdbscm_breakpoint_object *scm_bp_object =3D 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; }; =20 /* The structure to be inherit by all kinds of breakpoints (real