return result;
}
+ gdb_mpz operator- () const
+ {
+ gdb_mpz result;
+ mpz_neg (result.m_val, m_val);
+ return result;
+ }
+
gdb_mpz &operator<<= (unsigned long nbits)
{
mpz_mul_2exp (m_val, m_val, nbits);
return *this;
}
- gdb_mpz operator<< (unsigned long nbits) const
+ gdb_mpz operator<< (unsigned long nbits) const &
{
gdb_mpz result;
mpz_mul_2exp (result.m_val, m_val, nbits);
return result;
}
+ gdb_mpz operator<< (unsigned long nbits) &&
+ {
+ mpz_mul_2exp (m_val, m_val, nbits);
+ return *this;
+ }
+
gdb_mpz operator>> (unsigned long nbits) const
{
gdb_mpz result;
" Constant: 0" \
"evaluation of this expression requires the target program to be active"] \
"print a string with expression debug turned on"
+
+# PR rust/31082 - truncating to a pointer would fail. Depending on
+# the default host architecture, this may or may not print a warning.
+gdb_test "print (0xffffffd00000009a as *mut u64)" \
+ "(warning: value truncated\[\r\n\]+)?.* = \\(\\*mut u64\\) $hex"
pointers and four byte addresses. */
int addr_bit = gdbarch_addr_bit (type2->arch ());
- LONGEST longest = value_as_long (arg2);
+ gdb_mpz longest = value_as_mpz (arg2);
- if (addr_bit < sizeof (LONGEST) * HOST_CHAR_BIT)
- {
- if (longest >= ((LONGEST) 1 << addr_bit)
- || longest <= -((LONGEST) 1 << addr_bit))
- warning (_("value truncated"));
- }
- return value_from_longest (to_type, longest);
+ gdb_mpz addr_val = gdb_mpz (1) << addr_bit;
+ if (longest >= addr_val || longest <= -addr_val)
+ warning (_("value truncated"));
+
+ return value_from_mpz (to_type, longest);
}
else if (code1 == TYPE_CODE_METHODPTR && code2 == TYPE_CODE_INT
&& value_as_long (arg2) == 0)