= ada_modular_bound (type_arg);
if (!bound.has_value ())
error (_("'modulus applied to type with non-constant bound"));
- write_int (pstate, *bound, type_arg->target_type ());
+ gdb_mpz modulus = gdb_mpz (*bound) + 1;
+ /* Pick something that's almost certainly
+ large enough. */
+ struct type *r_type
+ = language_lookup_primitive_type (pstate->language (),
+ pstate->gdbarch (),
+ "unsigned_long_long_long_integer");
+ pstate->push_new<long_const_operation> (r_type,
+ modulus);
+ ada_wrap<ada_wrapped_operation> ();
}
;
return *this;
}
- gdb_mpz operator+ (const gdb_mpz &other) const
+ gdb_mpz operator+ (const gdb_mpz &other) const &
{
gdb_mpz result;
mpz_add (result.m_val, m_val, other.m_val);
return result;
}
+ gdb_mpz operator+ (const gdb_mpz &other) &&
+ {
+ mpz_add (m_val, m_val, other.m_val);
+ return *this;
+ }
+
+ gdb_mpz operator+ (unsigned long val) const &
+ {
+ gdb_mpz result;
+ mpz_add_ui (result.m_val, m_val, val);
+ return result;
+ }
+
+ gdb_mpz operator+ (unsigned long val) &&
+ {
+ mpz_add_ui (m_val, m_val, val);
+ return *this;
+ }
+
gdb_mpz &operator-= (unsigned long other)
{
mpz_sub_ui (m_val, m_val, other);
# was displayed, gdb would say "mod 0".
gdb_test "ptype mod1_type" "type = mod 4294967296"
gdb_test "ptype mod2_type" "type = mod 18446744073709551616"
+
+gdb_test "print mod1_type'Modulus" " = 4294967296"
+gdb_test "print mod2_type'Modulus" " = 18446744073709551616"
+gdb_test "print mod3_type'Modulus" " = 4"
procedure Prog is
type Mod1_Type_Base is mod 2 ** 32;
type Mod2_Type_Base is mod 2 ** 64;
+ type Mod3_Type is mod 4;
-- We use subtypes here because GCC emits the above modular types
-- as base types with the expected size, which gdb then displays
X : Mod1_Type := 23;
Y : Mod2_Type := 91;
+ Z : Mod3_Type := 2;
begin
null; -- STOP