Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Tom Tromey <tom@tromey.com>
To: gdb-patches@sourceware.org
Subject: [PATCH 176/203] Convert stap probes to create operations
Date: Fri,  1 Jan 2021 14:46:56 -0700	[thread overview]
Message-ID: <20210101214723.1784144-177-tom@tromey.com> (raw)
In-Reply-To: <20210101214723.1784144-1-tom@tromey.com>

This changes the stap probe code to create operations, rather than
exp_elements.

gdb/ChangeLog
2021-01-01  Tom Tromey  <tom@tromey.com>

	* stap-probe.c (binop_maker_ftype): New typedef.
	(stap_maker_map): New global.
	(stap_make_binop): New function.
	(stap_parse_register_operand): Return operation_up.
	(stap_parse_single_operand, stap_parse_argument_conditionally)
	(stap_parse_argument_1): Likewise.
	(stap_parse_argument): Create operations.
	(stap_probe::parse_arguments): Update.
	(_initialize_stap_probe): Initialize stap_maker_map.
	* ppc-linux-tdep.c (ppc_stap_parse_special_token): Change return
	type.
	* i386-tdep.h (i386_stap_parse_special_token): Change return
	type.
	* i386-tdep.c (i386_stap_parse_special_token_triplet)
	(i386_stap_parse_special_token_three_arg_disp)
	(i386_stap_parse_special_token): Change return type.
	* gdbarch.sh (stap_parse_special_token): Change return type.
	* gdbarch.c: Rebuild.
	* gdbarch.h: Rebuild.
	* arm-linux-tdep.c (arm_stap_parse_special_token): Change return
	type.
	* aarch64-linux-tdep.c (aarch64_stap_parse_special_token): Change
	return type.
---
 gdb/ChangeLog            |  26 +++++
 gdb/aarch64-linux-tdep.c |  58 +++++------
 gdb/arm-linux-tdep.c     |  45 ++++----
 gdb/gdbarch.c            |   2 +-
 gdb/gdbarch.h            |   4 +-
 gdb/gdbarch.sh           |   2 +-
 gdb/i386-tdep.c          | 214 +++++++++++++++------------------------
 gdb/i386-tdep.h          |   5 +-
 gdb/ppc-linux-tdep.c     |  24 ++---
 gdb/stap-probe.c         | 185 +++++++++++++++++++--------------
 10 files changed, 275 insertions(+), 290 deletions(-)

diff --git a/gdb/aarch64-linux-tdep.c b/gdb/aarch64-linux-tdep.c
index 4c2caf8e05b..75ce4a06139 100644
--- a/gdb/aarch64-linux-tdep.c
+++ b/gdb/aarch64-linux-tdep.c
@@ -31,6 +31,7 @@
 #include "tramp-frame.h"
 #include "trad-frame.h"
 #include "target/target.h"
+#include "expop.h"
 
 #include "regcache.h"
 #include "regset.h"
@@ -753,7 +754,7 @@ aarch64_stap_is_single_operand (struct gdbarch *gdbarch, const char *s)
    It returns one if the special token has been parsed successfully,
    or zero if the current token is not considered special.  */
 
