From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2126) id 61B0B3858CDA; Tue, 10 Jan 2023 21:15:32 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 61B0B3858CDA DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1673385332; bh=zdMZjtHGJ79twHj+03isVObxzBXKmcZiKIzxaB/qabU=; h=From:To:Subject:Date:From; b=YOKqL34sYW1FypHwaWQe2xfxiXKB47M54TrUXmcv/9O4AxQFkVgLjgcMB+VOhyeMZ LLanfpHeC/vpCBfut4aM6shuj5SZqce0zscQeDxBoUqL/Hh8vt2gWgWS9G3WdgwFJC cRj58KaW3ZQtEiwDNanYUZgVZyayN51cXwzsF9Z4= 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] Convert say_where to method on code_breakpoint X-Act-Checkin: binutils-gdb X-Git-Author: Tom Tromey X-Git-Refname: refs/heads/master X-Git-Oldrev: 8ec0b0b5df0ebe28c32900afc7ae8ff22b21f381 X-Git-Newrev: 7987c4636abedbf4cd5658ac594e3b936eb43d91 Message-Id: <20230110211532.61B0B3858CDA@sourceware.org> Date: Tue, 10 Jan 2023 21:15:32 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3D7987c4636abe= dbf4cd5658ac594e3b936eb43d91 commit 7987c4636abedbf4cd5658ac594e3b936eb43d91 Author: Tom Tromey Date: Tue Jan 10 08:17:28 2023 -0700 Convert say_where to method on code_breakpoint =20 'say_where' is only useful (and only called for) code breakpoints, so convert it to be a protected method on code_breakpoint. Diff: --- gdb/breakpoint.c | 49 ++++++++++++++++++++++++------------------------- gdb/breakpoint.h | 4 ++++ 2 files changed, 28 insertions(+), 25 deletions(-) diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c index 8cfc46e0bed..6762fad5d2c 100644 --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c @@ -11496,11 +11496,10 @@ bpstat_remove_breakpoint_callback (struct thread_= info *th, void *data) return 0; } =20 -/* Helper for breakpoint and tracepoint breakpoint->mention - callbacks. */ +/* See breakpoint.h. */ =20 -static void -say_where (const breakpoint *b) +void +code_breakpoint::say_where () const { struct value_print_options opts; =20 @@ -11508,58 +11507,58 @@ say_where (const breakpoint *b) =20 /* i18n: cagney/2005-02-11: Below needs to be merged into a single string. */ - if (b->loc =3D=3D NULL) + if (loc =3D=3D NULL) { /* For pending locations, the output differs slightly based - on b->extra_string. If this is non-NULL, it contains either + on extra_string. If this is non-NULL, it contains either a condition or dprintf arguments. */ - if (b->extra_string =3D=3D NULL) + if (extra_string =3D=3D NULL) { - gdb_printf (_(" (%s) pending."), b->locspec->to_string ()); + gdb_printf (_(" (%s) pending."), locspec->to_string ()); } - else if (b->type =3D=3D bp_dprintf) + else if (type =3D=3D bp_dprintf) { gdb_printf (_(" (%s,%s) pending."), - b->locspec->to_string (), - b->extra_string.get ()); + locspec->to_string (), + extra_string.get ()); } else { gdb_printf (_(" (%s %s) pending."), - b->locspec->to_string (), - b->extra_string.get ()); + locspec->to_string (), + extra_string.get ()); } } else { - if (opts.addressprint || b->loc->symtab =3D=3D NULL) + if (opts.addressprint || loc->symtab =3D=3D NULL) gdb_printf (" at %ps", styled_string (address_style.style (), - paddress (b->loc->gdbarch, - b->loc->address))); - if (b->loc->symtab !=3D NULL) + paddress (loc->gdbarch, + loc->address))); + if (loc->symtab !=3D NULL) { /* If there is a single location, we can print the location more nicely. */ - if (b->loc->next =3D=3D NULL) + if (loc->next =3D=3D NULL) { const char *filename - =3D symtab_to_filename_for_display (b->loc->symtab); + =3D symtab_to_filename_for_display (loc->symtab); gdb_printf (": file %ps, line %d.", styled_string (file_name_style.style (), filename), - b->loc->line_number); + loc->line_number); } else /* This is not ideal, but each location may have a different file name, and this at least reflects the real situation somewhat. */ - gdb_printf (": %s.", b->locspec->to_string ()); + gdb_printf (": %s.", locspec->to_string ()); } =20 - if (b->loc->next) + if (loc->next) { - struct bp_location *loc =3D b->loc; + struct bp_location *loc =3D loc; int n =3D 0; for (; loc; loc =3D loc->next) ++n; @@ -11794,7 +11793,7 @@ ordinary_breakpoint::print_mention () const break; } =20 - say_where (this); + say_where (); } =20 void @@ -12054,7 +12053,7 @@ tracepoint::print_mention () const internal_error (_("unhandled tracepoint type %d"), (int) type); } =20 - say_where (this); + say_where (); } =20 void diff --git a/gdb/breakpoint.h b/gdb/breakpoint.h index 7289a09e95c..399bd037977 100644 --- a/gdb/breakpoint.h +++ b/gdb/breakpoint.h @@ -898,6 +898,10 @@ protected: (location_spec *locspec, struct program_space *search_pspace, int *found); + + /* Helper for breakpoint and tracepoint breakpoint->mention + callbacks. */ + void say_where () const; }; =20 /* An instance of this type is used to represent a watchpoint,