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 5/8] Use bool for agent_expr::tracing
Date: Tue, 20 Jun 2023 11:36:41 -0600	[thread overview]
Message-ID: <20230619-ax-new-v2-5-47638d750dd7@tromey.com> (raw)
In-Reply-To: <20230619-ax-new-v2-0-47638d750dd7@tromey.com>

This changese agent_expr::tracing to have type bool, allowing inline
initialization and cleaning up the code a little.
---
 gdb/ax-gdb.c | 10 +++++-----
 gdb/ax.h     |  7 +++----
 2 files changed, 8 insertions(+), 9 deletions(-)

diff --git a/gdb/ax-gdb.c b/gdb/ax-gdb.c
index b0bde62f465..55450bd2979 100644
--- a/gdb/ax-gdb.c
+++ b/gdb/ax-gdb.c
@@ -2335,7 +2335,7 @@ gen_trace_for_var (CORE_ADDR scope, struct gdbarch *gdbarch,
   agent_expr_up ax (new agent_expr (gdbarch, scope));
   struct axs_value value;
 
-  ax->tracing = 1;
+  ax->tracing = true;
   ax->trace_string = trace_string;
   gen_var_ref (ax.get (), &value, var);
 
@@ -2368,7 +2368,7 @@ gen_trace_for_expr (CORE_ADDR scope, struct expression *expr,
   agent_expr_up ax (new agent_expr (expr->gdbarch, scope));
   struct axs_value value;
 
-  ax->tracing = 1;
+  ax->tracing = true;
   ax->trace_string = trace_string;
   value.optimized_out = 0;
   expr->op->generate_ax (expr, ax.get (), &value);
@@ -2395,7 +2395,7 @@ gen_eval_for_expr (CORE_ADDR scope, struct expression *expr)
   agent_expr_up ax (new agent_expr (expr->gdbarch, scope));
   struct axs_value value;
 
-  ax->tracing = 0;
+  ax->tracing = false;
   value.optimized_out = 0;
   expr->op->generate_ax (expr, ax.get (), &value);
 
@@ -2414,7 +2414,7 @@ gen_trace_for_return_address (CORE_ADDR scope, struct gdbarch *gdbarch,
   agent_expr_up ax (new agent_expr (gdbarch, scope));
   struct axs_value value;
 
-  ax->tracing = 1;
+  ax->tracing = true;
   ax->trace_string = trace_string;
 
   gdbarch_gen_return_address (gdbarch, ax.get (), &value, scope);
@@ -2443,7 +2443,7 @@ gen_printf (CORE_ADDR scope, struct gdbarch *gdbarch,
   int tem;
 
   /* We're computing values, not doing side effects.  */
-  ax->tracing = 0;
+  ax->tracing = false;
 
   /* Evaluate and push the args on the stack in reverse order,
      for simplicity of collecting them on the target side.  */
diff --git a/gdb/ax.h b/gdb/ax.h
index 67ad3145349..0e82ed9e313 100644
--- a/gdb/ax.h
+++ b/gdb/ax.h
@@ -83,8 +83,7 @@ struct agent_expr
     /* Construct an empty agent expression.  */
     agent_expr (struct gdbarch *gdbarch, CORE_ADDR scope)
       : gdbarch (gdbarch),
-	scope (scope),
-	tracing (0)
+	scope (scope)
     { }
 
     /* The bytes of the expression.  */
@@ -132,10 +131,10 @@ struct agent_expr
        be available when the user later tries to evaluate the expression
        in GDB.
 
-       Setting the flag 'tracing' to non-zero enables the code that
+       Setting the flag 'tracing' to true enables the code that
        emits the trace bytecodes at the appropriate points.  */
 
-    unsigned int tracing : 1;
+    bool tracing = false;
 
     /* This indicates that pointers to chars should get an added
        tracenz bytecode to record nonzero bytes, up to a length that

-- 
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 ` [PATCH v2 4/8] Simplify agent_expr constructor Tom Tromey
2023-06-20 17:36 ` Tom Tromey [this message]
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-5-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).