-static int
+static expr::operation_up
 aarch64_stap_parse_special_token (struct gdbarch *gdbarch,
 				  struct stap_parse_info *p)
 {
@@ -764,11 +765,9 @@ aarch64_stap_parse_special_token (struct gdbarch *gdbarch,
       char *endp;
       /* Used to save the register name.  */
       const char *start;
-      char *regname;
       int len;
       int got_minus = 0;
       long displacement;
-      struct stoken str;
 
       ++tmp;
       start = tmp;
@@ -778,17 +777,14 @@ aarch64_stap_parse_special_token (struct gdbarch *gdbarch,
 	++tmp;
 
       if (*tmp != ',')
-	return 0;
+	return {};
 
       len = tmp - start;
-      regname = (char *) alloca (len + 2);
-
-      strncpy (regname, start, len);
-      regname[len] = '\0';
+      std::string regname (start, len);
 
-      if (user_reg_map_name_to_regnum (gdbarch, regname, len) == -1)
+      if (user_reg_map_name_to_regnum (gdbarch, regname.c_str (), len) == -1)
 	error (_("Invalid register name `%s' on expression `%s'."),
-	       regname, p->saved_arg);
+	       regname.c_str (), p->saved_arg);
 
       ++tmp;
       tmp = skip_spaces (tmp);
@@ -806,45 +802,39 @@ aarch64_stap_parse_special_token (struct gdbarch *gdbarch,
 	++tmp;
 
       if (!isdigit (*tmp))
-	return 0;
+	return {};
 
       displacement = strtol (tmp, &endp, 10);
       tmp = endp;
 
       /* Skipping last `]'.  */
       if (*tmp++ != ']')
-	return 0;
+	return {};
+      p->arg = tmp;
+
+      using namespace expr;
 
       /* The displacement.  */
-      write_exp_elt_opcode (&p->pstate, OP_LONG);
-      write_exp_elt_type (&p->pstate, builtin_type (gdbarch)->builtin_long);
-      write_exp_elt_longcst (&p->pstate, displacement);
-      write_exp_elt_opcode (&p->pstate, OP_LONG);
+      struct type *long_type = builtin_type (gdbarch)->builtin_long;
       if (got_minus)
-	write_exp_elt_opcode (&p->pstate, UNOP_NEG);
+	displacement = -displacement;
+      operation_up disp = make_operation<long_const_operation> (long_type,
+								displacement);
 
       /* The register name.  */
-      write_exp_elt_opcode (&p->pstate, OP_REGISTER);
-      str.ptr = regname;
-      str.length = len;
-      write_exp_string (&p->pstate, str);
-      write_exp_elt_opcode (&p->pstate, OP_REGISTER);
+      operation_up reg
+	= make_operation<register_operation> (std::move (regname));
 
-      write_exp_elt_opcode (&p->pstate, BINOP_ADD);
+      operation_up sum
+	= make_operation<add_operation> (std::move (reg), std::move (disp));
 
       /* Casting to the expected type.  */
-      write_exp_elt_opcode (&p->pstate, UNOP_CAST);
-      write_exp_elt_type (&p->pstate, lookup_pointer_type (p->arg_type));
-      write_exp_elt_opcode (&p->pstate, UNOP_CAST);
-
-      write_exp_elt_opcode (&p->pstate, UNOP_IND);
-
-      p->arg = tmp;
+      struct type *arg_ptr_type = lookup_pointer_type (p->arg_type);
+      sum = make_operation<unop_cast_operation> (std::move (sum),
+						 arg_ptr_type);
+      return make_operation<unop_ind_operation> (std::move (sum));
     }
-  else
-    return 0;
-
-  return 1;
+  return {};
 }
 
 /* AArch64 process record-replay constructs: syscall, signal etc.  */
diff --git a/gdb/arm-linux-tdep.c b/gdb/arm-linux-tdep.c
index ada7f113746..5522cfe7946 100644
--- a/gdb/arm-linux-tdep.c
+++ b/gdb/arm-linux-tdep.c
@@ -32,6 +32,7 @@
 #include "breakpoint.h"
 #include "auxv.h"
 #include "xml-syscall.h"
+#include "expop.h"
 
 #include "aarch32-tdep.h"
 #include "arch/arm.h"
@@ -1146,7 +1147,7 @@ arm_stap_is_single_operand (struct gdbarch *gdbarch, const char *s)
    It returns one if the special token has been parsed successfully,
    or zero if the current token is not considered special.  */
 
-static int
+static expr::operation_up
 arm_stap_parse_special_token (struct gdbarch *gdbarch,
 			      struct stap_parse_info *p)
 {
@@ -1161,7 +1162,6 @@ arm_stap_parse_special_token (struct gdbarch *gdbarch,
       int len, offset;
       int got_minus = 0;
       long displacement;
-      struct stoken str;
 
       ++tmp;
       start = tmp;
@@ -1171,7 +1171,7 @@ arm_stap_parse_special_token (struct gdbarch *gdbarch,
 	++tmp;
 
       if (*tmp != ',')
-	return 0;
+	return {};
 
       len = tmp - start;
       regname = (char *) alloca (len + 2);
@@ -1212,38 +1212,33 @@ arm_stap_parse_special_token (struct gdbarch *gdbarch,
 
       /* Skipping last `]'.  */
       if (*tmp++ != ']')
-	return 0;
+	return {};
+      p->arg = tmp;
+
+      using namespace expr;
 
       /* The displacement.  */
-      write_exp_elt_opcode (&p->pstate, OP_LONG);
-      write_exp_elt_type (&p->pstate, builtin_type (gdbarch)->builtin_long);
-      write_exp_elt_longcst (&p->pstate, displacement);
-      write_exp_elt_opcode (&p->pstate, OP_LONG);
+      struct type *long_type = builtin_type (gdbarch)->builtin_long;
       if (got_minus)
-	write_exp_elt_opcode (&p->pstate, UNOP_NEG);
+	displacement = -displacement;
+      operation_up disp = make_operation<long_const_operation> (long_type,
+								displacement);
 
       /* The register name.  */
-      write_exp_elt_opcode (&p->pstate, OP_REGISTER);
-      str.ptr = regname;
-      str.length = len;
-      write_exp_string (&p->pstate, str);
-      write_exp_elt_opcode (&p->pstate, OP_REGISTER);
+      operation_up reg
+	= make_operation<register_operation> (regname);
 
-      write_exp_elt_opcode (&p->pstate, BINOP_ADD);
+      operation_up sum
+	= make_operation<add_operation> (std::move (reg), std::move (disp));
 
       /* Casting to the expected type.  */
-      write_exp_elt_opcode (&p->pstate, UNOP_CAST);
-      write_exp_elt_type (&p->pstate, lookup_pointer_type (p->arg_type));
-      write_exp_elt_opcode (&p->pstate, UNOP_CAST);
-
-      write_exp_elt_opcode (&p->pstate, UNOP_IND);
-
-      p->arg = tmp;
+      struct type *arg_ptr_type = lookup_pointer_type (p->arg_type);
+      sum = make_operation<unop_cast_operation> (std::move (sum),
+						 arg_ptr_type);
+      return make_operation<unop_ind_operation> (std::move (sum));
     }
-  else
-    return 0;
 
-  return 1;
+  return {};
 }
 
 /* ARM process record-replay constructs: syscall, signal etc.  */
diff --git a/gdb/gdbarch.c b/gdb/gdbarch.c
index af95aa01cbd..10fd9639645 100644
--- a/gdb/gdbarch.c
+++ b/gdb/gdbarch.c
@@ -4589,7 +4589,7 @@ gdbarch_stap_parse_special_token_p (struct gdbarch *gdbarch)
   return gdbarch->stap_parse_special_token != NULL;
 }
 
-int
+expr::operation_up
 gdbarch_stap_parse_special_token (struct gdbarch *gdbarch, struct stap_parse_info *p)
 {
   gdb_assert (gdbarch != NULL);
diff --git a/gdb/gdbarch.h b/gdb/gdbarch.h
index 3b9d8da4f61..342c29c5980 100644
--- a/gdb/gdbarch.h
+++ b/gdb/gdbarch.h
@@ -1346,8 +1346,8 @@ extern void set_gdbarch_stap_is_single_operand (struct gdbarch *gdbarch, gdbarch
 
 extern bool gdbarch_stap_parse_special_token_p (struct gdbarch *gdbarch);
 
-typedef int (gdbarch_stap_parse_special_token_ftype) (struct gdbarch *gdbarch, struct stap_parse_info *p);
-extern int gdbarch_stap_parse_special_token (struct gdbarch *gdbarch, struct stap_parse_info *p);
+typedef expr::operation_up (gdbarch_stap_parse_special_token_ftype) (struct gdbarch *gdbarch, struct stap_parse_info *p);
+extern expr::operation_up gdbarch_stap_parse_special_token (struct gdbarch *gdbarch, struct stap_parse_info *p);
 extern void set_gdbarch_stap_parse_special_token (struct gdbarch *gdbarch, gdbarch_stap_parse_special_token_ftype *stap_parse_special_token);
 
 /* Perform arch-dependent adjustments to a register name.
diff --git a/gdb/gdbarch.sh b/gdb/gdbarch.sh
index d68d3b7a425..84b645e9915 100755
--- a/gdb/gdbarch.sh
+++ b/gdb/gdbarch.sh
@@ -994,7 +994,7 @@ M;int;stap_is_single_operand;const char *s;s
 # if the token was not recognized as a special token (in this case, returning
 # zero means that the special parser is deferring the parsing to the generic
 # parser), and should advance the buffer pointer (p->arg).
-M;int;stap_parse_special_token;struct stap_parse_info *p;p
+M;expr::operation_up;stap_parse_special_token;struct stap_parse_info *p;p
 
 # Perform arch-dependent adjustments to a register name.
 #
diff --git a/gdb/i386-tdep.c b/gdb/i386-tdep.c
index 1a3017224ae..a23c3d54167 100644
--- a/gdb/i386-tdep.c
+++ b/gdb/i386-tdep.c
@@ -48,6 +48,7 @@
 #include "i387-tdep.h"
 #include "gdbsupport/x86-xstate.h"
 #include "x86-tdep.h"
+#include "expop.h"
 
 #include "record.h"
 #include "record-full.h"
@@ -4067,7 +4068,7 @@ i386_stap_is_single_operand (struct gdbarch *gdbarch, const char *s)
    Return true if the operand was parsed successfully, false
    otherwise.  */
 
-static bool
+static expr::operation_up
 i386_stap_parse_special_token_triplet (struct gdbarch *gdbarch,
 				       struct stap_parse_info *p)
 {
@@ -4079,9 +4080,7 @@ i386_stap_parse_special_token_triplet (struct gdbarch *gdbarch,
       int i;
       long displacements[3];
       const char *start;
-      char *regname;
       int len;
-      struct stoken str;
       char *endp;
 
       got_minus[0] = false;
@@ -4094,7 +4093,7 @@ i386_stap_parse_special_token_triplet (struct gdbarch *gdbarch,
 	}
 
       if (!isdigit ((unsigned char) *s))
-	return false;
+	return {};
 
       displacements[0] = strtol (s, &endp, 10);
       s = endp;
@@ -4102,7 +4101,7 @@ i386_stap_parse_special_token_triplet (struct gdbarch *gdbarch,
       if (*s != '+' && *s != '-')
 	{
 	  /* We are not dealing with a triplet.  */
-	  return false;
+	  return {};
 	}
 
       got_minus[1] = false;
@@ -4115,7 +4114,7 @@ i386_stap_parse_special_token_triplet (struct gdbarch *gdbarch,
 	}
 
       if (!isdigit ((unsigned char) *s))
-	return false;
+	return {};
 
       displacements[1] = strtol (s, &endp, 10);
       s = endp;
@@ -4123,7 +4122,7 @@ i386_stap_parse_special_token_triplet (struct gdbarch *gdbarch,
       if (*s != '+' && *s != '-')
 	{
 	  /* We are not dealing with a triplet.  */
-	  return false;
+	  return {};
 	}
 
       got_minus[2] = false;
@@ -4136,13 +4135,13 @@ i386_stap_parse_special_token_triplet (struct gdbarch *gdbarch,
 	}
 
       if (!isdigit ((unsigned char) *s))
-	return false;
+	return {};
 
       displacements[2] = strtol (s, &endp, 10);
       s = endp;
 
       if (*s != '(' || s[1] != '%')
-	return false;
+	return {};
 
       s += 2;
       start = s;
@@ -4151,57 +4150,46 @@ i386_stap_parse_special_token_triplet (struct gdbarch *gdbarch,
 	++s;
 
       if (*s++ != ')')
-	return false;
+	return {};
 
       len = s - start - 1;
-      regname = (char *) alloca (len + 1);
-
-      strncpy (regname, start, len);
-      regname[len] = '\0';
+      std::string regname (start, len);
 
-      if (user_reg_map_name_to_regnum (gdbarch, regname, len) == -1)
+      if (user_reg_map_name_to_regnum (gdbarch, regname.c_str (), len) == -1)
 	error (_("Invalid register name `%s' on expression `%s'."),
-	       regname, p->saved_arg);
+	       regname.c_str (), p->saved_arg);
 
+      LONGEST value = 0;
       for (i = 0; i < 3; i++)
 	{
-	  write_exp_elt_opcode (&p->pstate, OP_LONG);
-	  write_exp_elt_type
-	    (&p->pstate, builtin_type (gdbarch)->builtin_long);
-	  write_exp_elt_longcst (&p->pstate, displacements[i]);
-	  write_exp_elt_opcode (&p->pstate, OP_LONG);
+	  LONGEST this_val = displacements[i];
 	  if (got_minus[i])
-	    write_exp_elt_opcode (&p->pstate, UNOP_NEG);
+	    this_val = -this_val;
+	  value += this_val;
 	}
 
-      write_exp_elt_opcode (&p->pstate, OP_REGISTER);
-      str.ptr = regname;
-      str.length = len;
-      write_exp_string (&p->pstate, str);
-      write_exp_elt_opcode (&p->pstate, OP_REGISTER);
-
-      write_exp_elt_opcode (&p->pstate, UNOP_CAST);
-      write_exp_elt_type (&p->pstate,
-			  builtin_type (gdbarch)->builtin_data_ptr);
-      write_exp_elt_opcode (&p->pstate, UNOP_CAST);
-
-      write_exp_elt_opcode (&p->pstate, BINOP_ADD);
-      write_exp_elt_opcode (&p->pstate, BINOP_ADD);
-      write_exp_elt_opcode (&p->pstate, BINOP_ADD);
+      p->arg = s;
 
-      write_exp_elt_opcode (&p->pstate, UNOP_CAST);
-      write_exp_elt_type (&p->pstate,
-			  lookup_pointer_type (p->arg_type));
-      write_exp_elt_opcode (&p->pstate, UNOP_CAST);
+      using namespace expr;
 
-      write_exp_elt_opcode (&p->pstate, UNOP_IND);
+      struct type *long_type = builtin_type (gdbarch)->builtin_long;
+      operation_up offset
+	= make_operation<long_const_operation> (long_type, value);
 
-      p->arg = s;
+      operation_up reg
+	= make_operation<register_operation> (std::move (regname));
+      struct type *void_ptr = builtin_type (gdbarch)->builtin_data_ptr;
+      reg = make_operation<unop_cast_operation> (std::move (reg), void_ptr);
 
-      return true;
+      operation_up sum
+	= make_operation<add_operation> (std::move (reg), std::move (offset));
+      struct type *arg_ptr_type = lookup_pointer_type (p->arg_type);
+      sum = make_operation<unop_cast_operation> (std::move (sum),
+						 arg_ptr_type);
+      return make_operation<unop_ind_operation> (std::move (sum));
     }
 
-  return false;
+  return {};
 }
 
 /* Helper function for i386_stap_parse_special_token.
@@ -4213,7 +4201,7 @@ i386_stap_parse_special_token_triplet (struct gdbarch *gdbarch,
    Return true if the operand was parsed successfully, false
    otherwise.  */
 
-static bool
+static expr::operation_up
 i386_stap_parse_special_token_three_arg_disp (struct gdbarch *gdbarch,
 					      struct stap_parse_info *p)
 {
@@ -4226,11 +4214,8 @@ i386_stap_parse_special_token_three_arg_disp (struct gdbarch *gdbarch,
       bool size_minus = false;
       long size = 0;
       const char *start;
-      char *base;
       int len_base;
-      char *index;
       int len_index;
-      struct stoken base_token, index_token;
 
       if (*s == '+')
 	++s;
@@ -4241,7 +4226,7 @@ i386_stap_parse_special_token_three_arg_disp (struct gdbarch *gdbarch,
 	}
 
       if (offset_minus && !isdigit (*s))
-	return false;
+	return {};
 
       if (isdigit (*s))
 	{
@@ -4252,7 +4237,7 @@ i386_stap_parse_special_token_three_arg_disp (struct gdbarch *gdbarch,
 	}
 
       if (*s != '(' || s[1] != '%')
-	return false;
+	return {};
 
       s += 2;
       start = s;
@@ -4261,16 +4246,14 @@ i386_stap_parse_special_token_three_arg_disp (struct gdbarch *gdbarch,
 	++s;
 
       if (*s != ',' || s[1] != '%')
-	return false;
+	return {};
 
       len_base = s - start;
-      base = (char *) alloca (len_base + 1);
-      strncpy (base, start, len_base);
-      base[len_base] = '\0';
+      std::string base (start, len_base);
 
-      if (user_reg_map_name_to_regnum (gdbarch, base, len_base) == -1)
+      if (user_reg_map_name_to_regnum (gdbarch, base.c_str (), len_base) == -1)
 	error (_("Invalid register name `%s' on expression `%s'."),
-	       base, p->saved_arg);
+	       base.c_str (), p->saved_arg);
 
       s += 2;
       start = s;
@@ -4279,16 +4262,15 @@ i386_stap_parse_special_token_three_arg_disp (struct gdbarch *gdbarch,
 	++s;
 
       len_index = s - start;
-      index = (char *) alloca (len_index + 1);
-      strncpy (index, start, len_index);
-      index[len_index] = '\0';
+      std::string index (start, len_index);
 
-      if (user_reg_map_name_to_regnum (gdbarch, index, len_index) == -1)
+      if (user_reg_map_name_to_regnum (gdbarch, index.c_str (),
+				       len_index) == -1)
 	error (_("Invalid register name `%s' on expression `%s'."),
-	       index, p->saved_arg);
+	       index.c_str (), p->saved_arg);
 
       if (*s != ',' && *s != ')')
-	return false;
+	return {};
 
       if (*s == ',')
 	{
@@ -4307,85 +4289,60 @@ i386_stap_parse_special_token_three_arg_disp (struct gdbarch *gdbarch,
 	  s = endp;
 
 	  if (*s != ')')
-	    return false;
+	    return {};
 	}
 
       ++s;
+      p->arg = s;
 
-      if (offset)
+      using namespace expr;
+
+      struct type *long_type = builtin_type (gdbarch)->builtin_long;
+      operation_up reg = make_operation<register_operation> (std::move (base));
+
+      if (offset != 0)
 	{
-	  write_exp_elt_opcode (&p->pstate, OP_LONG);
-	  write_exp_elt_type (&p->pstate,
-			      builtin_type (gdbarch)->builtin_long);
-	  write_exp_elt_longcst (&p->pstate, offset);
-	  write_exp_elt_opcode (&p->pstate, OP_LONG);
 	  if (offset_minus)
-	    write_exp_elt_opcode (&p->pstate, UNOP_NEG);
+	    offset = -offset;
+	  operation_up value
+	    = make_operation<long_const_operation> (long_type, offset);
+	  reg = make_operation<add_operation> (std::move (reg),
+					       std::move (value));
 	}
 
-      write_exp_elt_opcode (&p->pstate, OP_REGISTER);
-      base_token.ptr = base;
-      base_token.length = len_base;
-      write_exp_string (&p->pstate, base_token);
-      write_exp_elt_opcode (&p->pstate, OP_REGISTER);
-
-      if (offset)
-	write_exp_elt_opcode (&p->pstate, BINOP_ADD);
-
-      write_exp_elt_opcode (&p->pstate, OP_REGISTER);
-      index_token.ptr = index;
-      index_token.length = len_index;
-      write_exp_string (&p->pstate, index_token);
-      write_exp_elt_opcode (&p->pstate, OP_REGISTER);
+      operation_up ind_reg
+	= make_operation<register_operation> (std::move (index));
 
-      if (size)
+      if (size != 0)
 	{
-	  write_exp_elt_opcode (&p->pstate, OP_LONG);
-	  write_exp_elt_type (&p->pstate,
-			      builtin_type (gdbarch)->builtin_long);
-	  write_exp_elt_longcst (&p->pstate, size);
-	  write_exp_elt_opcode (&p->pstate, OP_LONG);
 	  if (size_minus)
-	    write_exp_elt_opcode (&p->pstate, UNOP_NEG);
-	  write_exp_elt_opcode (&p->pstate, BINOP_MUL);
+	    size = -size;
+	  operation_up value
+	    = make_operation<long_const_operation> (long_type, size);
+	  ind_reg = make_operation<mul_operation> (std::move (ind_reg),
+						   std::move (value));
 	}
 
-      write_exp_elt_opcode (&p->pstate, BINOP_ADD);
-
-      write_exp_elt_opcode (&p->pstate, UNOP_CAST);
-      write_exp_elt_type (&p->pstate,
-			  lookup_pointer_type (p->arg_type));
-      write_exp_elt_opcode (&p->pstate, UNOP_CAST);
-
-      write_exp_elt_opcode (&p->pstate, UNOP_IND);
-
-      p->arg = s;
+      operation_up sum
+	= make_operation<add_operation> (std::move (reg),
+					 std::move (ind_reg));
 
-      return true;
+      struct type *arg_ptr_type = lookup_pointer_type (p->arg_type);
+      sum = make_operation<unop_cast_operation> (std::move (sum),
+						 arg_ptr_type);
+      return make_operation<unop_ind_operation> (std::move (sum));
     }
 
-  return false;
+  return {};
 }
 
 /* Implementation of `gdbarch_stap_parse_special_token', as defined in
    gdbarch.h.  */
 
-int
+expr::operation_up
 i386_stap_parse_special_token (struct gdbarch *gdbarch,
 			       struct stap_parse_info *p)
 {
-  /* In order to parse special tokens, we use a state-machine that go
-     through every known token and try to get a match.  */
-  enum
-    {
-      TRIPLET,
-      THREE_ARG_DISPLACEMENT,
-      DONE
-    };
-  int current_state;
-
-  current_state = TRIPLET;
-
   /* The special tokens to be parsed here are:
 
      - `register base + (register index * size) + offset', as represented
@@ -4394,26 +4351,13 @@ i386_stap_parse_special_token (struct gdbarch *gdbarch,
      - Operands of the form `-8+3+1(%rbp)', which must be interpreted as
      `*(-8 + 3 - 1 + (void *) $eax)'.  */
 
-  while (current_state != DONE)
-    {
-      switch (current_state)
-	{
-	case TRIPLET:
-	  if (i386_stap_parse_special_token_triplet (gdbarch, p))
-	    return 1;
-	  break;
+  expr::operation_up result
+    = i386_stap_parse_special_token_triplet (gdbarch, p);
 
-	case THREE_ARG_DISPLACEMENT:
-	  if (i386_stap_parse_special_token_three_arg_disp (gdbarch, p))
-	    return 1;
-	  break;
-	}
+  if (result == nullptr)
+    result = i386_stap_parse_special_token_three_arg_disp (gdbarch, p);
 
-      /* Advancing to the next state.  */
-      ++current_state;
-    }
-
-  return 0;
+  return result;
 }
 
 /* Implementation of 'gdbarch_stap_adjust_register', as defined in
diff --git a/gdb/i386-tdep.h b/gdb/i386-tdep.h
index fe0e1185674..ee7655e9861 100644
--- a/gdb/i386-tdep.h
+++ b/gdb/i386-tdep.h
@@ -22,6 +22,7 @@
 
 #include "gdbarch.h"
 #include "infrun.h"
+#include "expression.h"
 
 struct frame_info;
 struct gdbarch;
@@ -485,7 +486,7 @@ extern int i386bsd_sc_reg_offset[];
 extern int i386_stap_is_single_operand (struct gdbarch *gdbarch,
 					const char *s);
 
-extern int i386_stap_parse_special_token (struct gdbarch *gdbarch,
-					  struct stap_parse_info *p);
+extern expr::operation_up i386_stap_parse_special_token
+     (struct gdbarch *gdbarch, struct stap_parse_info *p);
 
 #endif /* i386-tdep.h */
diff --git a/gdb/ppc-linux-tdep.c b/gdb/ppc-linux-tdep.c
index 467d696374c..1e94922f25a 100644
--- a/gdb/ppc-linux-tdep.c
+++ b/gdb/ppc-linux-tdep.c
@@ -52,6 +52,7 @@
 #include "linux-record.h"
 #include "record-full.h"
 #include "infrun.h"
+#include "expop.h"
 
 #include "stap-probe.h"
 #include "ax.h"
@@ -1674,7 +1675,7 @@ ppc_stap_is_single_operand (struct gdbarch *gdbarch, const char *s)
 /* Implementation of `gdbarch_stap_parse_special_token', as defined in
    gdbarch.h.  */
 
-static int
+static expr::operation_up
 ppc_stap_parse_special_token (struct gdbarch *gdbarch,
 			      struct stap_parse_info *p)
 {
@@ -1686,7 +1687,6 @@ ppc_stap_parse_special_token (struct gdbarch *gdbarch,
       const char *s = p->arg;
       char *regname;
       int len;
-      struct stoken str;
 
       while (isdigit (*s))
 	++s;
@@ -1695,7 +1695,7 @@ ppc_stap_parse_special_token (struct gdbarch *gdbarch,
 	{
 	  /* It is a register displacement indeed.  Returning 0 means we are
 	     deferring the treatment of this case to the generic parser.  */
-	  return 0;
+	  return {};
 	}
 
       len = s - p->arg;
@@ -1710,22 +1710,14 @@ ppc_stap_parse_special_token (struct gdbarch *gdbarch,
 	error (_("Invalid register name `%s' on expression `%s'."),
 	       regname, p->saved_arg);
 
-      write_exp_elt_opcode (&p->pstate, OP_REGISTER);
-      str.ptr = regname;
-      str.length = len;
-      write_exp_string (&p->pstate, str);
-      write_exp_elt_opcode (&p->pstate, OP_REGISTER);
-
       p->arg = s;
-    }
-  else
-    {
-      /* All the other tokens should be handled correctly by the generic
-	 parser.  */
-      return 0;
+
+      return expr::make_operation<expr::register_operation> (regname);
     }
 
-  return 1;
+  /* All the other tokens should be handled correctly by the generic
+     parser.  */
+  return {};
 }
 
 /* Initialize linux_record_tdep if not initialized yet.
diff --git a/gdb/stap-probe.c b/gdb/stap-probe.c
index 6ee025744aa..51f04b9e40b 100644
--- a/gdb/stap-probe.c
+++ b/gdb/stap-probe.c
@@ -36,6 +36,8 @@
 #include "parser-defs.h"
 #include "language.h"
 #include "elf-bfd.h"
+#include "expop.h"
+#include <unordered_map>
 
 #include <ctype.h>
 
@@ -261,10 +263,13 @@ enum stap_operand_prec
   STAP_OPERAND_PREC_MUL
 };
 
-static void stap_parse_argument_1 (struct stap_parse_info *p, bool has_lhs,
-				   enum stap_operand_prec prec);
+static expr::operation_up stap_parse_argument_1 (struct stap_parse_info *p,
+						 expr::operation_up &&lhs,
+						 enum stap_operand_prec prec)
+  ATTRIBUTE_UNUSED_RESULT;
 
-static void stap_parse_argument_conditionally (struct stap_parse_info *p);
+static expr::operation_up stap_parse_argument_conditionally
+     (struct stap_parse_info *p) ATTRIBUTE_UNUSED_RESULT;
 
 /* Returns true if *S is an operator, false otherwise.  */
 
@@ -421,6 +426,22 @@ stap_get_opcode (const char **s)
   return op;
 }
 
+typedef expr::operation_up binop_maker_ftype (expr::operation_up &&,
+					      expr::operation_up &&);
+/* Map from an expression opcode to a function that can create a
+   binary operation of that type.  */
+static std::unordered_map<exp_opcode, binop_maker_ftype *> stap_maker_map;
+
+/* Helper function to create a binary operation.  */
+static expr::operation_up
+stap_make_binop (enum exp_opcode opcode, expr::operation_up &&lhs,
+		 expr::operation_up &&rhs)
+{
+  auto iter = stap_maker_map.find (opcode);
+  gdb_assert (iter != stap_maker_map.end ());
+  return iter->second (std::move (lhs), std::move (rhs));
+}
+
 /* Given the bitness of the argument, represented by B, return the
    corresponding `struct type *', or throw an error if B is
    unknown.  */
@@ -670,19 +691,16 @@ stap_check_register_indirection_suffix (struct gdbarch *gdbarch, const char *s,
    language (e.g., `15' is the 15th general-purpose register), but inside
    GDB they have a prefix (the letter `r') appended.  */
 
-static void
+static expr::operation_up
 stap_parse_register_operand (struct stap_parse_info *p)
 {
   /* Simple flag to indicate whether we have seen a minus signal before
      certain number.  */
   bool got_minus = false;
-  /* Flags to indicate whether this register access is being displaced and/or
+  /* Flag to indicate whether this register access is being
      indirected.  */
-  bool disp_p = false;
   bool indirect_p = false;
   struct gdbarch *gdbarch = p->gdbarch;
-  /* Needed to generate the register name as a part of an expression.  */
-  struct stoken str;
   /* Variables used to extract the register name from the probe's
      argument.  */
   const char *start;
@@ -693,6 +711,8 @@ stap_parse_register_operand (struct stap_parse_info *p)
   const char *reg_suffix;
   const char *reg_ind_suffix;
 
+  using namespace expr;
+
   /* Checking for a displacement argument.  */
   if (*p->arg == '+')
     {
@@ -706,23 +726,21 @@ stap_parse_register_operand (struct stap_parse_info *p)
       ++p->arg;
     }
 
+  struct type *long_type = builtin_type (gdbarch)->builtin_long;
+  operation_up disp_op;
   if (isdigit (*p->arg))
     {
       /* The value of the displacement.  */
       long displacement;
       char *endp;
 
-      disp_p = true;
       displacement = strtol (p->arg, &endp, 10);
       p->arg = endp;
 
       /* Generating the expression for the displacement.  */
-      write_exp_elt_opcode (&p->pstate, OP_LONG);
-      write_exp_elt_type (&p->pstate, builtin_type (gdbarch)->builtin_long);
-      write_exp_elt_longcst (&p->pstate, displacement);
-      write_exp_elt_opcode (&p->pstate, OP_LONG);
       if (got_minus)
-	write_exp_elt_opcode (&p->pstate, UNOP_NEG);
+	displacement = -displacement;
+      disp_op = make_operation<long_const_operation> (long_type, displacement);
     }
 
   /* Getting rid of register indirection prefix.  */
@@ -732,7 +750,7 @@ stap_parse_register_operand (struct stap_parse_info *p)
       p->arg += strlen (reg_ind_prefix);
     }
 
-  if (disp_p && !indirect_p)
+  if (disp_op != nullptr && !indirect_p)
     error (_("Invalid register displacement syntax on expression `%s'."),
 	   p->saved_arg);
 
@@ -790,27 +808,23 @@ stap_parse_register_operand (struct stap_parse_info *p)
 			      " (previous name was '%s')"),
 			    newregname.c_str (), regname.c_str ());
 
-	  regname = newregname;
+	  regname = std::move (newregname);
 	}
     }
 
-  write_exp_elt_opcode (&p->pstate, OP_REGISTER);
-  str.ptr = regname.c_str ();
-  str.length = regname.size ();
-  write_exp_string (&p->pstate, str);
-  write_exp_elt_opcode (&p->pstate, OP_REGISTER);
+  operation_up reg = make_operation<register_operation> (std::move (regname));
 
   if (indirect_p)
     {
-      if (disp_p)
-	write_exp_elt_opcode (&p->pstate, BINOP_ADD);
+      if (disp_op != nullptr)
+	reg = make_operation<add_operation> (std::move (disp_op),
+					     std::move (reg));
 
       /* Casting to the expected type.  */
-      write_exp_elt_opcode (&p->pstate, UNOP_CAST);
-      write_exp_elt_type (&p->pstate, lookup_pointer_type (p->arg_type));
-      write_exp_elt_opcode (&p->pstate, UNOP_CAST);
-
-      write_exp_elt_opcode (&p->pstate, UNOP_IND);
+      struct type *arg_ptr_type = lookup_pointer_type (p->arg_type);
+      reg = make_operation<unop_cast_operation> (std::move (reg),
+						 arg_ptr_type);
+      reg = make_operation<unop_ind_operation> (std::move (reg));
     }
 
   /* Getting rid of the register name suffix.  */
@@ -830,6 +844,8 @@ stap_parse_register_operand (struct stap_parse_info *p)
 	error (_("Missing indirection suffix on expression `%s'."),
 	       p->saved_arg);
     }
+
+  return reg;
 }
 
 /* This function is responsible for parsing a single operand.
@@ -847,23 +863,24 @@ stap_parse_register_operand (struct stap_parse_info *p)
    unrecognized operands, allowing arch-specific parsers to be
    created.  */
 
-static void
+static expr::operation_up
 stap_parse_single_operand (struct stap_parse_info *p)
 {
   struct gdbarch *gdbarch = p->gdbarch;
   const char *int_prefix = NULL;
 
+  using namespace expr;
+
   /* We first try to parse this token as a "special token".  */
-  if (gdbarch_stap_parse_special_token_p (gdbarch)
-      && (gdbarch_stap_parse_special_token (gdbarch, p) != 0))
+  if (gdbarch_stap_parse_special_token_p (gdbarch))
     {
-      /* If the return value of the above function is not zero,
-	 it means it successfully parsed the special token.
-
-	 If it is NULL, we try to parse it using our method.  */
-      return;
+      operation_up token = gdbarch_stap_parse_special_token (gdbarch, p);
+      if (token != nullptr)
+	return token;
     }
 
+  struct type *long_type = builtin_type (gdbarch)->builtin_long;
+  operation_up result;
   if (*p->arg == '-' || *p->arg == '~' || *p->arg == '+' || *p->arg == '!')
     {
       char c = *p->arg;
@@ -906,20 +923,22 @@ stap_parse_single_operand (struct stap_parse_info *p)
 	    error (_("Invalid operator `%c' for register displacement "
 		     "on expression `%s'."), c, p->saved_arg);
 
-	  stap_parse_register_operand (p);
+	  result = stap_parse_register_operand (p);
 	}
       else
 	{
 	  /* This is not a displacement.  We skip the operator, and
 	     deal with it when the recursion returns.  */
 	  ++p->arg;
-	  stap_parse_argument_conditionally (p);
+	  result = stap_parse_argument_conditionally (p);
 	  if (c == '-')
-	    write_exp_elt_opcode (&p->pstate, UNOP_NEG);
+	    result = make_operation<unary_neg_operation> (std::move (result));
 	  else if (c == '~')
-	    write_exp_elt_opcode (&p->pstate, UNOP_COMPLEMENT);
+	    result = (make_operation<unary_complement_operation>
+		      (std::move (result)));
 	  else if (c == '!')
-	    write_exp_elt_opcode (&p->pstate, UNOP_LOGICAL_NOT);
+	    result = (make_operation<unary_logical_not_operation>
+		      (std::move (result)));
 	}
     }
   else if (isdigit (*p->arg))
@@ -947,11 +966,7 @@ stap_parse_single_operand (struct stap_parse_info *p)
 	  const char *int_suffix;
 
 	  /* We are dealing with a numeric constant.  */
-	  write_exp_elt_opcode (&p->pstate, OP_LONG);
-	  write_exp_elt_type (&p->pstate,
-			      builtin_type (gdbarch)->builtin_long);
-	  write_exp_elt_longcst (&p->pstate, number);
-	  write_exp_elt_opcode (&p->pstate, OP_LONG);
+	  result = make_operation<long_const_operation> (long_type, number);
 
 	  p->arg = tmp;
 
@@ -962,7 +977,7 @@ stap_parse_single_operand (struct stap_parse_info *p)
 		   p->saved_arg);
 	}
       else if (stap_is_register_indirection_prefix (gdbarch, tmp, NULL))
-	stap_parse_register_operand (p);
+	result = stap_parse_register_operand (p);
       else
 	error (_("Unknown numeric token on expression `%s'."),
 	       p->saved_arg);
@@ -978,10 +993,7 @@ stap_parse_single_operand (struct stap_parse_info *p)
       number = strtol (p->arg, &endp, 10);
       p->arg = endp;
 
-      write_exp_elt_opcode (&p->pstate, OP_LONG);
-      write_exp_elt_type (&p->pstate, builtin_type (gdbarch)->builtin_long);
-      write_exp_elt_longcst (&p->pstate, number);
-      write_exp_elt_opcode (&p->pstate, OP_LONG);
+      result = make_operation<long_const_operation> (long_type, number);
 
       if (stap_check_integer_suffix (gdbarch, p->arg, &int_suffix))
 	p->arg += strlen (int_suffix);
@@ -991,10 +1003,12 @@ stap_parse_single_operand (struct stap_parse_info *p)
     }
   else if (stap_is_register_prefix (gdbarch, p->arg, NULL)
 	   || stap_is_register_indirection_prefix (gdbarch, p->arg, NULL))
-    stap_parse_register_operand (p);
+    result = stap_parse_register_operand (p);
   else
     error (_("Operator `%c' not recognized on expression `%s'."),
 	   *p->arg, p->saved_arg);
+
+  return result;
 }
 
 /* This function parses an argument conditionally, based on single or
@@ -1003,15 +1017,16 @@ stap_parse_single_operand (struct stap_parse_info *p)
    starts with `-', `~', `+' (i.e., unary operators), a digit, or
    something recognized by `gdbarch_stap_is_single_operand'.  */
 
-static void
+static expr::operation_up
 stap_parse_argument_conditionally (struct stap_parse_info *p)
 {
   gdb_assert (gdbarch_stap_is_single_operand_p (p->gdbarch));
 
+  expr::operation_up result;
   if (*p->arg == '-' || *p->arg == '~' || *p->arg == '+' /* Unary.  */
       || isdigit (*p->arg)
       || gdbarch_stap_is_single_operand (p->gdbarch, p->arg))
-    stap_parse_single_operand (p);
+    result = stap_parse_single_operand (p);
   else if (*p->arg == '(')
     {
       /* We are dealing with a parenthesized operand.  It means we
@@ -1021,7 +1036,7 @@ stap_parse_argument_conditionally (struct stap_parse_info *p)
       p->arg = skip_spaces (p->arg);
       ++p->inside_paren_p;
 
-      stap_parse_argument_1 (p, 0, STAP_OPERAND_PREC_NONE);
+      result = stap_parse_argument_1 (p, {}, STAP_OPERAND_PREC_NONE);
 
       --p->inside_paren_p;
       if (*p->arg != ')')
@@ -1034,13 +1049,16 @@ stap_parse_argument_conditionally (struct stap_parse_info *p)
     }
   else
     error (_("Cannot parse expression `%s'."), p->saved_arg);
+
+  return result;
 }
 
 /* Helper function for `stap_parse_argument'.  Please, see its comments to
    better understand what this function does.  */
 
-static void
-stap_parse_argument_1 (struct stap_parse_info *p, bool has_lhs,
+static expr::operation_up ATTRIBUTE_UNUSED_RESULT
+stap_parse_argument_1 (struct stap_parse_info *p,
+		       expr::operation_up &&lhs_in,
 		       enum stap_operand_prec prec)
 {
   /* This is an operator-precedence parser.
@@ -1054,13 +1072,15 @@ stap_parse_argument_1 (struct stap_parse_info *p, bool has_lhs,
   if (p->inside_paren_p)
     p->arg = skip_spaces (p->arg);
 
-  if (!has_lhs)
+  using namespace expr;
+  operation_up lhs = std::move (lhs_in);
+  if (lhs == nullptr)
     {
       /* We were called without a left-side, either because this is the
 	 first call, or because we were called to parse a parenthesized
 	 expression.  It doesn't really matter; we have to parse the
 	 left-side in order to continue the process.  */
-      stap_parse_argument_conditionally (p);
+      lhs = stap_parse_argument_conditionally (p);
     }
 
   /* Start to parse the right-side, and to "join" left and right sides
@@ -1101,7 +1121,7 @@ stap_parse_argument_1 (struct stap_parse_info *p, bool has_lhs,
 	p->arg = skip_spaces (p->arg);
 
       /* Parse the right-side of the expression.  */
-      stap_parse_argument_conditionally (p);
+      operation_up rhs = stap_parse_argument_conditionally (p);
 
       /* While we still have operators, try to parse another
 	 right-side, but using the current right-side as a left-side.  */
@@ -1123,13 +1143,16 @@ stap_parse_argument_1 (struct stap_parse_info *p, bool has_lhs,
 	      break;
 	    }
 
-	  /* Parse the right-side of the expression, but since we already
-	     have a left-side at this point, set `has_lhs' to 1.  */
-	  stap_parse_argument_1 (p, 1, lookahead_prec);
+	  /* Parse the right-side of the expression, using the current
+	     right-hand-side as the left-hand-side of the new
+	     subexpression.  */
+	  rhs = stap_parse_argument_1 (p, std::move (rhs), lookahead_prec);
 	}
 
-      write_exp_elt_opcode (&p->pstate, opcode);
+      lhs = stap_make_binop (opcode, std::move (lhs), std::move (rhs));
     }
+
+  return lhs;
 }
 
 /* Parse a probe's argument.
@@ -1169,14 +1192,14 @@ stap_parse_argument (const char **arg, struct type *atype,
   struct stap_parse_info p (*arg, atype, language_def (language_c),
 			    gdbarch);
 
-  stap_parse_argument_1 (&p, 0, STAP_OPERAND_PREC_NONE);
+  using namespace expr;
+  operation_up result = stap_parse_argument_1 (&p, {}, STAP_OPERAND_PREC_NONE);
 
   gdb_assert (p.inside_paren_p == 0);
 
   /* Casting the final expression to the appropriate type.  */
-  write_exp_elt_opcode (&p.pstate, UNOP_CAST);
-  write_exp_elt_type (&p.pstate, atype);
-  write_exp_elt_opcode (&p.pstate, UNOP_CAST);
+  result = make_operation<unop_cast_operation> (std::move (result), atype);
+  p.pstate.set_operation (std::move (result));
 
   p.arg = skip_spaces (p.arg);
   *arg = p.arg;
@@ -1265,12 +1288,6 @@ stap_probe::parse_arguments (struct gdbarch *gdbarch)
 
       expression_up expr = stap_parse_argument (&cur, atype, gdbarch);
 
-      if (stap_expression_debug)
-	dump_raw_expression (expr.get (), gdb_stdlog,
-			     "before conversion to prefix form");
-
-      prefixify_expression (expr.get ());
-
       if (stap_expression_debug)
 	dump_prefix_expression (expr.get (), gdb_stdlog);
 
@@ -1722,4 +1739,24 @@ NAME matches the probe names.\n\
 OBJECT matches the executable or shared library name."),
 	   info_probes_cmdlist_get ());
 
