summaryrefslogtreecommitdiff
path: root/gdb/ada-exp.h
diff options
context:
space:
mode:
authorTom Tromey <tromey@adacore.com>2022-12-21 11:52:37 -0700
committerTom Tromey <tromey@adacore.com>2023-02-27 08:09:02 -0700
commit013a623f4cb70060556cf302f4ae54d5f96e66e1 (patch)
tree1ece7263df373e35700ee0aa30c1f91d34b4c622 /gdb/ada-exp.h
parentd11280feed53fa1faa2c543fb04344ae312143b2 (diff)
downloadbinutils-gdb-013a623f4cb70060556cf302f4ae54d5f96e66e1.tar.gz
Implement some agent expressions for Ada
Ada historically has not implemented agent expressions, and some Ada constructs probably cannot reasonably be converted to agent expressions. However, a subset of simple operations can be, and this patch represents a first step in that direction. On one internal AdaCore test case, this improves the performance of a conditional breakpoint from 5 minutes to 5 seconds. The main tricky part in this patch is ensuring the converted expressions detect the cases that will not work. This is done by examining the code in the corresponding evaluation methods.
Diffstat (limited to 'gdb/ada-exp.h')
-rw-r--r--gdb/ada-exp.h26
1 files changed, 25 insertions, 1 deletions
diff --git a/gdb/ada-exp.h b/gdb/ada-exp.h
index 7e59267192a..54ae4529def 100644
--- a/gdb/ada-exp.h
+++ b/gdb/ada-exp.h
@@ -130,6 +130,14 @@ public:
enum exp_opcode opcode () const override
{ return std::get<0> (m_storage)->opcode (); }
+
+protected:
+
+ void do_generate_ax (struct expression *exp,
+ struct agent_expr *ax,
+ struct axs_value *value,
+ struct type *cast_type)
+ override;
};
/* An Ada string constant. */
@@ -255,6 +263,18 @@ public:
arg1, arg2);
}
+ void do_generate_ax (struct expression *exp,
+ struct agent_expr *ax,
+ struct axs_value *value,
+ struct type *cast_type)
+ override
+ {
+ gen_expr_binop (exp, opcode (),
+ std::get<1> (this->m_storage).get (),
+ std::get<2> (this->m_storage).get (),
+ ax, value);
+ }
+
enum exp_opcode opcode () const override
{ return std::get<0> (m_storage); }
};
@@ -380,7 +400,11 @@ public:
protected:
- using operation::do_generate_ax;
+ void do_generate_ax (struct expression *exp,
+ struct agent_expr *ax,
+ struct axs_value *value,
+ struct type *cast_type)
+ override;
};
/* Variant of var_msym_value_operation for Ada. */