public inbox for gdb-cvs@sourceware.org
help / color / mirror / Atom feed
From: Tom Tromey <tromey@sourceware.org>
To: gdb-cvs@sourceware.org
Subject: [binutils-gdb] Convert static marker tracepoints to vtable ops
Date: Fri, 29 Apr 2022 22:23:56 +0000 (GMT)	[thread overview]
Message-ID: <20220429222356.488C3385842B@sourceware.org> (raw)

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=6d7a8c568bfa0e4b84b3d0ffccaf073d58e3cc4b

commit 6d7a8c568bfa0e4b84b3d0ffccaf073d58e3cc4b
Author: Tom Tromey <tom@tromey.com>
Date:   Sat Jan 15 20:03:54 2022 -0700

    Convert static marker tracepoints to vtable ops
    
    This converts static marker tracepoints to use vtable_breakpoint_ops.

Diff:
---
 gdb/breakpoint.c | 28 ++++++++++++++++++----------
 1 file changed, 18 insertions(+), 10 deletions(-)

diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
index fc8892501c0..2c0a2aac191 100644
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -294,6 +294,14 @@ struct ranged_breakpoint : public ordinary_breakpoint
   void print_recreate (struct ui_file *fp) override;
 };
 
+/* Static tracepoints with marker (`-m').  */
+struct static_marker_tracepoint : public tracepoint
+{
+  std::vector<symtab_and_line> decode_location
+       (struct event_location *location,
+	struct program_space *search_pspace) override;
+};
+
 /* The style in which to perform a dynamic printf.  This is a user
    option because different output options have different tradeoffs;
    if GDB does the printing, there is better error handling if there
@@ -1209,11 +1217,14 @@ new_breakpoint_from_type (bptype type)
 
     case bp_fast_tracepoint:
     case bp_static_tracepoint:
-    case bp_static_marker_tracepoint:
     case bp_tracepoint:
       b = new tracepoint ();
       break;
 
+    case bp_static_marker_tracepoint:
+      b = new static_marker_tracepoint ();
+      break;
+
     case bp_dprintf:
       b = new dprintf_breakpoint ();
       break;
@@ -12425,23 +12436,21 @@ strace_marker_create_breakpoints_sal (struct gdbarch *gdbarch,
     }
 }
 
-static std::vector<symtab_and_line>
-strace_marker_decode_location (struct breakpoint *b,
-			       struct event_location *location,
-			       struct program_space *search_pspace)
+std::vector<symtab_and_line>
+static_marker_tracepoint::decode_location (struct event_location *location,
+					   struct program_space *search_pspace)
 {
-  struct tracepoint *tp = (struct tracepoint *) b;
   const char *s = get_linespec_location (location)->spec_string;
 
   std::vector<symtab_and_line> sals = decode_static_tracepoint_spec (&s);
-  if (sals.size () > tp->static_trace_marker_id_idx)
+  if (sals.size () > static_trace_marker_id_idx)
     {
-      sals[0] = sals[tp->static_trace_marker_id_idx];
+      sals[0] = sals[static_trace_marker_id_idx];
       sals.resize (1);
       return sals;
     }
   else
-    error (_("marker %s not found"), tp->static_trace_marker_id.c_str ());
+    error (_("marker %s not found"), static_trace_marker_id.c_str ());
 }
 
 static struct breakpoint_ops strace_marker_breakpoint_ops;
@@ -14597,7 +14606,6 @@ initialize_breakpoint_ops (void)
   *ops = vtable_breakpoint_ops;
   ops->create_sals_from_location = strace_marker_create_sals_from_location;
   ops->create_breakpoints_sal = strace_marker_create_breakpoints_sal;
-  ops->decode_location = strace_marker_decode_location;
 }
 
 /* Chain containing all defined "enable breakpoint" subcommands.  */


                 reply	other threads:[~2022-04-29 22:23 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220429222356.488C3385842B@sourceware.org \
    --to=tromey@sourceware.org \
    --cc=gdb-cvs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).