+
+  using namespace expr;
+  stap_maker_map[BINOP_ADD] = make_operation<add_operation>;
+  stap_maker_map[BINOP_BITWISE_AND] = make_operation<bitwise_and_operation>;
+  stap_maker_map[BINOP_BITWISE_IOR] = make_operation<bitwise_ior_operation>;
+  stap_maker_map[BINOP_BITWISE_XOR] = make_operation<bitwise_xor_operation>;
+  stap_maker_map[BINOP_DIV] = make_operation<div_operation>;
+  stap_maker_map[BINOP_EQUAL] = make_operation<equal_operation>;
+  stap_maker_map[BINOP_GEQ] = make_operation<geq_operation>;
+  stap_maker_map[BINOP_GTR] = make_operation<gtr_operation>;
+  stap_maker_map[BINOP_LEQ] = make_operation<leq_operation>;
+  stap_maker_map[BINOP_LESS] = make_operation<less_operation>;
+  stap_maker_map[BINOP_LOGICAL_AND] = make_operation<logical_and_operation>;
+  stap_maker_map[BINOP_LOGICAL_OR] = make_operation<logical_or_operation>;
+  stap_maker_map[BINOP_LSH] = make_operation<lsh_operation>;
+  stap_maker_map[BINOP_MUL] = make_operation<mul_operation>;
+  stap_maker_map[BINOP_NOTEQUAL] = make_operation<notequal_operation>;
+  stap_maker_map[BINOP_REM] = make_operation<rem_operation>;
+  stap_maker_map[BINOP_RSH] = make_operation<rsh_operation>;
+  stap_maker_map[BINOP_SUB] = make_operation<sub_operation>;
 }
