diff options
Diffstat (limited to 'gdb/dfp.c')
-rw-r--r-- | gdb/dfp.c | 13 |
1 files changed, 12 insertions, 1 deletions
@@ -146,12 +146,23 @@ decimal_to_number (const gdb_byte *from, int len, decNumber *to) 16 bytes for decimal128. */ std::string decimal_to_string (const gdb_byte *decbytes, int len, - enum bfd_endian byte_order) + enum bfd_endian byte_order, const char *format) { gdb_byte dec[16]; match_endianness (decbytes, len, byte_order, dec); + if (format != nullptr) + { + /* We don't handle format strings (yet). If the host printf supports + decimal floating point types, just use this. Otherwise, fall back + to printing the number while ignoring the format string. */ +#if defined (PRINTF_HAS_DECFLOAT) + /* FIXME: This makes unwarranted assumptions about the host ABI! */ + return string_printf (format, dec); +#endif + } + std::string result; result.resize (MAX_DECIMAL_STRING); |