public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Tom Tromey <tom@tromey.com>
To: gdb-patches@sourceware.org
Subject: [PATCH v2 4/8] Simplify agent_expr constructor
Date: Tue, 20 Jun 2023 11:36:40 -0600	[thread overview]
Message-ID: <20230619-ax-new-v2-4-47638d750dd7@tromey.com> (raw)
In-Reply-To: <20230619-ax-new-v2-0-47638d750dd7@tromey.com>

This simplifies the agent_expr constructor a bit, and removes the
destructor entirely.
---
 gdb/ax-general.c | 13 -------------
 gdb/ax.h         | 10 ++++++----
 2 files changed, 6 insertions(+), 17 deletions(-)

diff --git a/gdb/ax-general.c b/gdb/ax-general.c
index e2a3c31e7f4..b28c8e70e0c 100644
--- a/gdb/ax-general.c
+++ b/gdb/ax-general.c
@@ -36,19 +36,6 @@ static void generic_ext (struct agent_expr *x, enum agent_op op, int n);
 \f
 /* Functions for building expressions.  */
 
-agent_expr::agent_expr (struct gdbarch *gdbarch, CORE_ADDR scope)
-{
-  this->gdbarch = gdbarch;
-  this->scope = scope;
-
-  this->tracing = 0;
-  this->trace_string = 0;
-}
-
-agent_expr::~agent_expr ()
-{
-}
-
 /* Append the low N bytes of VAL as an N-byte integer to the
    expression X, in big-endian order.  */
 static void
diff --git a/gdb/ax.h b/gdb/ax.h
index b0eb20daf75..67ad3145349 100644
--- a/gdb/ax.h
+++ b/gdb/ax.h
@@ -81,9 +81,11 @@ enum agent_flaws
 struct agent_expr
   {
     /* Construct an empty agent expression.  */
-    explicit agent_expr (struct gdbarch *gdbarch, CORE_ADDR scope);
-
-    ~agent_expr ();
+    agent_expr (struct gdbarch *gdbarch, CORE_ADDR scope)
+      : gdbarch (gdbarch),
+	scope (scope),
+	tracing (0)
+    { }
 
     /* The bytes of the expression.  */
     gdb::byte_vector buf;
@@ -139,7 +141,7 @@ struct agent_expr
        tracenz bytecode to record nonzero bytes, up to a length that
        is the value of trace_string.  */
 
-    int trace_string;
+    int trace_string = 0;
   };
 
 /* An agent_expr owning pointer.  */

-- 
2.39.2


  parent reply	other threads:[~2023-06-20 17:36 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-20 17:36 [PATCH v2 0/8] C++-ify and simplify agent expressions Tom Tromey
2023-06-20 17:36 ` [PATCH v2 1/8] Remove mem2hex Tom Tromey
2023-06-20 17:36 ` [PATCH v2 2/8] Use gdb::byte_vector in agent_expr Tom Tromey
2023-06-24  1:40   ` Simon Marchi
2023-06-30  3:16     ` Tom Tromey
2023-06-20 17:36 ` [PATCH v2 3/8] Use std::vector<bool> for agent_expr::reg_mask Tom Tromey
2023-06-21 16:16   ` Simon Marchi
2023-06-23  2:37     ` Tom Tromey
2023-06-20 17:36 ` Tom Tromey [this message]
2023-06-20 17:36 ` [PATCH v2 5/8] Use bool for agent_expr::tracing Tom Tromey
2023-06-20 17:36 ` [PATCH v2 6/8] Make aop_map 'static' Tom Tromey
2023-06-20 17:36 ` [PATCH v2 7/8] Remove aop_last Tom Tromey
2023-06-20 17:36 ` [PATCH v2 8/8] Use ARRAY_SIZE in ax-general.c Tom Tromey
2023-06-20 17:45 ` [PATCH v2 0/8] C++-ify and simplify agent expressions John Baldwin
2023-06-20 18:01   ` Tom Tromey

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=20230619-ax-new-v2-4-47638d750dd7@tromey.com \
    --to=tom@tromey.com \
    --cc=gdb-patches@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).