-- 
2.26.2


  parent reply	other threads:[~2021-01-01 21:49 UTC|newest]

Thread overview: 225+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-01 21:44 [PATCH 000/203] Refactor expressions Tom Tromey
2021-01-01 21:44 ` [PATCH 001/203] Split out eval_op_scope Tom Tromey
2021-01-01 21:44 ` [PATCH 002/203] Split out eval_op_var_entry_value Tom Tromey
2021-01-01 21:44 ` [PATCH 003/203] Split out eval_op_var_msym_value Tom Tromey
2021-01-04 11:43   ` Andrew Burgess
2021-02-13 19:37     ` Tom Tromey
2021-01-01 21:44 ` [PATCH 004/203] Split out eval_op_func_static_var Tom Tromey
2021-01-01 21:44 ` [PATCH 005/203] Split out eval_op_register Tom Tromey
2021-01-01 21:44 ` [PATCH 006/203] Split out eval_op_string Tom Tromey
2021-01-01 21:44 ` [PATCH 007/203] Split out eval_op_objc_selector Tom Tromey
2021-01-01 21:44 ` [PATCH 008/203] Split out eval_op_concat Tom Tromey
2021-01-01 21:44 ` [PATCH 009/203] what is this code for Tom Tromey
2021-01-03  6:00   ` Joel Brobecker
2021-01-25  2:28     ` Simon Marchi via Gdb-patches
2021-01-25  3:27       ` Tom Tromey
2021-02-11  2:25       ` Tom Tromey
2021-02-13 19:37         ` Tom Tromey
2021-01-01 21:44 ` [PATCH 010/203] Split out eval_op_ternop Tom Tromey
2021-01-01 21:44 ` [PATCH 011/203] Split out eval_op_structop_struct Tom Tromey
2021-01-01 21:44 ` [PATCH 012/203] Split out eval_op_structop_ptr Tom Tromey
2021-01-01 21:44 ` [PATCH 013/203] Split out eval_op_member Tom Tromey
2021-01-01 21:44 ` [PATCH 014/203] Split out eval_op_add Tom Tromey
2021-01-01 21:44 ` [PATCH 015/203] Split out eval_op_sub Tom Tromey
2021-01-01 21:44 ` [PATCH 016/203] Split out eval_op_binary Tom Tromey
2021-01-01 21:44 ` [PATCH 017/203] Split out eval_op_subscript Tom Tromey
2021-01-01 21:44 ` [PATCH 018/203] Split out eval_op_equal Tom Tromey
2021-01-01 21:44 ` [PATCH 019/203] Split out eval_op_notequal Tom Tromey
2021-01-01 21:44 ` [PATCH 020/203] Split out eval_op_less Tom Tromey
2021-01-01 21:44 ` [PATCH 021/203] Split out eval_op_gtr Tom Tromey
2021-01-01 21:44 ` [PATCH 022/203] Split out eval_op_geq Tom Tromey
2021-01-01 21:44 ` [PATCH 023/203] Split out eval_op_leq Tom Tromey
2021-01-01 21:44 ` [PATCH 024/203] Split out eval_op_repeat Tom Tromey
2021-01-01 21:44 ` [PATCH 025/203] Split out eval_op_plus Tom Tromey
2021-01-01 21:44 ` [PATCH 026/203] Split out eval_op_neg Tom Tromey
2021-01-01 21:44 ` [PATCH 027/203] Split out eval_op_complement Tom Tromey
2021-01-01 21:44 ` [PATCH 028/203] Split out eval_op_lognot Tom Tromey
2021-01-01 21:44 ` [PATCH 029/203] Split out eval_op_ind Tom Tromey
2021-01-01 21:44 ` [PATCH 030/203] Split out eval_op_alignof Tom Tromey
2021-01-01 21:44 ` [PATCH 031/203] Split out eval_op_memval Tom Tromey
2021-01-01 21:44 ` [PATCH 032/203] Split out eval_op_preinc Tom Tromey
2021-01-01 21:44 ` [PATCH 033/203] Split out eval_op_predec Tom Tromey
2021-01-01 21:44 ` [PATCH 034/203] Split out eval_op_postinc Tom Tromey
2021-01-01 21:44 ` [PATCH 035/203] Split out eval_op_postdec Tom Tromey
2021-01-01 21:44 ` [PATCH 036/203] Split out eval_op_type Tom Tromey
2021-01-01 21:44 ` [PATCH 037/203] Split out eval_op_f_abs Tom Tromey
2021-01-01 21:44 ` [PATCH 038/203] Split out eval_op_f_mod Tom Tromey
2021-01-01 21:44 ` [PATCH 039/203] Split out eval_op_f_ceil Tom Tromey
2021-01-01 21:44 ` [PATCH 040/203] Split out eval_op_f_floor Tom Tromey
2021-01-01 21:44 ` [PATCH 041/203] Split out eval_op_f_modulo Tom Tromey
2021-01-01 21:44 ` [PATCH 042/203] Split out eval_op_f_cmplx Tom Tromey
2021-01-01 21:44 ` [PATCH 043/203] Split out eval_op_f_kind Tom Tromey
2021-01-01 21:44 ` [PATCH 044/203] Change parameters to rust_range Tom Tromey
2021-01-01 21:44 ` [PATCH 045/203] Change parameters to rust_subscript Tom Tromey
2021-01-01 21:44 ` [PATCH 046/203] Split out eval_op_rust_ind Tom Tromey
2021-01-01 21:44 ` [PATCH 047/203] Split out eval_op_rust_complement Tom Tromey
2021-01-01 21:44 ` [PATCH 048/203] Split out eval_op_rust_array Tom Tromey
2021-01-01 21:44 ` [PATCH 049/203] Split out eval_op_rust_struct_anon Tom Tromey
2021-01-01 21:44 ` [PATCH 050/203] Split out eval_op_rust_structop Tom Tromey
2021-01-01 21:44 ` [PATCH 051/203] Split helper functions Tom Tromey
2021-01-01 21:44 ` [PATCH 052/203] Split out eval_op_m2_high Tom Tromey
2021-01-04 12:05   ` Andrew Burgess
2021-02-10  0:56     ` Tom Tromey
2021-01-01 21:44 ` [PATCH 053/203] Split out eval_op_m2_subscript Tom Tromey
2021-01-01 21:44 ` [PATCH 054/203] Split out eval_binop_assign_modify Tom Tromey
2021-01-01 21:44 ` [PATCH 055/203] Split out eval_op_objc_msgcall Tom Tromey
2021-01-01 21:44 ` [PATCH 056/203] Split out eval_opencl_assign Tom Tromey
2021-01-01 21:44 ` [PATCH 057/203] Split out eval_ternop_in_range Tom Tromey
2021-01-01 21:44 ` [PATCH 058/203] Split out ada_unop_neg Tom Tromey
2021-01-01 21:44 ` [PATCH 059/203] Split out ada_unop_in_range Tom Tromey
2021-01-01 21:45 ` [PATCH 060/203] Split out ada_atr_tag Tom Tromey
2021-01-01 21:45 ` [PATCH 061/203] Split out ada_atr_size Tom Tromey
2021-01-01 21:45 ` [PATCH 062/203] Split out ada_abs Tom Tromey
2021-01-01 21:45 ` [PATCH 063/203] Split out ada_mult_binop Tom Tromey
2021-01-01 21:45 ` [PATCH 064/203] Split out ada_equal_binop Tom Tromey
2021-01-01 21:45 ` [PATCH 065/203] Split out ada_ternop_slice Tom Tromey
2021-01-01 21:45 ` [PATCH 066/203] Split out ada_binop_in_bounds Tom Tromey
2021-01-01 21:45 ` [PATCH 067/203] Split out ada_unop_atr Tom Tromey
2021-01-01 21:45 ` [PATCH 068/203] Split out ada_binop_minmax Tom Tromey
2021-01-01 21:45 ` [PATCH 069/203] Change value_val_atr to ada_val_atr Tom Tromey
2021-01-01 21:45 ` [PATCH 070/203] Split out ada_binop_exp Tom Tromey
2021-01-01 21:45 ` [PATCH 071/203] Split out eval_multi_subscript Tom Tromey
2021-01-01 21:45 ` [PATCH 072/203] Split gen_expr_binop_rest Tom Tromey
2021-01-01 21:45 ` [PATCH 073/203] Introduce class operation Tom Tromey
2021-01-03  7:09   ` Joel Brobecker
2021-01-03 13:55     ` Lancelot SIX via Gdb-patches
2021-02-10  0:57       ` Tom Tromey
2021-01-01 21:45 ` [PATCH 074/203] Implement dumping Tom Tromey
2021-01-01 21:45 ` [PATCH 075/203] Add two agent expression helper functions Tom Tromey
2021-01-01 21:45 ` [PATCH 076/203] Introduce float_const_operation Tom Tromey
2021-01-01 21:45 ` [PATCH 077/203] Introduce scope_operation Tom Tromey
2021-01-01 21:45 ` [PATCH 078/203] Introduce long_const_operation Tom Tromey
2021-01-01 21:45 ` [PATCH 079/203] Introduce var_msym_value_operation Tom Tromey
2021-01-01 21:45 ` [PATCH 080/203] Introduce var_entry_value_operation Tom Tromey
2021-01-01 21:45 ` [PATCH 081/203] Introduce func_static_var_operation Tom Tromey
2021-01-01 21:45 ` [PATCH 082/203] Introduce last_operation Tom Tromey
2021-01-01 21:45 ` [PATCH 083/203] Introduce register_operation Tom Tromey
2021-01-01 21:45 ` [PATCH 084/203] Introduce bool_operation Tom Tromey
2021-01-01 21:45 ` [PATCH 085/203] Introduce internalvar_operation Tom Tromey
2021-01-01 21:45 ` [PATCH 086/203] Introduce string_operation Tom Tromey
2021-01-01 21:45 ` [PATCH 087/203] Introduce ternop_slice_operation Tom Tromey
2021-01-01 21:45 ` [PATCH 088/203] Introduce ternop_cond_operation Tom Tromey
2021-01-01 21:45 ` [PATCH 089/203] Add c-exp.h and c_string_operation Tom Tromey
2021-01-01 21:45 ` [PATCH 090/203] Introduce objc_nsstring_operation Tom Tromey
2021-01-01 21:45 ` [PATCH 091/203] Introduce objc_selector_operation Tom Tromey
2021-01-01 21:45 ` [PATCH 092/203] Introduce complex_operation Tom Tromey
2021-01-01 21:45 ` [PATCH 093/203] Introduce structop_operation Tom Tromey
2021-01-01 21:45 ` [PATCH 094/203] Introduce structop_ptr_operation Tom Tromey
2021-01-01 21:45 ` [PATCH 095/203] Introduce structop_member_operation and structop_mptr_operation Tom Tromey
2021-01-01 21:45 ` [PATCH 096/203] Introduce concat_operation Tom Tromey
2021-01-01 21:45 ` [PATCH 097/203] Introduce add_operation Tom Tromey
2021-01-01 21:45 ` [PATCH 098/203] Introduce sub_operation Tom Tromey
2021-01-01 21:45 ` [PATCH 099/203] Introduce binop_operation Tom Tromey
2021-01-01 21:45 ` [PATCH 100/203] Introduce subscript_operation Tom Tromey
2021-01-01 21:45 ` [PATCH 101/203] Implement binary comparison operations Tom Tromey
2021-01-01 21:45 ` [PATCH 102/203] Introduce repeat_operation Tom Tromey
2021-01-01 21:45 ` [PATCH 103/203] Introduce comma_operation Tom Tromey
2021-01-01 21:45 ` [PATCH 104/203] Implement some unary operations Tom Tromey
2021-01-01 21:45 ` [PATCH 105/203] Implement unary increment and decrement operations Tom Tromey
2021-01-01 21:45 ` [PATCH 106/203] Introduce unop_ind_operation Tom Tromey
2021-01-01 21:45 ` [PATCH 107/203] Introduce type_operation Tom Tromey
2021-01-01 21:45 ` [PATCH 108/203] Introduce typeof_operation Tom Tromey
2021-01-01 21:45 ` [PATCH 109/203] Introduce decltype_operation Tom Tromey
2021-01-01 21:45 ` [PATCH 110/203] Introduce typeid_operation Tom Tromey
2021-01-01 21:45 ` [PATCH 111/203] Introduce unop_addr_operation Tom Tromey
2021-01-01 21:45 ` [PATCH 112/203] Introduce unop_sizeof_operation Tom Tromey
2021-01-01 21:45 ` [PATCH 113/203] Introduce unop_alignof_operation Tom Tromey
2021-01-01 21:45 ` [PATCH 114/203] Implement UNOP_MEMVAL and UNOP_MEMVAL_TYPE Tom Tromey
2021-01-01 21:45 ` [PATCH 115/203] Introduce op_this_operation Tom Tromey
2021-01-01 21:45 ` [PATCH 116/203] Introduce type_instance_operation Tom Tromey
2021-01-01 21:45 ` [PATCH 117/203] Introduce assign_operation Tom Tromey
2021-01-01 21:45 ` [PATCH 118/203] Introduce assign_modify_operation Tom Tromey
2021-01-01 21:45 ` [PATCH 119/203] Introduce unop_cast_operation Tom Tromey
2021-01-01 21:46 ` [PATCH 120/203] Introduce unop_cast_type_operation Tom Tromey
2021-01-01 21:46 ` [PATCH 121/203] Implement C++ cast operations Tom Tromey
2021-01-01 21:46 ` [PATCH 122/203] Introduce var_value_operation Tom Tromey
2021-01-01 21:46 ` [PATCH 123/203] Introduce objc_msgcall_operation Tom Tromey
2021-01-01 21:46 ` [PATCH 124/203] Introduce multi_subscript_operation Tom Tromey
2021-01-01 21:46 ` [PATCH 125/203] Introduce ada_wrapped_operation Tom Tromey
2021-01-01 21:46 ` [PATCH 126/203] Introduce ada_string_operation Tom Tromey
2021-01-01 21:46 ` [PATCH 127/203] Introduce ada_qual_operation Tom Tromey
2021-01-01 21:46 ` [PATCH 128/203] Introduce ada_ternop_range_operation Tom Tromey
2021-01-01 21:46 ` [PATCH 129/203] Implement several Fortran operations Tom Tromey
2021-01-01 21:46 ` [PATCH 130/203] Implement some Rust operations Tom Tromey
2021-01-01 21:46 ` [PATCH 131/203] Introduce rust_unop_ind_operation Tom Tromey
2021-01-01 21:46 ` [PATCH 132/203] Introduce rust_subscript_operation Tom Tromey
2021-01-01 21:46 ` [PATCH 133/203] Introduce rust_range_operation Tom Tromey
2021-01-01 21:46 ` [PATCH 134/203] Implement Rust field operations Tom Tromey
2021-01-01 21:46 ` [PATCH 135/203] Introduce rust_aggregate_operation Tom Tromey
2021-01-01 21:46 ` [PATCH 136/203] Add two simple Modula-2 operations Tom Tromey
2021-01-07 15:16   ` Gaius Mulley via Gdb-patches
2021-01-01 21:46 ` [PATCH 137/203] Implement the "&&" and "||" operators Tom Tromey
2021-01-01 21:46 ` [PATCH 138/203] Implement some Ada unary operations Tom Tromey
2021-01-01 21:46 ` [PATCH 139/203] Introduce ada_unop_range_operation Tom Tromey
2021-01-01 21:46 ` [PATCH 140/203] Introduce class adl_func_operation Tom Tromey
2021-01-01 21:46 ` [PATCH 141/203] Introduce array_operation Tom Tromey
2021-01-01 21:46 ` [PATCH 142/203] Implement function call operations Tom Tromey
2021-01-01 21:46 ` [PATCH 143/203] Implement Rust funcall operation Tom Tromey
2021-01-01 21:46 ` [PATCH 144/203] Introduce fortran_undetermined Tom Tromey
2021-01-01 21:46 ` [PATCH 145/203] Introduce opencl_cast_type_operation Tom Tromey
2021-01-01 21:46 ` [PATCH 146/203] Implement OpenCL binary operations Tom Tromey
2021-01-01 21:46 ` [PATCH 147/203] Introduce opencl_notequal_operation Tom Tromey
2021-01-01 21:46 ` [PATCH 148/203] Introduce opencl_structop_operation Tom Tromey
2021-01-01 21:46 ` [PATCH 149/203] Implement OpenCL logical binary operations Tom Tromey
2021-01-01 21:46 ` [PATCH 150/203] Implement OpenCL ternary conditional operator Tom Tromey
2021-01-01 21:46 ` [PATCH 151/203] Split out some Ada type resolution code Tom Tromey
2021-01-03  7:46   ` Joel Brobecker
2021-02-13 19:47     ` Tom Tromey
2021-01-01 21:46 ` [PATCH 152/203] Introduce ada_binop_addsub_operation Tom Tromey
2021-01-01 21:46 ` [PATCH 153/203] Implement Ada multiplicative operators Tom Tromey
2021-01-01 21:46 ` [PATCH 154/203] Implement Ada equality operators Tom Tromey
2021-01-01 21:46 ` [PATCH 155/203] Introduce ada_bitwise_operation Tom Tromey
2021-01-01 21:46 ` [PATCH 156/203] Introduce ada_ternop_slice Tom Tromey
2021-01-01 21:46 ` [PATCH 157/203] Introduce ada_binop_in_bounds Tom Tromey
2021-01-01 21:46 ` [PATCH 158/203] Implement some Ada OP_ATR_ operations Tom Tromey
2021-01-01 21:46 ` [PATCH 159/203] Introduce ada_var_value_operation Tom Tromey
2021-01-01 21:46 ` [PATCH 160/203] Introduce ada_var_msym_value_operation Tom Tromey
2021-01-01 21:46 ` [PATCH 161/203] Implement Ada min and max operations Tom Tromey
2021-01-01 21:46 ` [PATCH 162/203] Refactor value_pos_atr Tom Tromey
2021-01-01 21:46 ` [PATCH 163/203] Introduce ada_pos_operation Tom Tromey
2021-01-01 21:46 ` [PATCH 164/203] Introduce ada_atr_val_operation Tom Tromey
2021-01-01 21:46 ` [PATCH 165/203] Introduce ada_binop_exp_operation Tom Tromey
2021-01-01 21:46 ` [PATCH 166/203] Introduce ada_unop_ind_operation Tom Tromey
2021-01-01 21:46 ` [PATCH 167/203] Introduce ada_structop_operation Tom Tromey
2021-01-01 21:46 ` [PATCH 168/203] Implement function calls for Ada Tom Tromey
2021-01-01 21:46 ` [PATCH 169/203] Implement Ada resolution Tom Tromey
2021-01-03  7:57   ` Joel Brobecker
2021-02-13 19:49     ` Tom Tromey
2021-01-01 21:46 ` [PATCH 170/203] Implement Ada assignment Tom Tromey
2021-01-01 21:46 ` [PATCH 171/203] Remove use of op_string Tom Tromey
2021-01-01 21:46 ` [PATCH 172/203] Add an expr::operation_up to struct expression Tom Tromey
2021-01-01 21:46 ` [PATCH 173/203] Add completion for operations Tom Tromey
2021-01-01 21:46 ` [PATCH 174/203] Add operation-related methods to parser_state Tom Tromey
2021-01-01 21:46 ` [PATCH 175/203] Convert dtrace probes to use operations Tom Tromey
2021-01-01 21:46 ` Tom Tromey [this message]
2021-01-01 21:46 ` [PATCH 177/203] Convert rust-exp.y " Tom Tromey
2021-01-01 21:46 ` [PATCH 178/203] Convert c-exp.y " Tom Tromey
2021-01-01 21:46 ` [PATCH 179/203] Convert go-exp.y " Tom Tromey
2021-01-01 21:47 ` [PATCH 180/203] Convert d-exp.y " Tom Tromey
2021-01-01 21:47 ` [PATCH 181/203] Convert p-exp.y " Tom Tromey
2021-01-01 21:47 ` [PATCH 182/203] Convert m2-exp.y " Tom Tromey
2021-01-01 21:47 ` [PATCH 183/203] Convert f-exp.y " Tom Tromey
2021-01-01 21:47 ` [PATCH 184/203] Convert ada-exp.y " Tom Tromey
2021-01-01 21:47 ` [PATCH 185/203] Remove now-unused Rust evaluator code Tom Tromey
2021-01-01 21:47 ` [PATCH 186/203] Remove now-unused Fortran " Tom Tromey
2021-01-01 21:47 ` [PATCH 187/203] Remove now-unused Modula-2 " Tom Tromey
2021-01-01 21:47 ` [PATCH 188/203] Remove now-unused Ada " Tom Tromey
2021-01-01 21:47 ` [PATCH 189/203] Remove now-unused C " Tom Tromey
2021-01-01 21:47 ` [PATCH 190/203] Remove union exp_element Tom Tromey
2021-01-01 21:47 ` [PATCH 191/203] Remove two Ada opcodes Tom Tromey
2021-01-01 21:47 ` [PATCH 192/203] Remove unused Modula-2 opcodes Tom Tromey
2021-01-01 21:47 ` [PATCH 193/203] Remove unused Ada opcodes Tom Tromey
2021-01-01 21:47 ` [PATCH 194/203] Remove OP_EXTENDED0 Tom Tromey
2021-01-01 21:47 ` [PATCH 195/203] Remove OP_UNUSED_LAST Tom Tromey
2021-01-01 21:47 ` [PATCH 196/203] Remove BINOP_END Tom Tromey
2021-01-01 21:47 ` [PATCH 197/203] Inline expression constructor Tom Tromey
2021-01-01 21:47 ` [PATCH 198/203] Inline expr_builder methods Tom Tromey
2021-01-01 21:47 ` [PATCH 199/203] Merge namespace scopes in eval.c Tom Tromey
2021-01-01 21:47 ` [PATCH 200/203] Remove EVAL_SKIP Tom Tromey
2021-01-01 21:47 ` [PATCH 201/203] Change exp_uses_objfile to return bool Tom Tromey
2021-01-01 21:47 ` [PATCH 202/203] Use bound_minimal_symbol in var_msym_value_operation Tom Tromey
2021-01-01 21:47 ` [PATCH 203/203] Remove some null checks Tom Tromey
2021-01-03  7:02 ` [PATCH 000/203] Refactor expressions Joel Brobecker
2021-01-04 12:16   ` Andrew Burgess
2021-02-13 19:54   ` Tom Tromey
2021-02-16 16:17     ` 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=20210101214723.1784144-177-tom@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