aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2021-03-08 07:27:57 -0700
committerTom Tromey <tom@tromey.com>2021-03-08 07:28:33 -0700
commit60fa02ca6fdaaf3f0afef842a4eb6b13286828a5 (patch)
tree19c30663e51e81280447fb20b2d726c3814bb6e6 /gdb
parent82c3886e24b3fed8d7e61b41f8cfdc17eedd88f8 (diff)
downloadbinutils-60fa02ca6fdaaf3f0afef842a4eb6b13286828a5.zip
binutils-60fa02ca6fdaaf3f0afef842a4eb6b13286828a5.tar.gz
binutils-60fa02ca6fdaaf3f0afef842a4eb6b13286828a5.tar.bz2
Implement some Ada OP_ATR_ operations
This implements a few Ada OP_ATR_ operations. gdb/ChangeLog 2021-03-08 Tom Tromey <tom@tromey.com> * ada-lang.c (ada_unop_atr_operation::evaluate): New method. * ada-exp.h (class ada_unop_atr_operation): New.
Diffstat (limited to 'gdb')
-rw-r--r--gdb/ChangeLog5
-rw-r--r--gdb/ada-exp.h16
-rw-r--r--gdb/ada-lang.c21
3 files changed, 42 insertions, 0 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index c414df1..ee37053 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,10 @@
2021-03-08 Tom Tromey <tom@tromey.com>
+ * ada-lang.c (ada_unop_atr_operation::evaluate): New method.
+ * ada-exp.h (class ada_unop_atr_operation): New.
+
+2021-03-08 Tom Tromey <tom@tromey.com>
+
* ada-lang.c (ada_binop_in_bounds): No longer static.
* ada-exp.h (class ada_binop_in_bounds_operation): New.
diff --git a/gdb/ada-exp.h b/gdb/ada-exp.h
index 4c30734..e92ae46 100644
--- a/gdb/ada-exp.h
+++ b/gdb/ada-exp.h
@@ -267,6 +267,22 @@ public:
{ return BINOP_IN_BOUNDS; }
};
+/* Implement several unary Ada OP_ATR_* operations. */
+class ada_unop_atr_operation
+ : public maybe_constant_operation<operation_up, enum exp_opcode, int>
+{
+public:
+
+ using maybe_constant_operation::maybe_constant_operation;
+
+ value *evaluate (struct type *expect_type,
+ struct expression *exp,
+ enum noside noside) override;
+
+ enum exp_opcode opcode () const override
+ { return std::get<1> (m_storage); }
+};
+
} /* namespace expr */
#endif /* ADA_EXP_H */
diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c
index 2424167..9103ece 100644
--- a/gdb/ada-lang.c
+++ b/gdb/ada-lang.c
@@ -10532,6 +10532,27 @@ ada_binop_addsub_operation::evaluate (struct type *expect_type,
return arg1;
}
+value *
+ada_unop_atr_operation::evaluate (struct type *expect_type,
+ struct expression *exp,
+ enum noside noside)
+{
+ struct type *type_arg = nullptr;
+ value *val = nullptr;
+
+ if (std::get<0> (m_storage)->opcode () == OP_TYPE)
+ {
+ value *tem = std::get<0> (m_storage)->evaluate (nullptr, exp,
+ EVAL_AVOID_SIDE_EFFECTS);
+ type_arg = value_type (tem);
+ }
+ else
+ val = std::get<0> (m_storage)->evaluate (nullptr, exp, noside);
+
+ return ada_unop_atr (exp, noside, std::get<1> (m_storage),
+ val, type_arg, std::get<2> (m_storage));
+}
+
}
/* Implement the evaluate_exp routine in the exp_descriptor structure