aboutsummaryrefslogtreecommitdiff
path: root/gdb/expop.h
diff options
context:
space:
mode:
authorTom Tromey <tromey@adacore.com>2023-03-27 12:54:51 -0600
committerTom Tromey <tromey@adacore.com>2023-04-17 10:43:06 -0600
commit5309ce2f04d8b76ff8a8005f6115cdf544d83bf7 (patch)
tree1d490ac2e03730012d66a71b8593672f33dfffae /gdb/expop.h
parent767c4b92bc4333cb1b49a42b8d012170a40900fe (diff)
downloadgdb-5309ce2f04d8b76ff8a8005f6115cdf544d83bf7.zip
gdb-5309ce2f04d8b76ff8a8005f6115cdf544d83bf7.tar.gz
gdb-5309ce2f04d8b76ff8a8005f6115cdf544d83bf7.tar.bz2
Convert long_const_operation to use gdb_mpz
This changes long_const_operation to use gdb_mpz for its storage.
Diffstat (limited to 'gdb/expop.h')
-rw-r--r--gdb/expop.h26
1 files changed, 23 insertions, 3 deletions
diff --git a/gdb/expop.h b/gdb/expop.h
index d973d23..854945c 100644
--- a/gdb/expop.h
+++ b/gdb/expop.h
@@ -274,6 +274,12 @@ check_objfile (ULONGEST val, struct objfile *objfile)
return false;
}
+static inline bool
+check_objfile (const gdb_mpz &val, struct objfile *objfile)
+{
+ return false;
+}
+
template<typename T>
static inline bool
check_objfile (enum_flags<T> val, struct objfile *objfile)
@@ -320,6 +326,8 @@ extern void dump_for_expression (struct ui_file *stream, int depth,
extern void dump_for_expression (struct ui_file *stream, int depth,
CORE_ADDR addr);
extern void dump_for_expression (struct ui_file *stream, int depth,
+ const gdb_mpz &addr);
+extern void dump_for_expression (struct ui_file *stream, int depth,
internalvar *ivar);
extern void dump_for_expression (struct ui_file *stream, int depth,
symbol *sym);
@@ -469,6 +477,12 @@ check_constant (ULONGEST cst)
}
static inline bool
+check_constant (const gdb_mpz &cst)
+{
+ return true;
+}
+
+static inline bool
check_constant (struct symbol *sym)
{
enum address_class sc = sym->aclass ();
@@ -665,18 +679,21 @@ protected:
};
class long_const_operation
- : public tuple_holding_operation<struct type *, LONGEST>
+ : public tuple_holding_operation<struct type *, gdb_mpz>
{
public:
using tuple_holding_operation::tuple_holding_operation;
+ long_const_operation (struct type *type, LONGEST val)
+ : long_const_operation (type, gdb_mpz (val))
+ { }
+
value *evaluate (struct type *expect_type,
struct expression *exp,
enum noside noside) override
{
- return value_from_longest (std::get<0> (m_storage),
- std::get<1> (m_storage));
+ return value_from_mpz (std::get<0> (m_storage), std::get<1> (m_storage));
}
enum exp_opcode opcode () const override
@@ -687,6 +704,9 @@ public:
protected:
+ LONGEST as_longest () const
+ { return std::get<1> (m_storage).as_integer_truncate<LONGEST> (); }
+
void do_generate_ax (struct expression *exp,
struct agent_expr *ax,
struct axs_value *value,